Plotting & derivatives

Here’s a polynomial expression to plot....

someCubic = 7.2 -4.8* x-2.2* x^2+x^3

Plot it for x values between -10 and +10.

Plot[someCubic,{x,-10,10}]

I’d like to see where this graph crosses the x-axis in more detail, so let me mess with the y-range, like this...

Plot[someCubic,{x,-10,10},PlotRange->{-50,50}]

So, I’ll tailor the plotting range to look in the region where the solutions are clustered...

Plot[someCubic,{x,-3,4}]

Let’s solve the cubic equation to get precise positions for those zeroes to see if they match the graph...

Solve[someCubic==0,x]

What nice, even values this polynomial has!  Actually, I came up with it like this....

Expand[(x-1.2)*(x+2)*(x-3)]

Plotting more than one graph

The solutions to  someCubic == (x^2)...

Solve[someCubic==x^2,x]

These solutions correspond to places where the graph of the cubic expression  intersects the parabola g(x)=x^2.  Let’s graph both expressions to see if these solutions look right graphically...

Plot[{someCubic,x^2},{x,-3,4}]

Derivatives

D[..., x] gives the first derivative w.r.t. x

D[someCubic,x]

The second derivative...

D[someCubic,{x,2}]

It’s  the partial derivative of multi-variable expressions....

D[4*y^2*x^2 + 2y,x]

D[4*y^2*x^2 + 2y,y]

Parametric plotting

ParametricPlot[{t^2,t},{t,-2,2}]

As you might guess, you feed ParametricPlot a list, where the first item is x(t) and the second item is y(t).  

Of course there’s nothing sacred about t, you could just as soon use a different parameter, say h.  Here’s how you plot more than one parametric plot at a time....

ParametricPlot[
{{h^2,h},
{0.5*h^2,h}},

{h,-2,2}
]