Mathematica Project

The projects were submitted Saturday night. They came out nicely See the gallery.
Here is the example drawn in class to illustrate Problem 5 in the project
A1={Red,Tube[{{-10,0,0},{0,0,0}},0.5]};
A2={Orange,Cuboid[{-2,-1.2,0},{2,1.2,1}]};
A3={Green,Table[Cylinder[{{x,y,0},{x,y,2}},0.1],{x,-2,2,0.4},{y,-1,1,0.4}]};
A4={Yellow,Tube[Table[{t,Sin[t],2+Cos[t]},{t,-1,1,0.1}],0.9]};
Graphics3D[{A1,A2,A3,A4},Boxed->False, 
ViewPoint->{0.3992,-2.51,2.2}, ViewVertical->{-0.01,0.18,0.98}]

Installation

Mathematica

Extrema

Here is the procedure mentioned this morning to get a list of critical points of a function. Just copy paste the following lines into a notebook and evaluate:

f = x^3 y + y^3 x - 4 x*y; X = {x, y};
ClassifyCriticalPoints[f_, {x_, y_}] := Module[{X, P, H, g, d, S},
  P = Solve[ {D[f, x] == 0, D[f, y] == 0}, {x, y}];
  H = Outer[D[f, #1, #2] &, {x, y}, {x, y}]; g = H[[1, 1]]; d = Det[H];
  S[d_, g_] := If[d < 0, "saddle", If[g > 0, "minimum", "maximum"]];
  TableForm[{x, y, d, g, S[d, g], f} /. P, 
   TableHeadings -> {None, {x, y, "D", "f_xx", "Type", "f"}}]]
ClassifyCriticalPoints[f, {x, y}]


To solve a Lagrange problem
F[x_,y_]:=2x^2+4 x y;     G[x_,y_]:=x^2 y;
Solve[{D[F[x,y],x]==L*D[G[x,y],x],
       D[F[x,y],y]==L*D[G[x,y],y],G[x,y]==1},{x,y,L}]

Plotting

Plot3D[ Sin[x*y],{x,-2,2},{y,-2,2}] 
ParametricPlot3D[ {z Cos[t],z Sin[t],z},{t,0,2Pi},{z,-1,1}] 
ContourPlot3D[ Abs[x]+Abs[y]==1,{x,-2,2},{y,-2,2},{z,-2,2}] 


PDE simplification

  • Here is an example on how to check a PDE with mathematica. Sometimes, one has to use Full Simplify rather than simplify. Here is one possibility to do things
    f[t_,x_]:=(1/Sqrt[t])*Exp[-x^2/(4t)];
    FullSimplify[D[f[t,x],t] == D[f[t,x],{x,2}]]
    


    Here is the same computation, where the function g is just given as an expression. I was putting a Clear[f] before so that the previous definition would not interfere.
    Clear[f]; 
    f=(1/Sqrt[t])*Exp[-x^2/(4t)];
    FullSimplify[D[f,t] == D[f,{x,2}]]
    


    AI

    Computers have helped us more and more in the last decades. It started to explode in the 1940ies when the first mechanical, electric and then electronic computers became available. Computer algebra systems developed in the 1960ies have grown more and more sophisticated. AI developments started during that time too. After a shorter AI winter, it reemerged with a vengeance at the beginning of the 21st century. More than 20 years ago, we played with bots interacting with computer algebra systems including mathematica see this page.The last few years, large language models or diffusion production tools have shocked with their abilities. In education, we have now to learn to deal with this. If you get help from any external entity which can be a computer algebra system or a large language model, you need to acknowledge it in your work. It is a basic part of academic life that one gives credit to sources like books, articles, ideas from others, including computers! Be careful. Computer programs can be buggy. AI systems are known to hallucinate and make things up. See here examples of wrong stuff done by Chat GPT.