Run a file:

1 |
%runfile filename.sage |

Create matrices:

1 2 3 4 |
matrix(RR, nrows, ncols) # real ring matrix(SR, nrows, ncols) # symbolic ring matrix([[a,b,c],[d,e,f],[g,h,i]]) # real vector([a,b,c]) # single column matrix |

Solve M * X = Y (where M – co-efficients; Y – constants) :

1 |
M.solve_right(Y) |

Create variables (symbolic math):

1 2 |
x,y = var('x,y') tan_theta = y / x; |