LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn Examples from Wednesday
<Text-field style="Heading 1" layout="Heading 1">div and curl in VectorCalculus</Text-field> I) Using vector calculus to find divergence and curl First load the VectorCalculus package with(VectorCalculus); You then want to set the coordinate system and name the coordinates. I will do standard Cartesian 3D. I also set the BasisFormat command to false because I like vector format ratehr than linear combination format. SetCoordinates(cartesian[x,y,z]); BasisFormat(false); Next you define a VectorField. This is a data type used by the commands in the package. vf := VectorField(<x, x^2*y, z*y*z>); Now the commands are straightforward. Del.vf; Curl(vf); Divergence(vf); LinearAlgebra[CrossProduct](Del, vf);
<Text-field style="Heading 1" layout="Heading 1">Plotting Polar Functions</Text-field> The question was asked about graphing functions converted to polar format. func:= (x, y) -> x^2*y/(x^2+y^2); makepolar := g -> simplify(subs({x=r*cos(theta), y=r*sin(theta)}, g)); polarfunc := makepolar(func(x,y)); plot3d(func(x,y),x=-1..1, y=-1..1, style=patchcontour, axes=boxed); plot3d([r,theta, polarfunc], r=0..1, theta=0..2*Pi, coords=cylindrical, style=patchcontour, axes=boxed); LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn