M A T H 2 1 B
Mathematics Math21b Spring 2015
Linear Algebra and Differential Equations
CAS
Office: SciCtr 432

 The lab. See the end of the notebook for the assignment. A mathematica workshop took place Thursday, April 30, 2015 4-5 in Hall SC D, where we walk through the project and are available for Questions and Answers. The project is due Mai 1 (post stamp of email needs to be Friday May 1). Some came in virtually in the last minute: Fri May 1 23:55 893/65960 "Mathematica Project" Fri May 1 23:57 1419/105953 "Re: [ MATH 21b ] deadline in 2 hours" Fri May 1 23:58 37050/2850642 "" Fri May 1 23:59 928/68154 "Re: [ MATH 21b ] deadline in 2 hours" Fri May 1 23:59 598/44006 "Mathematica"  It is useful to know what can be done with computer algebra systems "the four M's". Mathematica, Matlab or Maple and Maxima. The following example snippets should become self explanatory during the course.

## Mathematica

get it here and request a password,
 A={{1,2,3},{4,5,5},{6,7,8}} v={5,-2,3} Inverse[A] A.v A.A.A LinearSolve[A,v] RowReduce[A] QRDecomposition[{{1,0,0},{1,1,0},{1,1,1}}] Fit[{{0,0},{0,1},{1,3}},{1,x,x^2},x] CharacteristicPolynomial[A,x] Tr[A] Det[A] Eigenvalues[A] Eigensystem[A] 

## Matlab

Matlab is a CAS which is strong in linear algebra. Matlab is available as a student version. Here are some of the above commands in Matlab.

 A = [1 2 3; 4 5 5; 6 7 8] v = [5;-2;3] inv(A) A*v A*A*A Av rref(A) qr(A) poly(A) det(A) trace(A) eig(A) [v,d]=eig(A) 

## Maple

Maple is a CAS comparable with Mathematica or Matlab. Here are the same commands in the Maple dialect.

 with(linalg); A:=[[1,2,3],[4,5,5],[6,7,8]]; v:=[5,-2,3]; inverse(A); multiply(A,v); evalm(A*A*A); linsolve(A,v); rref(A); v1:=[1,0,0]; v2:=[1,1,0]; v3:=[1,1,1]; GramSchmidt({v1,v2,v3}); charpoly(A,x); trace(A); det(A); eigenvalues(A); eigenvectors(A); 

## Maxima

Maxima is an open source CAS originally developed by the DOE. While having less features than the commercial CAS, it is GPL'd and free software: you can see the code.
(echelon(A) is here an upper triangular matrix);
 A: matrix([1,2,3],[4,5,5],[6,7,8]); v: [5,-2,3]; invert(A); A.v; A.A.A; linsolve([x+z=5,x+5*y=-2,x-z=0],[x,y,z]); echelon(A); load(eigen); gramschmidt(A); determinant(A); charpoly(A,x); eigenvalues(A); eigenvectors(A); 

 To fit data with Mathematica, you can use either the built in routines  data={{4,5},{2,10},{1,100},{5,3}};functions={1,x,Sin[x]}; Fit[data,functions,x]  or crank in the linear algebra: a+bx+c sin[x] =y  A=N[{{1,4,Sin},{1,2,Sin},{1,1,Sin},{1,5,Sin}}]; b={5,10,100,3}; Inverse[Transpose[A].A].Transpose[A].b  With both approaches you get in this example the function 210.3-60x-77.2 Sin[x] which beset fits the data points (4,5),(2,10),(1,100),(5,3).