Midterm Solutions

a={{3.0,1,-1},{1,3,1}};
b={{6.0,2},{2,6}};
c={{2.0,2,4},{4,0,-2},{-2,1,-1}};
v={1.0,1};
u={-1.0,0,1};

(* 1.*)
MatrixForm[a.Transpose[a]]
a.a (*can't work *)

(*2.*)
Norm[u]

(* 3. *)
Print[MatrixForm[c],MatrixForm[u]]
-2c[[1]]+c[[2]]
-2u[[1]]+u[[2]]

(* 4. *)
{u,s,v}=SingularValueDecomposition[a];
Print[MatrixForm[u],MatrixForm[s],MatrixForm[v]]
(*answer: 2X2, 2X3, 3x3 *)

(* 5. *)
b.{1,-1}
(* answer: 4 *)

(* 6. *)

(* 7. *)
data={{0.0,1},{1,0},{2,1}};
mat={{0.0,1},{1,1},{2,1}};
rhs={1.0,0,1};
{a,b}=Inverse[Transpose[mat].mat].Transpose[mat].rhs
p1=Plot[a*x+b,{x,0,2}];
p2 = ListPlot[data];
Show[{p1,p2}]

(* 8. *)
f[x_]:=0.2(x^4)+(1/3) Sin[ x]/3;
plot=Plot[{f[x],f'[x]},{x,-1,1},Ticks-> None]

(* 9. *)
f[x_]:= 0.5x^2+0.2Sin[10x];
g[x_]:= Sqrt[x]+ 0.5Sin[10x];

pic=Plot[{f[x],g[x],0.25f[x]+0.75g[x]},{x,0.5,1.5},Ticks->None]

(* 10. *)
data=Table[(x-10)^3+150Sin[10(x-10)],{x,1,20}];
pic1=ListPlot[data,Ticks->None,PlotStyle->Directive[PointSize[Medium],Black]];
pic2=Plot[(x-10)^3,{x,1,20}];
pic3=Plot[100(x-10),{x,1,20}];
Show[{pic1,pic2,pic3}]