Here is the Mathematica demo we wrote on Thursday, Feb 4, 1999, with a few more items thrown in to help clarify. It is not intended as anything but a quick intro to some of the capabilities of Mathematica, and should not be confused with a tutorial in any sense whatsoever.

Mathematica can do definite integrals:

[Graphics:Images/index_gr_1.gif]
[Graphics:Images/index_gr_2.gif]

Hit ctrl-L to copy previous input, to save typing. Then wrap the N function around it. The N is the function for Numerically evaluating exact expressions.

[Graphics:Images/index_gr_3.gif]
[Graphics:Images/index_gr_4.gif]

Here is an integral that can't be evaluated with elementary functions, but we ask anyway.

[Graphics:Images/index_gr_5.gif]
[Graphics:Images/index_gr_6.gif]

The function Erfi is essentially the integral we are trying to evaluate, but with a multiple of [Graphics:Images/index_gr_7.gif] . Don't worry about that. But we can still apply N:

[Graphics:Images/index_gr_8.gif]
[Graphics:Images/index_gr_9.gif]

Mathematica can do arbitrary precision:

[Graphics:Images/index_gr_10.gif]
[Graphics:Images/index_gr_11.gif]
[Graphics:Images/index_gr_12.gif]
[Graphics:Images/index_gr_13.gif]
[Graphics:Images/index_gr_14.gif]
[Graphics:Images/index_gr_15.gif]
[Graphics:Images/index_gr_16.gif]
[Graphics:Images/index_gr_17.gif]

Matt can do indefinite integrals, too.

[Graphics:Images/index_gr_18.gif]
[Graphics:Images/index_gr_19.gif]

Here is the above evaluated at x=3:

[Graphics:Images/index_gr_20.gif]
[Graphics:Images/index_gr_21.gif]

If you want to use the function repeatedly, then define a function with a name. I'll be creative and use f:

[Graphics:Images/index_gr_22.gif]
[Graphics:Images/index_gr_23.gif]
[Graphics:Images/index_gr_24.gif]
[Graphics:Images/index_gr_25.gif]
[Graphics:Images/index_gr_26.gif]
[Graphics:Images/index_gr_27.gif]

Matt knows lots of algebra ...

[Graphics:Images/index_gr_28.gif]
[Graphics:Images/index_gr_29.gif]
[Graphics:Images/index_gr_30.gif]
[Graphics:Images/index_gr_31.gif]
[Graphics:Images/index_gr_32.gif]
[Graphics:Images/index_gr_33.gif]

... and can take derivatives in several ways.

[Graphics:Images/index_gr_34.gif]
[Graphics:Images/index_gr_35.gif]
[Graphics:Images/index_gr_36.gif]
[Graphics:Images/index_gr_37.gif]

Matt knows symbolic differentiation, including the chain rule.

[Graphics:Images/index_gr_38.gif]
[Graphics:Images/index_gr_39.gif]
[Graphics:Images/index_gr_40.gif]
[Graphics:Images/index_gr_41.gif]
[Graphics:Images/index_gr_42.gif]
[Graphics:Images/index_gr_43.gif]

Here's f[x] again.

[Graphics:Images/index_gr_44.gif]
[Graphics:Images/index_gr_45.gif]

Matt knows graphing. It tries to pick a nice scale and vertical plot range.

[Graphics:Images/index_gr_46.gif]

[Graphics:Images/index_gr_47.gif]

But you can specify those things.

[Graphics:Images/index_gr_48.gif]

[Graphics:Images/index_gr_49.gif]

Matt can handle many functions at once. Here are two. I have also added a square to be drawn first, which shows the "distortion" of the graph. It is just a change of scale to make the picture fit nicely on the screen.

[Graphics:Images/index_gr_50.gif]

[Graphics:Images/index_gr_51.gif]

Matt likes an aspect ratio of about .618, but we can insist on others. Here is the above graph with a 1:2 aspect ratio. (That number applies to the entire rectangular region containing the plot.)

[Graphics:Images/index_gr_52.gif]

[Graphics:Images/index_gr_53.gif]

Or, we can make it be a "true" aspect, so squares really look like squares.

[Graphics:Images/index_gr_54.gif]

[Graphics:Images/index_gr_55.gif]

We can also color the graphs individually. (Say, why are these graphs so close to each other on the interval [-2,2] ?)

[Graphics:Images/index_gr_56.gif]

[Graphics:Images/index_gr_57.gif]

[Graphics:Images/index_gr_58.gif]

[Graphics:Images/index_gr_59.gif]

There are some routines available for rotating curves about axes. In fact, there are many auxilliary packages that can be loaded. Here's one of them that might be useful to you.

<<Graphics`SurfaceOfRevolution`
SurfaceOfRevolution[ v^2,
  {v, 0, 3 Pi/2}, BoxRatios -> {1, 1, 2}]

[Graphics:Images/index_gr_60.gif]

[Graphics:Images/index_gr_61.gif]

The surface is approximated by polygons. If you are interested, here is a bit of the internal structure of the above rendering.

[Graphics:Images/index_gr_62.gif]
[Graphics:Images/index_gr_63.gif]
[Graphics:Images/index_gr_64.gif]

That tells me there are 361 polygons comprising the surface. Here is a Shortened view of them.

[Graphics:Images/index_gr_65.gif]
[Graphics:Images/index_gr_66.gif]

If you are clever, you can use the list of polygons to approximate the surface area. I'll leave that to you as an optional project you can do for the class.

Well, just keep in mind you can do lots of other stuff --- pretty much anything you've done in an algebra or calculus. Let's rationalize a denominator.

[Graphics:Images/index_gr_67.gif]
[Graphics:Images/index_gr_68.gif]

Stupid machine. Oh, that's right, there is a more complicated algorithm used for some of these things.

[Graphics:Images/index_gr_69.gif]
[Graphics:Images/index_gr_70.gif]

That's better.

What's that? You want it to calculate a cenrtroid? I guess I did sort of promise that. Okay, we have about 20 minutes left...

Let me fix a function and some bounds.

[Graphics:Images/index_gr_71.gif]

Here's a plot of the function, with the region marked.

[Graphics:Images/index_gr_72.gif]

[Graphics:Images/index_gr_73.gif]

Here I'll use the formulas we developed in class. (If you want it to work for the region between two curves, you'll just have to write a Matt routine yourself!)

[Graphics:Images/index_gr_74.gif]
[Graphics:Images/index_gr_75.gif]
[Graphics:Images/index_gr_76.gif]
[Graphics:Images/index_gr_77.gif]
[Graphics:Images/index_gr_78.gif]
[Graphics:Images/index_gr_79.gif]
[Graphics:Images/index_gr_80.gif]
[Graphics:Images/index_gr_81.gif]
[Graphics:Images/index_gr_82.gif]
[Graphics:Images/index_gr_83.gif]

Now I'll add the point to the earlier stuff, making a function showcentroid out of the whole thing.

[Graphics:Images/index_gr_84.gif]
[Graphics:Images/index_gr_85.gif]

[Graphics:Images/index_gr_86.gif]

Let's check Michelle's work. She found the centroid of half the astroid given by [Graphics:Images/index_gr_87.gif].  Solve for y and give it a name:

[Graphics:Images/index_gr_88.gif]
[Graphics:Images/index_gr_89.gif]
[Graphics:Images/index_gr_90.gif]
[Graphics:Images/index_gr_91.gif]
[Graphics:Images/index_gr_92.gif]
[Graphics:Images/index_gr_93.gif]

She got it! And her cut-out was very nice, too.

[Graphics:Images/index_gr_94.gif]

[Graphics:Images/index_gr_95.gif]

Beautiful!


Converted by Mathematica      June 12, 1999