• The Mathematica lab is here. The assignment is at the end of the lab.
  • Here is an example on how to check a PDE with mathematica.
    FullSimplify[D[f[t,x],t] == D[f[t,x],{x,2}]]

    Graphs and contour plots of functions of two variables
    Please distinguish "graph", "contour curve", "contour surface", "contour map". Mathematica does this also nicely: If you do not specify a value in Contour Plot, it produces a contour map (several surfaces).
    f[x_, y_] := x^2 + y^2; 
    ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}]
    Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}]
    ContourPlot3D[ z - f[x, y], {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]
    ContourPlot3D[f[x, y] == 1, {x, -2, 2}, {y, -2, 2}]
    ContourPlot3D[z - f[x, y] == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

    Lagrange problems

    Solve a Lagrange problem with 2 variables
    f=2x^2+4 x y;  g=x^2 y;
    With 3 variables:
    f=2x^2+4 x*y+z;     g=x^2 y + z;   c=1;
    Solve[{D[f,x]==L*D[g,x], D[f,y]==L*D[g,y], D[f,z]==L*D[g,z], g==c},{x,y,z,L}]
    With 3 variables and two constraints
    f=x y z;  g=x*y+2 y z+2 x z;  h=2x+2y+4z; d=4; c=1
    Solve[{D[f,x]==L*D[g,x] + M*D[h,x],
           D[f,y]==L*D[g,y] + M*D[h,y],
           D[f,z]==L*D[g,z] + M*D[h,z],
           g==c, h==d},{x,y,z,L,M}]

    Classifying critical points

    Here is example code on how to compute the gradient and the discriminant
    f=x^3 y^3- x y^2;

    Classifying critical points

    This produces a nice table.
    f=4 x y - x^3 y - x y^3;
    ClassifyCriticalPoints[f_,{x_,y_}]:=Module[{X,P,H,g,d,S}, X={x,y};
    P=Sort[Solve[Thread[D[f,#] & /@ X==0],X]]; H=Outer[D[f,#1,#2]&,X,X];g=H[[1,1]];d=Det[H];
    TableForm[{x,y,d,g,S[d,g],f} /.P,TableHeadings->{None,{x,y,"D","f_xx","Type","f"}}]]


    We will have a Mathematica lab at the end of this course. Please help each other installing mathematica. You should have done so until Tuesday 6/30/2020, when we start graphing.
    • Make an gmail account from harvard
    • You can get Mathematica from here. There are instructions there to download and install Mathematica.
    • You need to make a wolfram account. Start here to make an account (use your Harvard summer school email address), Use the latest Mathematica version.