Tag Archives: integral

Improved clouds

The interactive examples in this post require installing Wolfram CDF player, which is free and works on most desktop computers using Firefox, Safari and Internet Explorer, but not Chrome.

The source code for these demos is Animated Riemann.nb at my Mathematica Site. The notebook is is available for free use under a Creative Commons Attribution-ShareAlike 2.5 License. The notebook can be read by CDF Player if you cannot make the embedded versions in this post work.

The animated clouds show two hundred precalculated clouds for each picture, so you get the same clouds each time you run the animation.  It would have taken too long to generate the random clouds on the fly.  Each list of two hundred took about seven minutes to create on my computer.

In my post Riemann Clouds Improved I showed examples of clouds of values of Riemann sums in such a way that you could see the convergence to the value, the efficiency of the midpoint rule, and other things.  Here I include two Riemann sums that are shown

  • as manipulable graphs,
  • in clouds in an animated form.

Each manipulable graph (see Elaborate Riemann Sums Demo) has a slider to choose the mesh (1/n) of the partitions.  The small plus sign besides the slider gives you additional options. The buttons allow you to choose the type of partition and the type of evaluation points.

Each cloud shows a collection of values of random Riemann sums of the function, plotted by size of mesh (an upper bound on the width of the largest subdivision) and the value of the sum.  The cloud shows how the sums converge to the value of the integral. 

Every dot represents a random partition.  The sums with blue dots have random valuation points, the green dots use the left side of the subdivision, the brown dots the right side, and the red dots the midpoint.  The clouds may be suitable for students to study.  Some possible questions they could be asked to do are listed at the end.

Pressing the starter shows many clouds in rapid succession.  I don't know how much educational value that has but I think it is fun, and fun is worthwhile in itself.

Quarter Circle

Manipulable graph:

Animated cloud

 

Sine wave

Manipulable graph:

Animated cloud

Questions

I am not sure of the answers to some of these myself.

  • Why is the accuracy generally better for the sine wave than for the quarter circle?  
  • Why are the green dots above all the others and the brown dots below all the others in the quarter circle?
  • Why are they mixed in with the others for the sine curve?  In fact why do they tend upward? (Going from right to left, in other words in the direction of more accuracy).
  • Why are the midpoint sums so much more accurate?
  • Why do they tend downward for the sine wave?
  • Is it an optical illusion or do they also tend downward for the quarter circle? 

Notes:

Send to Kindle

Riemann clouds improved

In my post Playing with Riemann Sums I showed a couple of clouds of points, each representing a particular Riemann sum for a particular function.   I have extended the code in a couple of ways.

The new code is in the Mathematica notebook and CDF file called MoreRiemann in the Mathematica section of abstractmath.   The .nb form is a Mathematica Notebook, which requires Mathematica to run and allows you to manipulate the objects and change the code in the notebook as you wish.  In particular, you can rerun the commands generating the clouds to get a new random result.  The .cdf file contains the same material and can be viewed using Mathematica CDF Player, which is available free here.  Both files have several other examples besides the ones shown below.

As always, my code is one-time code to show the ideas, but it is available freely via the Creative Commons Attribution – ShareAlike 3.0 License. I hope people will feel free to develop it further for use in teaching or for their own purposes.

Below is a cloud for \int_0^2 \sqrt{4-x^2} dx, the area of a quarter circle of radius 2, which is \pi.  The blue dots are arbitrary random Riemann sums with mesh shown on the horizontal axis and value on the vertical axis.  The partitions and the point in each subinterval are both random.  The red dots are arbitrary Riemann sums with random partitions but using the midpoint for value.

The next cloud shows random blue dots with the same meaning as above.  The red dots are Riemann sums with uniform subintervals evaluated at midpoints.  Possible discussion question for both of the clouds above:

  • Why do the red dots trend upward?

The following cloud is like the cloud above  with the addition of green dots representing uniform partitions evaluated at the left endpoint or right endpoint. (But the mesh scale is extended, giving different proportions to the picture.)

Of course the left endpoint gives the upper sums and the right endpoint gives the lower sums.

  • Explain the slight downward curvature of both green streaks.
  • Explain the big gap between the blue dots and the green dots.  (Requires some machinations with probability.)
  • Would there be blue dots a lot nearer the green dots if I ran the command asking for many more blue dots?

(These are idle questions I haven't thought about myself, but I'll bet they could be turned into good projects in analysis classes.)

Here is a cloud for \int_0^{\pi}\sin x dc with everything random for the blue dots and random partitions but midpoints for the red dots.

  • Why do these red dots trend upward?

The cloud below is for the same integral but uses uniform subintervals for the midpoint and adds green points for both the left endpoint and the right endpoint of uniform subinterval.

  • Why on earth do all the green dots trend downward???

This is a similar picture for \int_0^1 x^2 dx.  There are red dots but they are kind of drowned out.

And finally, here is \int_{\frac{1}{2}}^2 \frac{1}{x} dx:

Send to Kindle

Playing with Riemann Sums

I had a satori [Note 2].  I felt like the guy in the ads who sits in front of his new ultrafast computer with the wind blowing his hair back and bracing himself by holding onto the desk.  (My hair was dark then but I certainly was not wearing a tie.)

That convergence theorem was talking about something BIG.

I visualized a Cloud of Riemann Sums floating around and swerving closer to the Right Answer as their meshes decreased.

A Riemann Sum has a lot of parameters:

  • Its mesh.  This can be any positive real number.
  • Its choice of subintervals. Any positive integer!  There can be billions of subintervals.
  • And, ye gods, the individual choice of each evaluation point for each subinterval in each Riemann Sum

Those are three independent parameters, except for the constraint imposed by the mesh on each choice of subintervals.  [Note 3].

I tell my students that we have to zoom in and zoom out [Reference 2] from a problem.  When we zoom out a complicated structure is thought of as a point in a certain relationship with other structures-as-points.  Then to understand something we zoom in (selectively) to see the details that make it work.  What I remember from my satori is that I didn’t visualize them as points but rather as little blurs, sort of like the blurs in Mumford’s red book [Reference 3], which I think was the first non-constipated math text I had ever seen.

Riemann Sums in Mathematica

In the nineties, I was on a grant to create Mathematica programs for students, and one of the notebooks I created allowed you to easily exhibit Riemann sums with various parameters.  I also included code that would show a cloud.

Below is a cloud.  It is a plot of the values of 300 Riemann sums for \int_0^{\pi} \sin x \,dx.  They have randomly chosen meshes from 0 to \pi/2 and the subintervals and individual evaluation points for each subinterval are also chosen randomly.

The cloud below is a plot of the values of 300 Riemann sums for the area of the upper right quarter circle of radius 2 with center at origin.  Its meshes range from 0 to 1, and other properties are similar to the one above.  The vertical spread of the points is considerably bigger,  presumably because of the vertical tangent line at the right hand end of the integral.

When you click on the code for either of these you get a different cloud with the same parameters.

You can access the notebook containing the code for this via Abmath Gate.    Be sure to read the ReadMe file.

Notes

[1] This was 1961.  Of course the book didn’t say things such as “with any choice of points-to-evaluate-at”.  It said what it had to say in stilted academic prose which required reading it two or three times before understanding it.  Academic prose is much better these days.  See Reference [1].

I was quite good at reading complicated prose. My ACT scores were a tad higher in English or Language or whatever it is called that they were in Math.  With the Internet, math exposition should do much more with pictures, interactive things, and lots of examples (which don’t waste paper now).  But that is another diatribe…

[2] This is a snooty word for lightbulb flashing over your head.  Every once in awhile I give in to the temptation to use some obscure word to impress people as to the variety of things I know about.  Teachers, don’t do this to your students.  Other professors are fair game.

[3] The same choice of subinterval can correspond to many different meshes, if your definition of mesh requires only that each subinterval be narrower than the mesh, rather than requiring that the mesh be the size of the biggest subinterval.  (I had never thought about that until I wrote this.)

[4] The Mathematica Demonstrations website has several other notebooks that exhibit Riemann Sums.

References

[1]  The Revolution in Technical Exposition II, post on this blog.

[2]  Zooming and Chunking in abmath.

[3] D. Mumford, The Red Book of Varieties and Schemes (second expanded ed.), Springer Lecture Notes in Math 1358, Springer-Verlag, Berlin, 1999.   (I have not seen this edition.  What I remember is the Red Book as it was in the 1967 Algebraic Geometry Summer School at Bowdoin.  I hope the smudges survive in the new version.  As I remember the smudges were bigger for points that were more generic or something like that.  Those smudges caused me a kind of sartori, too.)

Send to Kindle