Category Archives: Mathematica

Case Study in Exposition: Secant

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 comes from several Mathematica notebooks lists in the References. The notebooks are 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.

Pictures, metaphors and etymology

Math texts and too many math teachers do not provide enough pictures and metaphors to help students understand a concept.  I suspect that the etymology of the technical terms might also be useful. This post is an experimental exposition of the math concept of “secant” that use pictures, metaphors and etymology to describe the concept.

The exposition is interlarded with comments about what I am doing and why.  An exposition directly aimed at students would be slimmer — but some explanations of why you are doing such and such in an exposition are not necessarily out of place every time!

Secant Line

The word “secant” is used in various related ways in math.  To start with, a secant line on a curve is the unique line determined by two distinct points on the curve, like this:


The word “secant” comes from the Latin word for “cut”, which came from the Indo-European root “sek”, meaning “cut”.  The IE root also came directly into English via various Germanic sound changes to give us “saw” and “sedge”.

The picture

Showing pictures of mathematical objects that the reader can fiddle with may make it much easier to understand a new concept.  The static picture you get above by keeping your mitts off the sliders requires imagining similar lines going through other pairs of points. When you wiggle the picture you see similar lines going through other pairs of points.  You also get a very strong understanding of how the secant line is a function of the two given points.  I don’t think that is obvious to someone without some experience with such things.

This belief contains the hidden claim that individuals vary a lot on how they can see the possibilities in a still picture that stands as an example of a lot of similar mathematical objects.  (Math books are full of such pictures.)  So people who have not had much practice learning about possible variation in abstract structures by looking at one motionless one will benefit from using movable parametrized pictures of various kinds.  This is the sort of claim that is amenable to field testing.

The metaphor

Most metaphors are based on a physical phenomenon.  The mathematical meanings of “secant” use the metaphor of cutting.  When the word “secant” was first introduced by a European writer (see its etymology) in the 16th century, the word really was a metaphor.   In those days essentially every European scholar read Latin. To them “secant” would transparently mean “cutting”.  This is not transparent to many of us these days, so the metaphor may be hidden.

If you examine the metaphor you realize that (like all metaphors) it involves making some remarkably subtle connections in your brain.

  • The straight line does not really cut the curve.  Indeed, the curve itself is both an abstract object that is not physical, so can’t be cut, and also the picture you see on the screen, which is physical, but what would it mean to cut it?  Cut the screen?  The line can’t do that.
  • You can make up a story that (for example) the use was suggested by the mental image of a mark made by a knife edge crossing the plane at points a and b that looks like it is severing the curve.
  • The metaphor is restricted further by saying that it is determined by two points on the curve.   This restriction turns the general idea of secant line into a (not necessarily faithful!) two-parameter family of straight lines.  You could define such a family by using one point on the curve and a slope, for example.  This particular way of doing it with two points on the curve leads directly to the concept of tangent line as limit.

Secant on circle

Another use of the word “secant” is the red line in this picture:


This is the secant line on the unit circle determined by the origin and one point on the circle, with one difference: The secant of the angle is the line segment between the origin and the point on the curve.  This means it corresponds to a number, and that number is what we mean by “secant” in trigonometry.

To the ancient Greeks, a (positive) number was the length of a line segment.

The Definition

The secant of an angle $\theta$ is usually defined as $\frac{1}{\cos\theta}$, which you can see by similar triangles is the length of the red line in the picture above.

In many parts of the world, trig students don’t learn the word “secant”. They simply use $\frac{1}{\cos\theta}$.

This illustrates important facts about definitions:

  • Different equivalent definitions all make the same theorems true.
  • Different equivalent definitions can give you a very different understanding of the concept.

The red-line-segment-in-picture definition gives you a majorly important visual understanding of the concept of “secant”.  You can tell a lot from its behavior right off (it goes to infinity near $\pi/2$, for example).

The definition $\sec\theta=\frac{1}{\cos\theta}$ gives you a way of computing $\sec\theta$.  It also reduces the definition of $ \sec\theta$ to a previously known concept.

It used to be common to give only the $ \frac{1}{\cos\theta}$ definition of secant, with no mention of the geometric idea behind it.  That is a crime.  Yes, I know many students don’t want to “understand” stuff, they only want to know how to do the problems.  Teachers need to talk them out of that attitude.  One way to do that in this case is to test them on the geometric definition.

Etymology

This idea was known to the Arabs, and brought into European view in the 16th century by Danish mathematician Thomas Fincke in “Geometria Rotundi” (1583), where the first known use of the word “secant” occurs.  I have not checked, but I suspect from the title of the book that the geometric definition was the one he used in the book.

It wold be interesting to know the original Arabic name for secant, and what physical metaphor it is based on.  A cursory search of the internet gave me the current name in Arabic for secant but nothing else.

Graph of the secant function

The familiar graph of the secant function can be seen as generated by the angle sweeping around the curve, as in the picture below. The two red line segments always have the same length.


References

Mathematica notebooks used in this post:

 

Send to Kindle

Some demos of families of functions

I have posted on abstractmath.org a CDF file of families of functions whose parameters you can control interactively. It is fascinating to play with them and see phenomena you (or at least I) did not anticipate.  Some of them have questions of the sorts you might ask students to discuss or work out.  Working out explanations for many of the phenomena demand some algebra skills, and sometimes more than that.

The Mathematica command that sets up one of the families looks like this:

Manipulate[
Plot[{Sin[a x], a Cos[a x]}, {x, -2 Pi, 2 Pi},
PlotRange -> {{-4, 4}, {-4, 4}}, PlotStyle -> {Blue, Red},
AspectRatio -> 1], {{a, 1}, -4, 4, Appearance -> “Labeled”}]

It would be straightforward to make a command something like

PlotFamily[functionlist, domain, plotrange]

with various options for colors, aspect ratio and so on that would do these graphs.  But I found it much to easy to simply cut and paste and put in the new inputs and parameters as needed.

This sort of Mathematica programming is not hard if you have an example to copy, but you do need to get over the initial hump of learning the basic syntax.   I know of no other language where it would be as easy as the example above to produce an interactive plot of a family of functions.

But many people simply hate to learn a new language.  If this sort of interactive example turns out to be worthwhile, someone could design an interface that would allow you to fill in the blanks and have the command constructed for you.  (I could say the same about some of other cdf files I have posted on this blog recently.) But that someone won’t be me.  I have too much fun coming up with new ideas for math  exposition to have to spend time working out all the details.  And all my little experiments are available to use under the Creative Commons License.

I would appreciate comments and suggestions.

 

Send to Kindle

Showing categorical diagrams in 3D

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 is the Mathematica Notebook algebra1.nb, which 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.

In Graph-Based Logic and Sketches, Atish Bagchi and I needed to construct a lot of cones based on fairly complicated diagrams. We generally show the base diagram and left the reader to imagine the cone. This post is an experiment in presenting such a diagram in 3D, with its cone and other constructions based on it.

To understand this post, you need a basic understanding of categories, functors and limit cones (see References).

The notebook and CDF files that generate this display may be downloaded from here:

These files may be used and modified as you wish according to the Creative Commons rule listed under “Permissions” (at the top of the window).

The sketch for categories: composition

A finite-limit sketch (FL sketch) is a category with finite limits given by specifying certain  nodes and arrows, commutative diagrams using these nodes and arrows, and limit cones based on diagrams using the given nodes and arrows.  A model of an FL sketch is a finite-limit-preserving functor from the FL sketch into some category \mathcal{C}.  Detailed descriptions of FL-sketches are  in References [1], [2] and [3] (below).

Categories themselves may be sketched by FL-sketches. Here I will present the part of the sketch that constructs (in a model) the object of composites of two arrows.  This is the specification for composite:

  1. The composite of two arrows f:A\to B and g:B'\to C is defined if and only if B=B'.
  2. The composite is denoted by gf.
  3. The domain of gf is A and the codomain is C.

We start with a diagram in the FL sketch for categories that gives the data corresponding to two arrows that may be composed.  This diagram involves nodes ob and ar, which in a model become the object of objects and the object of arrows of the category object in \mathcal{C}.  (Suppose \mathcal{C} is the category of sets; then the model is simply a small category.  The node ob goes to the set of objects of the small category and ar goes to the set of arrows.)  The arrows labeled dom and cod take (in a model) an arrow to its domain and codomain respectively. Here is the diagram:

You can move the diagram around in three dimensions to see it from different perspectives. (Of course it isn’t really in three dimensions. Your eyes-to-brain module reconstructs the illusion of three dimensions when you twirl the diagram around.)

Note that this is a diagram, not a directed graph (digraph). (In the paper, Atish and I, like most category theorists, say “graph” instead of “digraph”.) It has an underlying digraph (see Chapter 2 of Graph-Based Logic and Sketches), but the labeling of several different nodes of the underlying digraph by the name of the same node of the sketch is meaningful. 

Here, the key fact is that in the diagram there are two arrows, one labeled dom and the other cod, to the same node labeled ob, and two other arrows to two different nodes labeled ob. 

Now click c1.

This shows a cone over the diagram.  One of the nodes in the sketch must be cp (in other words given beforehand; that is, we are specifying not only that the blue stuff is a limit cone but that the limit is the node cp.)   In a model, this cone must become a limit cone.  It follows from the properties of limits that the elements of cp in the model in Sets are pairs of arrows with the property that one has a codomain that is the same as the domain of the other.  The label “cp” stands for “compatible pairs”.

Now click c2.

The green stuff is a diagram showing two arrows from the node labeled ar to the left and right nodes labeled ob in the original black diagram.  This is not a cone; it is just a diagram.  In a model, any arrow in the vertex must have domain the same as the domain of one of the arrows in the compatible pair, and codomain the same as the codomain of the other arrow of the pair.  Thus in the model, an arrow living in the set labeled with “ar” in green must satisfy requirement 3 in the specification for composition given above.

Note that the requirement that the green diagram be commutative in a model is vacuous, so it doesn’t matter whether we specify it specifically as a diagram in the sketch or not.

Now click c3.

The arrow labeled comp must be specified as an arrow in the sketch.  We want its value to be the composite of an element of cp in a model, in other words a compatible pair of arrows.  At this point that will not necessarily be true.  But all can be saved:

Now click c4.

We must specify that the diagram given by the thick arrows must be a diagram of the sketch.  The fact that it must become commutative in a model means exactly that the red arrow comp from cp to ar takes a compatible pair to an arrow that satisfies requirements 1–3 of the specification of composite shown above.

References

  1. Peter T. Johnstone, Sketches of an Elephant: A Topos Theory Compendium, Volume 2 (Oxford Logic Guides 44), by Oxford University Press, ISBN 978-0198524960.
  2. Michael Barr and Charles Wells, Category theory for computing science (1999).    (This is the easiest to start with but it doesn’t get very far.)
  3. Michael Barr and Charles Wells, Toposes, Triples and Theories (2005).  Reprints in Theory and Applications of Categories 1.

 
\mathcal{C}

Send to Kindle

Modification of “Picturing derivatives”

There have been problems with viewing the CDF file in my post “Picturing derivatives” (see the post “Problems with picturing derivatives” for details.) I have replaced the embedding code


WolframCDF source="http://www.abstractmath.org/Mathematica/New5thDegreePolynomial.cdf" CDFwidth="531" CDFheight="620" altimage="http://www.abstractmath.org/Mathematica/New5thDegreePolynomial.pdf"

with the Javascript code
var cdf = new cdfplugin();
cdf.embed('http://www.abstractmath.org/Mathematica/New5thDegreePolynomial.cdf', 531, 690);
cdf.setDefaultContent('http://www.abstractmath.org/Mathematica/New5thDegreePolynomial.pdf');

The first version uses the CDF Plugin for WordPress provided by Wolfram. The second is a javascript-enabled code suggested by Wolfram’s document on how to embed CDF files. About this code they said

For greater flexibility we recommend using the Wolfram CDF Embed Script, which is a free open source JavaScript library. It requires no other libraries and guarantees cross-browser compatibility, provides a way to check that the CDF plugin is installed, displays a CDF Player logo and link when the plugin is missing, and offers a means to display static images in place of the interactive content.

Well it certainly doesn’t guarantee browser compatibility.

The new version works on my copy of IE8 running on an XP computer and on Mozilla Firefox. The bottom is cut off on Chrome. (This behavior was reported for Firefox as well by someone else running IE8 on an XP computer.) This is exactly the behavior I had with the previous code.

I would like to hear from readers about problems with the new version. I will experiment with changing the CDF file.

Send to Kindle

Picturing derivatives

The CDF files in G&G posts no longer work. I have been unable to find out why.I expect to produce another document on abstractmath.org that will include this example and others. A link willl be posted here when it is done.

This is my first experiment at posting an active Mathematica CDF document on my blog. To manipulate the graph below, you must have Wolfram CDF Player installed on your computer. It is available free from their website.

This is a new presentation of old work. It is a graph of a certain fifth degree polynomial and its first four derivatives.

The buttons allow you to choose how many derivatives to show and the slider allows you to show the graphs from x=-4 up to a certain point.

How graphs like this could be used for teaching purposes

You could show this in class, but the best way to learn from it would be to make it part of a discussion in which each student had access to a private copy of the graph.  (But you may have other ideas about how to use a graph like this.  Share them!)

Some possible discussion questions:

  1. Click button 1. Now you see the function and the derivative. Move the slider all the way to the left and then slowly move it to the right.  When the function goes up the derivative is positive.  What other things do you notice when you do this?
  2. If you were told only that one of the functions is the derivative of the other, how would you rule out the wrong possibility?
  3. What can you tell about the zeroes of the function by looking at the derivative?
  4. Look at the interval between x=1.5 and x=1.75.  Does the function have one or two zeroes in that interval?  On my screen it looks as if the curve just barely  gets above the x axis in that interval.  What does that say about it having one or two zeroes?  How could you verify your answer?
  5. Click button 2.  Now you have the function and first and second derivatives.  What can you say about maxima, minima and concavity of the function?
  6. Find relationships between the first and second derivatives.
  7. Now click button 4.  Evidently the 4th derivative is a straight line with positive slope.  Assume that it is.  What does that tell you about the graph of the third derivative?
  8. What characteristics of the graph of the function can you tell from knowing that the fourth derivative is a straight line of positive slope?
  9. What can you say about the formula for the function knowing that the fourth derivative is a straight line of positive slope?
  10. Suppose you were given this graph and told that it was a graph of a function and its first four derivatives and nothing else.  Specifically, you do not know that the fourth derivative is a straight line.  Give a detailed explanation of how to tell which curve is the function and which curve is each specific derivative.

Making this manipulable graph

I posted this graph and a lot of others several years ago on abstractmath.org.  (It is the ninth graph down).  I fiddled with this polynomial until I got the function and all four derivatives to be separated from each other.  All the roots of the function and all its derivatives are real and all are shown.  Isn’t this gorgeous?

To get it to show up properly on the abmath site I had to thicken the graph line.  Otherwise it still showed up on the screen but when I printed it on my inkjet printer the curves disappeared. That seems to be unnecessary now.

Mathematica 8.0 has default colors for graphs, but I kept the old colors because they are easier to distinguish, for me anyway (and I am not color blind).

Inserting CDF documents into html

A Wolfram document explains how to do this.  I used the CDF plugin for WordPress.  WordPress requires that, to use the plugin, you operate your blog from your own server, not from WordPress.com.  That is the main reason for the recent change of site.

The Mathematica files are New5thDegreePolynomial.nb and New5thDegreePolynomial.cdf on my public folder of Mathematica files.  You may download the .cdf file directly and view it using CDF player if you have trouble with the embedded version. To see the code you need to download the .nb file and open all cells.

Here are some notes and questions on the process.  When I find learn more about any of these points I will post the information.

  1. At the moment I don’t know how to get rid of the extra space at the top of the graph.
  2. I was surprised that I could not click on the picture and shrink or expand it.
  3. It might be annoying for a student to read the questions above and have to go up and down the screen to see the graph.  I had envisioned that the teacher would ask the questions and have the students play with the graph and erupt with questions and opinions.  But you could open two copies of the .cdf file (or this blog) and keep one window showing the graph while the other window showed the questions.
  4. Which raises a question:  Could it be possible to program the graph with a button that when pushed would make the graph (only) appear in another window?

Other approaches

  1. I have experimented with Khan Academy type videos using CDF files.  I made a screen shot and at a certain point I pressed a button and the graph appropriately changed.   I expect to produce an example video which I can make appear on this blog (which supposedly can show videos, but I haven’t tried that yet.)
  2. It should be possible to have a CDF in which the student saw the graph with instructional text underneath it equipped with next and back buttons.  The next button would trigger changes in the picture and replace the text with another sentence or two.  This could be instead of spoken stuff or additional to it (which would be a lot of work).  Has anyone tried this?

Note

My reaction to Khan Academy was mostly positive.  One thing that struck me that no one seems to have commented on is that the lectures are short. They cover one aspect (one definition or one example or what one theorem says) in what felt to me like ten or fifteen minutes.  This means that you can watch it and easily go back and forth using the controls on the video display.  If it were a 50-minute lecture it would be much harder to find your way around.

I think most students are grasshoppers:  When reading text, they jump back and forth, getting the gist of some idea, looking ahead to see where it goes, looking back to read something again, and so on.  Short videos allow you to do this with spoken lectures. That seems to me remarkably useful.

Send to Kindle

Comparing graph and cograph (Version 2)

This post has been superseded by the post Demos for graph and cograph of calculus functions.

New Version 6 July 2011

This is a new version of a post originally created on 30 June, 2011. –Charles Wells

When you put the graph and cograph of a function with parameters side by side, interesting things may happen.  I have created the files CographExample.nb and CographExample.cdf to illustrate this.

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.  The .cdf file contains the same material and can be viewed using Mathematica CDF Player, which is available free here.  The CDF Player allows you to change the parameters with the slidebars, so that you can experience the phenomena discusses in the example, but you cannot otherwise modify the file.

You cannot include a Mathematica computable document directly into a Word Press document, so here are screenshots of the cograph example with several different settings of its parameters.

Some Screenshots and sample questions follow.  These not in the original version.  I added these thanks to encouragement by Sam Alexander.

Screenshots


Questions for discussion

My idea is that students will manipulate the slider to see what happens and do some algebra on the relations between a, b and x to explain the phenomena that occur.

Questions about the graph (left figure).

G1. Prove that the two straight lines are parallel for any choice of a and b.

G2. When do the red and blue straight lines in the graph coincide? Answer: The lines coincide when a=1 or b=0 .

  • “When do the…” translates into “for what values of a and b do the…”. I predict that which way you ask the question will make a big difference for some students. To answer this question, you are not solving for x but for a and b. If you ask “When…” they have to discover this for themselves.
  • The answer is disjunctive: This may be a new idea for some of the students.

G3. Find a formula in terms of a and b for the distance between the two straight lines in the graph. Answer: |b-ab|.

Questions about the cograph.

C1. When do the red and blue arrows in the cograph coincide? Answer: Same as answer to Question G1.

C2. In the cograph, for what aand b are the arrow targets for a given choice of x closer together than the arrow sources? Answer: $latex  |a|>1$. b is irrelevant.

C3. Manipulate a and b. For some values the blue arrows all cross each other at the same point. (Same question for red arrows.) When does this happen? Answer: When a is negative.

  • The abstract setting of the cograph is shifted by this question (and the next) as follows: The arrows originally provided a visual pointer from the input to the output of the function. All of a sudden we are treating them as mathematical objects(straight line segments in the plane).
  • The abstraction is also broken in another way: The space between the source line and the target line is just a visual separation, but after this question both lines lie on the xy plane. The question turns a visual illustration into a mathematical object.

C4.  Describe the common point where all the red arrows cross when a is negative. (Same question for blue arrows.) Answer: The point is \left(\frac{b}{1-a},\frac{3 a}{a-1}\right).

Send to Kindle

Computable algebraic expressions in tree form

Invisible algebra

  1. An  expression such as $4(x-2)=6$ has an invisible abstract structure.  In this simple case it is

using the style of presenting trees used in academic computing science.  The parentheses are a clue to the structure; omitting them results in  $4x-2=6$, which has the different structure

By the time students take calculus they supposedly have learned to perceive and work with this invisible structure, but many of them still struggle with it.  They have a lot of trouble with more complex expressions, but even something like $\sin x + y$ gives some of them trouble.

Make the invisible visible

The tree expression makes the invisible structure explicit. Some math educators such as Jason Dyer and Bret Victor have experimented with the idea of students working directly with a structured form of an algebraic expression, including making the structured form interactive.

How could the tree structure be used to help struggling algebra students?

1) If they are learning on the computer, the program could provide the tree structure at the push of a button. Lessons could be designed to present algebraic expressions that look similar but have different structure.

2) You could point out things such as:

a) “inside the parentheses pushes it lower in the tree”
b) “lower in the tree means it is calculated earlier”

3) More radically, you could teach algebra directly using the tree structure, with the intention of introducing the expression-as-a-string form later.  This is analogous to the use of the initial teaching alphabet for beginners at reading, and also the use of shape notes to teach sight reading of music for singing.  Both of these methods have been shown to help beginners, but the ITA didn’t catch on and although lots of people still sing from shape notes (See Note 1) they are not as far as I know used for teaching in school.

4) You could produce an interactive form of the structure tree that the student could use to find the value or solve the equation.  But that needs a section to itself.

Interactive trees

When I discovered the TreeForm command in Mathematica (which I used to make the trees above), I was inspired to use it and the Manipulate command to make the tree interactive.


This is a screenshot of what Mathematica shows you.  When this is running in Mathematica, moving the slide back and forth causes the dependent values in the tree also change, and when you slide to 3.5, the slot corresponding to $ 4(x-2)$ becomes 6 and the slot over “Equals” becomes “True”:

As seen in this post, these are just screen shots that you can’t manipulate.  The Mathematica notebook Expressions.nb gives the code for this and lets you experiment with it.  If you don’t have Mathematica available to you, you can still manipulate the tree with the slider if you download the CDF form of the notebook and open it in Mathematica CDF Player, which is available free here.  The abstractmath website has other notebooks you may want to look at as well.

Moving the slider back and forth constitutes finding the correct value of x by experiment.  This is a peculiar form of bottom-up evaluation.   With an expression whose root node is a value rather than an equation, wiggling the slider constitutes calculating various values with all the intermediate steps shown as you move it.  Bret Victor s blog shows a similar system, though not showing the tree.

Another way to use the tree is to arrange to show it with the calculated values blank.  (The constants and the labels showing the operation would remain.)   The student could start at the top blank space (over Times)  and put in the required value, which would obviously have to be 6 to make the space over Equals change to “True”.  Then the blank space over Plus would have to be 1.5 in order to make multiplying it by 4 be 6.  Then the bottom left blank space would have to be 3.5 to make it equal to 1.5 when -2 is added.  This is top down evaluation.

You could have the student enter these numbers in the blank spaces on the computer or print out the tree with blank spaces and have them do it with a pencil.  Jason Dyer’s blog has examples.

Implementation

My example code in the notebook is a kludge.  If you defined a  special VertexRenderingFunction for TreeForm in Mathematica, you could create a function that would turn any algebraic expression into a manipulatable tree with a slider like the one above (or one with blank spaces to be filled in).  [Note 2]. I expect I will work on that some time soon but my main desire in this series of blog posts is to through out ideas with some Mathematica code attached that others might want to develop further. You are free to reuse all the Mathematica code and all my blog posts under the Creative Commons Attribution – ShareAlike 3.0 License.  I would like to encourage this kind of open-source behavior.

Notes

1. Including me every Tuesday at 5:30 pm in Minneapolis (commercial).

2. There is a problem with Equals.  In the hacked example above I set the increment the value jumps by when the slider is moved to 0.1, so that the correct value 3.5 occurs when you slide.  If you had an equation with an irrational root this would not work.  One thing that should work is to introduce a fuzzy form of Equals with the slide-increment smaller that the latitude allowed in the fuzzy Equals.

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

Endograph and cograph of real functions

This post is covered by the Creative Commons Attribution – ShareAlike 3.0 License, which means you may use, adapt and distribute the work provided you follow the requirements of the license.

Introduction

In the article Functions: Images and Metaphors in abstractmath I list a bunch of different images or metaphors for thinking about functions. Some of these metaphors have realizations in pictures, such as a graph or a surface shown by level curves. Others have typographical representations, as formulas, algorithms or flowcharts (which are also pictorial). There are kinetic metaphors — the graph of {y=x^2} swoops up to the right.

Many of these same metaphors have realizations in actual mathematical representations.

Two images (mentioned only briefly in the abstractmath article) are the cograph and the endograph of a real function of one variable. Both of these are visualizations that correspond to mathematical representations. These representations have been used occasionally in texts, but are not used as much as the usual graph of a continuous function. I think they would be useful in teaching and perhaps even sometimes in research.

A rough and unfinished Mathematica notebook is available that contains code that generate graphs and cographs of real-valued functions. I used it to generate most of the examples in this post, and it contains many other examples. (Note [1].)

The endograph of a function

In principle, the endograph (Note [2]) of a function {f} has a dot for each element of the domain and of the codomain, and an arrow from {x} to {f(x)} for each {x} in the domain. For example, this is the endograph of the function {n\mapsto n^2+1 \pmod 11} from the set {\{0,1,\ldots,10\}} to itself:


“In principle” means that the entire endograph can be shown only for small finite functions. This is analogous to the way calculus books refer to a graph as “the graph of the squaring function” when in fact the infinite tails are cut off.

Real endographs

I expect to discuss finite endographs in another post. Here I will concentrate on endographs of continuous functions with domain and codomain that are connected subsets of the real numbers. I believe that they could be used to good effect in teaching math at the college level.

Here is the endograph of the function {y=x^2} on the reals:

I have displayed this endograph with the real line drawn in the usual way, with tick marks showing the location of the points on the part shown.

The distance function on the reals gives us a way of interpreting the spacing and location of the arrowheads. This means that information can be gleaned from the graph even though only a finite number of arrows are shown. For example you see immediately that the function has only nonnegative values and that its increase grows with {x}.(See note [3]).

I think it would be useful to show students endographs such as this and ask them specific questions about why the arrows do what they do.

For the one shown, you could ask these questions, probably for class discussion rather that on homework.

  • Explain why most of the arrows go to the right. (They go left only between 0 and 1 — and this graph has such a coarse point selection that it shows only two arrows doing that!)
  • Why do the arrows cross over each other? (Tricky question — they wouldn’t cross over if you drew the arrows with negative input below the line instead of above.)
  • What does it say about the function that every arrowhead except two has two curves going into it?

Real Cographs

The cograph (Note [4] of a real function has an arrow from input to output just as the endograph does, but the graph represents the domain and codomain as their disjoint union. In this post the domain is a horizontal representation of the real line and the codomain is another such representation below the domain. You may also represent them in other configurations (Note [5]).

Here is the cograph representation of the function {y=x^2}. Compare it with the endograph representation above.

Besides the question of most arrows going to the right, you could also ask what is the envelope curve on the left.

More examples

Absolute value function

Arctangent function

Notes

[1] This website contains other notebooks you might find useful. They are in Mathematica .nb, .nbp, or .cdf formats, and can be read, evaluated and modified if you have Mathematica 8.0. They can also be made to appear in your browser with Wolfram CDF Player, downloadable free from Wolfram site. The CDF player allows you to operate any interactive demos contained in the file, but you can’t evaluate or modify the file without Mathematica.

The notebooks are mostly raw code with few comments. They are covered by the Creative Commons Attribution – ShareAlike 3.0 License, which means you may use, adapt and distribute the code following the requirements of the license. I am making the files available because I doubt that I will refine them into respectable CDF files any time soon.

[2] I call them “endographs” to avoid confusion with the usual graphs of functions — — drawings of (some of) the set of ordered pairs {x,f(x)} of the function.

[3] This is in contrast to a function defined on a discrete set, where the elements of the domain and codomain can be arranged in any old way. Then the significance of the resulting arrangement of the arrows lies entirely in which two dots they connect. Even then, some things can be seen immediately: Whether the function is a cycle, permutation, an involution, idempotent, and so on.

Of course, the placement of the arrows may tell you more if the finite sets are ordered in a natural way, as for example a function on the integers modulo some integer.

[4] The text [1] uses the cograph representation extensively. The word “cograph” is being used with its standard meaning in category theory. It is used by graph theorists with an entirely different meaning.

[5] It would also be possible to show the domain codomain in the usual {x-y} plane arrangement, with the domain the {x} axis and the codomain the {y} axis. I have not written the code for this yet.

References

[1] Sets for Mathematics, by F. William Lawvere and Robert Rosebrugh. Cambridge University Press, 2003.

[2] Martin Flashman’s website contains many exampls of cographs of functions, which he calls mapping diagrams.

Send to Kindle