# University of Illinois at Urbana-Champaign # MATH-484 - Fall 2013 # Instructor Bernard Lidicky # # From lecture 35 - showing some basic use of sage # Sage can be downloaded at http://www.sagemath.org # Or there is an online version of sage at http://www.sagenb.org # Help: # More details can be found at: # http://www.sagemath.org/doc/constructions/linear_algebra.html # http://www.sagemath.org/doc/reference/calculus/sage/calculus/calculus.html # # The following commands can be just paster into sagenb.org # I want to solve Ax = b # QQ stands for rational numbers. RR for reals M = MatrixSpace(QQ,3,3) # Something for generating matrices A = M([ 1,2,3, 4,5,6, 7,8,10]) # creates a matrix print "A=",A # prints view(A) # nice print V = VectorSpace(QQ,3) # vector space... over Q b = V([4,5,6]) A.inverse() A*A.inverse() x = A.inverse()*b A*x float(10/3) # how to write as a number and not as fraction octave.solve_linear_system(A,b) # Change to RR var('x,y') # say that x,y will be varibles f(x,y)=x^3+2*y^2 # function of two variables f.diff() # gradient H = f.diff(2) # hessian H(x=0,y=-1/2) # hessian at 0,-1/2 H(x=0,y=-1/2).eigenvalues() # eigenvalues...