Matrix output formatting - how to add scientific notation as a matrix multiplier in front of matrix output

46 Views Asked by At

SCREENSHOT OF IDEAL OUTPUT:

SCREENSHOT OF IDEAL OUTPUT

I am currently producing vectors and matrices and would like to format them so that the printed matrix displays only one digit before the decimal point (eg x.2, x.8 instead of xyz.2 or xyz.8) in each of the matrix elements. The Jupyter code below shows how they are currently formatted, and the screenshot (link above) shows how I would like the code to be formatted. Hence, I would like to automatically put a scientific notation matrix multiplier (eg 1 x 10^x...or in python terms "1ex") in front of the outputted matrix. If possible, I would like to have this set at the start of my code so that it could be applied to x amount of matrices without having to call a function that achieves this. Thanks very much.

JUPYTER CODE OUTPUT:

[[  888888.8888889        0.         1333333.3333333        0.               0.               0.       ]
 [       0.        33333333.3333333        0.               0.               0.               0.       ]
 [ 1333333.3333333        0.         2666666.6666667        0.               0.               0.       ]
 [       0.               0.               0.               0.               0.               0.       ]
 [       0.               0.               0.               0.               0.               0.       ]
 [       0.               0.               0.               0.               0.               0.       ]]

I tried formatting options at the start of my Jupyter notebook under the np.set_printoptions

0

There are 0 best solutions below