Docsity

Calculus 3 Computer Lab: Creating Plots of Functions and Derivatives in Mathematica, Lab Reports of Mathematics

Toggle sidebar
bg1
APPM 2450 - Calculus 3 Computer Lab Lab Exercise 2
APPM 2450 Calculus 3 Computer Lab
Lab Exercise 2
Create a Mathematica notebook that does all of the following. Feel free to ask your neighbor or your lab
instructor for help if you get stuck. Items with a àare required, items with a Pare optional.
àDefine the functions f(x) = x3+x2+x+ 1 and g(x) = x3+x2+x+ 1 −sin(x). Remember sin needs a capital
S, and square brackets.
àGet help for the command Plot.
àPlot f(x) with xrunning from −3 to 3.
àPlot f(x) with xrunning from −3 to 3 and yfrom −4 to 4. Use the PlotRange option, PlotRange->{-4,4}.
àPlot f(x) as above, but add the option PlotStyle->RGBColor[1,0,0] to color it red.
àStore the above plot as a p1, by either doing p1=%, or p1=Plot[......]
àPlot g(x) for the same values of xand yas you did for f(x) above. Make this plot blue
(PlotStyle->RGBColor[0,0,1]) and store the result as p2.
àUse the command Show[p1,p2] to display both functions on the same graph. Label your axes, look up how
if you need to.
àDefine h(x) = tan(x).
àMake a plot of h(x), for −π≤x≤π. Remember that in Mathematica πis Pi.
àNow plot h(x) as above, but use the option PlotRange->All. Does this plot look good? If not, fix it in a
way similar to the examples with f(x) above.
àDefine k(x) as the derivative of h(x). To do this, do something like k[x_]=D[...].
àMake a nice looking plot of k(x).
PPick your favorite equation, or if you don’t have one, use y=1
x2
−25 . Graph your chosen equation and its first
two derivatives on the same set of axes. Each should have its own color.

Partial preview of the text

Download Calculus 3 Computer Lab: Creating Plots of Functions and Derivatives in Mathematica and more Lab Reports Mathematics in PDF only on Docsity!

APPM 2450 - Calculus 3 Computer Lab Lab Exercise 2

APPM 2450 Calculus 3 Computer Lab Lab Exercise 2

Create a Mathematica notebook that does all of the following. Feel free to ask your neighbor or your lab instructor for help if you get stuck. Items with a à are required, items with a P are optional.

à Define the functions f (x) = x^3 + x^2 + x + 1 and g(x) = x^3 + x^2 + x + 1 − sin(x). Remember sin needs a capital S, and square brackets.

à Get help for the command Plot.

à Plot f (x) with x running from −3 to 3.

à Plot f (x) with x running from −3 to 3 and y from −4 to 4. Use the PlotRange option, PlotRange->{-4,4}.

à Plot f (x) as above, but add the option PlotStyle->RGBColor[1,0,0] to color it red.

à Store the above plot as a p1, by either doing p1=%, or p1=Plot[......]

à Plot g(x) for the same values of x and y as you did for f (x) above. Make this plot blue (PlotStyle->RGBColor[0,0,1]) and store the result as p2.

à Use the command Show[p1,p2] to display both functions on the same graph. Label your axes, look up how if you need to.

à Define h(x) = tan(x).

à Make a plot of h(x), for −π ≤ x ≤ π. Remember that in Mathematica π is Pi.

à Now plot h(x) as above, but use the option PlotRange->All. Does this plot look good? If not, fix it in a way similar to the examples with f (x) above.

à Define k(x) as the derivative of h(x). To do this, do something like k[x_]=D[...].

à Make a nice looking plot of k(x).

P Pick your favorite equation, or if you don’t have one, use y = (^) x (^2) −^125. Graph your chosen equation and its first two derivatives on the same set of axes. Each should have its own color.