Issue
I have two matrices that want to print in one jupyter cell using init_printing, When I try printing them both only the last one gets printed.
import numpy as np
from sympy import init_printing, Matrix
L = np.array([[1, 0, 0], [2, 1, 0], [-1, 0.5, -1]])
b = np.array([2, 4, 2])
Matrix(L)
Matrix(b)
Solution
that's how jupyter-notebook cells work, only the last returned output will be shown. If you want both, do:
solution 01
Matrix(L), Matrix(b)
Output:
solution 02
Now, if you do insist to print one after another in the next line, you can use the display
module like this:
from IPython.display import display
import numpy as np
from sympy import Matrix
L = np.array([[1, 0, 0], [2, 1, 0], [-1, 0.5, -1]])
b = np.array([2, 4, 2])
display(Matrix(L))
display(Matrix(b))
Output:
Answered By - Musabbir Arrafi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.