(* Comments are enclosed in starred parentheses as in this example. Mathematica will give you the option to convert it to a "Text Cell"  which will improve readability *)

(* Mathematica computes symbolically as much as possible. Here are some  examples of how to get a numeric approximation. At the end of the line, press shift-return to see the result. *)

N[Pi]

(* The numeric approximation in the next example returns a complex number with imaginary part equal to zero. Use NIntegrate instead. *)

N[(∫_0^1)Sin[x^3]\[DifferentialD]x]

NIntegrate[Sin[x^3], {x,0,1}]

(* Here are examples of how to plot functions in 2D and 3D *)

f[x_] := x^2 (* This defines a function with x as the free variable *)

Plot[f[x], {x,-2,2},PlotRange->{-2,25}] (* Use PlotRange to control the y-axis *)

g[x_,y_] := Sin[x]y

Plot3D[g[x,y],{x,-Pi,Pi},{y,-4,4}]

(* Here are examples of plotting implicit functions *)

h[x_,y_] := x^2*y

ContourPlot[h[x,y] == 4, {x,-10,10},{y,-1,10}]

k[x_,y_,z_] := x^2 + y^2 + 3z^2

ContourPlot3D[k[x,y,z]== 1, {x,-1.5,1.5},{y,-1.5,1.5},{z,-1.5,1.5},
 MeshStyle->None,
ContourStyle->Directive[Blue,Opacity[0.8],Specularity[White,30]]
]

(* Here are examples of parametric curves in 2D and 3D and a parametric surface in 3D *)
curve[t_]:= {Cos[3t],Sin[t]*t}
ParametricPlot[curve[t],{t,0,2Pi},PlotRange->{{-2,2},{-5,2}}]

(* Here is how to trace the curve out over time *)

Column[
{Manipulator[Dynamic[s],{0,2Pi}],Dynamic@
ParametricPlot[curve[t],{t,0,Clip[s,{0.0001,2 Pi}]},PlotRange->{{-2,2},{-5,2}}
]
}
]

curve3d[t_]:={Cos[t],t*Sin[1+t^2],t}
pr := {{-8,8},{-8,8},{-1,8}}

ParametricPlot3D[curve3d[t],{t,0,3*Pi},PlotRange->pr]

(* Here is how to get it to trace the curve out over time *)

Column[
{Manipulator[Dynamic[s],{0,2Pi}],Dynamic@
ParametricPlot3D[curve3d[t],{t,0,Clip[s,{0.0001,3 Pi}]},PlotRange->pr
]
}
]

(* Here is an example of a parametric plot of a surface *)

surface[u_,v_] := {u*Cos[v], u*Sin[v], u*Cos[u]}
ParametricPlot3D[surface[u,v],{u,0,2},{v,0,2*Pi},PlotRange->Automatic]

(* How can we display different types of graphics at the same time? *)

contourplotexample := ContourPlot3D[(x^2)+(y^(2 ))+ (z^2)== 1, {x,-1,1},{y,-1,1}, {z,-1,1},Mesh->None, ContourStyle->Opacity[0.8]]
sphericalcurve := ParametricPlot3D[{Cos[t], Sin[t],t}/Sqrt[1+(t^2)],{t,-2Pi,2Pi},PlotStyle->{Black,Thickness[0.01]}]

Show[{contourplotexample,sphericalcurve},PlotRange->(-2)]

(* Here is how to plot a scalar field in 2D *)
f[x_,y_] := y*Cos[x]
DensityPlot[f[x,y],{x,-10,10},{y,-10,10},PlotRange->10,ColorFunction->"TemperatureMap"]

(* Here is how to plot a vector field in 2D *)

VectorPlot[{-y,x},{x,-4,4},{y,-4,4},PlotRange->Automatic]

(* To plot it so that all the arrows are the same size, use VectorScale and to increase the number of arrows use VectorPoints *)

VectorPlot[{-y,x},{x,-4,4},{y,-4,4},VectorScale->{.035,.9,None},VectorPoints->30,PlotRange->Automatic]