Showing posts with label calculus. Show all posts
Showing posts with label calculus. Show all posts
24 February 2011
How do graphing calculators do numeical integration?
Here's a question I don't know the answer to, which Sam Shah asked: how does the TI-83 do ∫-zz exp(-x2) dx, or more generally numerical integration? Of course as z goes to ∞ this approaches √π, with very small tails. (The link goes to an old post of mine that unfortunately has broken LaTeX; you can read the alt text for the images. The idea is that in∫z∞ exp(-x2) dx, the integrand can be bounded above by the exponential exp(-z2-2xz); integrating this, the original integral is less than exp(-z2)/2z and this is pretty tight. And yes, I know, I should switch to a platform with LaTeX support.)
So you expect to get something near √π for any reasonably large value of z. But if z is large enough -- say 1000 -- then you get a very small value, in this case on the order of 10-7. Presumably if the range of integration is wide enough, then the integration method used by the calculator doesn't actually pick up the central region where the action is actually happening.
So you expect to get something near √π for any reasonably large value of z. But if z is large enough -- say 1000 -- then you get a very small value, in this case on the order of 10-7. Presumably if the range of integration is wide enough, then the integration method used by the calculator doesn't actually pick up the central region where the action is actually happening.
13 February 2011
Which comes first, the nominal or real record high?
A quick puzzle: say that gas prices hit a record high in nominal dollars. And say they also, around the same time, hit a record high in real (inflation-adjusted) dollars. Which comes first?
Say the nominal price is f(t) and the real price is h(t) = f(t)g(t), where g is monotone decreasing. Then h'(t) = f'(t) g(t) + f(t) g'(t). So if the nominal price is at a maximum at time T, then f'(T) = 0 and so h'(T) = f(T) g'(T). f(T) is positive because it's a price and g'(T) is negative by assumption. So h'(T) is negative and at the time of the nominal high, the real price is already decreasing. The real high comes first, and there's a short period in which the real price is decreasing but the nominal price is still increasing. This makes sense - a nominally constant price is decreasing in real dollars.
This is brought to you by an example from Geoff Nunberg's book Talking Right, on how the Right has distorted political language in the United States in an effort to marginalize the Left. At the particular point I'm commenting on, argues that the right likes to proclaim "record highs" in gas prices which are basically always in nominal dollars and therefore make the gas price rise look worse than it is. My argument, however, says nothing about that - taking derivatives makes this a local problem, and "record highs" (nominal or real) are global maxima.
Say the nominal price is f(t) and the real price is h(t) = f(t)g(t), where g is monotone decreasing. Then h'(t) = f'(t) g(t) + f(t) g'(t). So if the nominal price is at a maximum at time T, then f'(T) = 0 and so h'(T) = f(T) g'(T). f(T) is positive because it's a price and g'(T) is negative by assumption. So h'(T) is negative and at the time of the nominal high, the real price is already decreasing. The real high comes first, and there's a short period in which the real price is decreasing but the nominal price is still increasing. This makes sense - a nominally constant price is decreasing in real dollars.
This is brought to you by an example from Geoff Nunberg's book Talking Right, on how the Right has distorted political language in the United States in an effort to marginalize the Left. At the particular point I'm commenting on, argues that the right likes to proclaim "record highs" in gas prices which are basically always in nominal dollars and therefore make the gas price rise look worse than it is. My argument, however, says nothing about that - taking derivatives makes this a local problem, and "record highs" (nominal or real) are global maxima.
08 May 2009
The third derivative of the employment rate is positive
The third derivative of the number of people employed in the United States is positive. (From 538.)
Nate Silver puts it as "the second derivative has improved", but let's face it, this is really a statement about the third derivative. Compare Nixon's 1972 statement that the rate of increase of inflation was decreasing, which Hugo Rossi pointed out in the Notices was a statement about the third derivative. (I seem to recall John Allen Paulos pointing this out in one of his books, but I don't recall which book and therefore can't date it relative to Rossi's letter in the Notices.)
Nate Silver puts it as "the second derivative has improved", but let's face it, this is really a statement about the third derivative. Compare Nixon's 1972 statement that the rate of increase of inflation was decreasing, which Hugo Rossi pointed out in the Notices was a statement about the third derivative. (I seem to recall John Allen Paulos pointing this out in one of his books, but I don't recall which book and therefore can't date it relative to Rossi's letter in the Notices.)
23 April 2009
Calculus made awesome
Calculus Made Awesome, by Silvanus P. Thompson, is available online. (Okay, so it's actually called Calculus Made Easy, but I like my alternate title better.)
Furthermore, unlike the modern calculus texts, it is nowhere near large enough to use as a weapon, even if you buy the print version, a 1998 edition fixed up by Martin Gardner Next time I teach calculus I must make sure to tell my students this book exists. And it's in the public-domain and free online, so it's not like I'd be recommending another expensive book. How much has calculus really changed in a century, anyway?
Thanks to Sam Shahfor reminding me of it. See also Ivars Peterson's review of the 1998 reissue. John Baez likes it but doesn't like that the new edition is longer than the old one.
Furthermore, unlike the modern calculus texts, it is nowhere near large enough to use as a weapon, even if you buy the print version, a 1998 edition fixed up by Martin Gardner Next time I teach calculus I must make sure to tell my students this book exists. And it's in the public-domain and free online, so it's not like I'd be recommending another expensive book. How much has calculus really changed in a century, anyway?
Thanks to Sam Shahfor reminding me of it. See also Ivars Peterson's review of the 1998 reissue. John Baez likes it but doesn't like that the new edition is longer than the old one.
06 April 2009
James Stewart's house
James Stewart, author of calculus texts, has a 24ドル million house. It has lots of curved walls. Problem: find their areas or volumes, by integrating.
Simmons Hall, an MIT dorm opened in 2002, has a lot of oddly shaped rooms. (I found this silly, because the curved walls meant wasted space -- but I didn't live there, I just had friends who did, so it didn't bother me too much.) The story goes that the Cambridge fire department had trouble giving them a certificate of occupancy because they couldn't determine the volume of certain rooms and therefore couldn't determine whether they were adequately ventilated.
(Article from the Wall Street Journal; link from Casting Out Nines.)
Simmons Hall, an MIT dorm opened in 2002, has a lot of oddly shaped rooms. (I found this silly, because the curved walls meant wasted space -- but I didn't live there, I just had friends who did, so it didn't bother me too much.) The story goes that the Cambridge fire department had trouble giving them a certificate of occupancy because they couldn't determine the volume of certain rooms and therefore couldn't determine whether they were adequately ventilated.
(Article from the Wall Street Journal; link from Casting Out Nines.)
07 February 2009
Beijing celebrates the mean value theorem
Beijing celebrates the mean value theorem.
Philadelphia, I suppose, celebrates counting, with its numbered streets. (And perhaps Descartes and his coordinate plane, since the streets form a grid?)
Philadelphia, I suppose, celebrates counting, with its numbered streets. (And perhaps Descartes and his coordinate plane, since the streets form a grid?)
20 October 2008
Derivation is not destiny
Arnold Zwicky at Language Log points out that the "derivative" of "financial derivatives", a word we've been hearing lots in the news lately, is not derived from the "derivative" of calculus. (This is commenting on a misunderstanding in a recently published letter to the New York Times.)
It never made sense to me that while the verb for "find the integral" is "integrate", the verb for "find the derivative" is "differentiate" -- in one case the forms are parallel and in the other they aren't. Of course the derivative involves finding a difference, but the language seems a bit inconsistent. And I've had the occasional student refer to "derivating" a function.
It probably doesn't help that they both start with d, and that every d-like symbol (off the top of my head, at least d, D, δ, Δ, and ∂) gets used for some sort of derivative/difference-like thing in some context.)
It never made sense to me that while the verb for "find the integral" is "integrate", the verb for "find the derivative" is "differentiate" -- in one case the forms are parallel and in the other they aren't. Of course the derivative involves finding a difference, but the language seems a bit inconsistent. And I've had the occasional student refer to "derivating" a function.
It probably doesn't help that they both start with d, and that every d-like symbol (off the top of my head, at least d, D, δ, Δ, and ∂) gets used for some sort of derivative/difference-like thing in some context.)
06 August 2008
Worms doing calculus?
Worms do calculus to find food. (Um, not really.)
But apparently worms use salt concentration to find food, and tend to head in the direction of the gradient of salt concentration. That is, they go where there's more salt. This is due to neuroscientist Shawn Lockery and his students at the University of Oregon. I think the paper is the following:
Suzuki H, Thiele TR, Faumont S, Ezcurra M, Lockery SR, Schafer WR (2008). "Circuit motifs for spatial orientation behaviors identified by neural network optimization." Nature 454:114-117.
but I can't be 100 percent sure -- Penn's libraries don't allow access to the electronic version of papers from Nature until twelve months have passed, and I'm not on campus right now. (This is, however, the only paper on Lockery's list with a title fitting the description.)
Saying "worms do calculus to find food" seems a bit disingenuous to me, though. It seems like saying that baseball players do calculus to catch fly balls. The larger point, though, is that neural processes -- of worms or of humans -- can be modeled using mathematical techniques, which may be of use to people trying to develop artificial systems that do these things.
(From John Scalzi, via 360. Apparently this first appeared in blogs a couple weeks ago, but I'm posting it here anyway, because it's new to me, which means it's probably also new to a lot of you.)
But apparently worms use salt concentration to find food, and tend to head in the direction of the gradient of salt concentration. That is, they go where there's more salt. This is due to neuroscientist Shawn Lockery and his students at the University of Oregon. I think the paper is the following:
Suzuki H, Thiele TR, Faumont S, Ezcurra M, Lockery SR, Schafer WR (2008). "Circuit motifs for spatial orientation behaviors identified by neural network optimization." Nature 454:114-117.
but I can't be 100 percent sure -- Penn's libraries don't allow access to the electronic version of papers from Nature until twelve months have passed, and I'm not on campus right now. (This is, however, the only paper on Lockery's list with a title fitting the description.)
Saying "worms do calculus to find food" seems a bit disingenuous to me, though. It seems like saying that baseball players do calculus to catch fly balls. The larger point, though, is that neural processes -- of worms or of humans -- can be modeled using mathematical techniques, which may be of use to people trying to develop artificial systems that do these things.
(From John Scalzi, via 360. Apparently this first appeared in blogs a couple weeks ago, but I'm posting it here anyway, because it's new to me, which means it's probably also new to a lot of you.)
24 July 2008
Solids of revolution?
For some reason, in calculus classes here in the U.S. we spend a lot of time teaching students how to find the volume of solids of revolution. This is invariably confusing, because often students try to memorize the various "methods" (disk, washer, cylindrical shell) and have trouble getting a handle on the actual geometry. When I've taught this, I've encouraged my students to draw lots of pictures. This is more than I can say for some textbooks, which try to give "rules" of the form "if a curve is entirely above the x-axis, and it's being rotated around the x-axis, between y = a and y = b, then here's the formula" -- I don't recall explicitly knowing that students have tried to memorize such a formula and failed, but I wouldn't be surprised if a lot of the wrong answers I've gotten from students on questions like this are based on such things.
Now, as a probabilist, I do have some use for calculus in my work. But I can't remember the last time I needed to know the volume of a solid of revolution.
Then again, my work is not particularly geometrical in nature.
So, I ask -- why do we spend so much time on this? Is this something that students actually need to know? I'm inclined to guess that it's just tradition. But at the same time I can't rule out that solids of revolution are actually so prevalent in engineering and physics (the traditional "customers" for the calculus course). Also, a lot of the "standard" calculus course seems to be a sequence of contrived problems that exist basically to make the student do various derivatives and integrals.
Now, as a probabilist, I do have some use for calculus in my work. But I can't remember the last time I needed to know the volume of a solid of revolution.
Then again, my work is not particularly geometrical in nature.
So, I ask -- why do we spend so much time on this? Is this something that students actually need to know? I'm inclined to guess that it's just tradition. But at the same time I can't rule out that solids of revolution are actually so prevalent in engineering and physics (the traditional "customers" for the calculus course). Also, a lot of the "standard" calculus course seems to be a sequence of contrived problems that exist basically to make the student do various derivatives and integrals.
18 July 2008
Lower speed limits, part two
One thing people complain about in regards to slower speed limits, which I wrote about earlier today, is that when speed limits are lower it takes longer to get places. This is, of course, true. But on the other hand you use less fuel.
From Wikipedia on fuel economy in automobiles: "The power to overcome air resistance increases roughly with the cube of the speed, and thus the energy required per unit distance is roughly proportional to the square of speed." Furthermore, this is the dominant factor for large velocity.
So let's say your fuel usage, measured in fuel used per unit of distance (say, gallons per mile), at velocity v, is kv2. (k is some constant that depends on the car. A typical value of k, for a car using 0.05 gallons per mile at 60 mph, is 0.000014.) Let's say you value your time at a rate c -- measured in, say, dollars per hour, and the price of fuel is p.
Then for a journey of length d, you'll spend dpkv2 in fuel, and cd/v in time. Your total cost is and differentiating and setting f'(v) = 0, the optimal speed is (c/2pk)1/3. The cost of the journey at this speed is
So according to this model, if you value your time more you should go faster; not surprisingly your value of time c and the price of fuel p show up only as c/p -- effectively, your value of time measured in terms of fuel.
Also, the optimal speed doesn't go down that slowly as p increases -- it only goes as p-1/3. But a doubling in gas prices still leads to a 20 percent reduction in optimal speed -- perhaps roughly in line with what people are suggesting. Taking c = 10, p = 4.05, k = 0.000014 gives an optimal speed of 45 miles per hour, although given the crudeness of this model (I've assumed that all the fuel is used to fight air resistance) I'd take that with a grain of salt, and I won't even touch the fact that different people place different values on their time and get different fuel economy. We can't just let everyone drive at their optimal speed.
Besides, part of the whole point of this is that if we use less fuel, demand for fuel will drop significantly below supply and oil prices will go down. So to forecast the effects of a lower speed limit I'd have to factor in that gasoline could get cheaper -- and let's face it, I can't predict the workings of the oil market.
From Wikipedia on fuel economy in automobiles: "The power to overcome air resistance increases roughly with the cube of the speed, and thus the energy required per unit distance is roughly proportional to the square of speed." Furthermore, this is the dominant factor for large velocity.
So let's say your fuel usage, measured in fuel used per unit of distance (say, gallons per mile), at velocity v, is kv2. (k is some constant that depends on the car. A typical value of k, for a car using 0.05 gallons per mile at 60 mph, is 0.000014.) Let's say you value your time at a rate c -- measured in, say, dollars per hour, and the price of fuel is p.
Then for a journey of length d, you'll spend dpkv2 in fuel, and cd/v in time. Your total cost is and differentiating and setting f'(v) = 0, the optimal speed is (c/2pk)1/3. The cost of the journey at this speed is
So according to this model, if you value your time more you should go faster; not surprisingly your value of time c and the price of fuel p show up only as c/p -- effectively, your value of time measured in terms of fuel.
Also, the optimal speed doesn't go down that slowly as p increases -- it only goes as p-1/3. But a doubling in gas prices still leads to a 20 percent reduction in optimal speed -- perhaps roughly in line with what people are suggesting. Taking c = 10, p = 4.05, k = 0.000014 gives an optimal speed of 45 miles per hour, although given the crudeness of this model (I've assumed that all the fuel is used to fight air resistance) I'd take that with a grain of salt, and I won't even touch the fact that different people place different values on their time and get different fuel economy. We can't just let everyone drive at their optimal speed.
Besides, part of the whole point of this is that if we use less fuel, demand for fuel will drop significantly below supply and oil prices will go down. So to forecast the effects of a lower speed limit I'd have to factor in that gasoline could get cheaper -- and let's face it, I can't predict the workings of the oil market.
20 June 2008
Gallons per mile?
Experts find key to saving fuel: say gallons per mile.
I'll summarize: d/dx 1/x = -1/x2.
Research has been done that shows that people believe that an improvement of 1 mpg will always save them the same amount of gas. But this is obviously false, as some simple arithmetic shows. Let's say I drive 12,000 miles a year. (Why 12,000? Because everything that follows will work out to be integers.) If I improve from 15 mpg to 16 mpg, I go from using 800 gallons of gas a year to 750, a 50-gallon reduction. But if I improve from 24 mpg to 25 mpg, I go from using 500 gallons of gas a year to 480, a 20-gallon reduction.
A driver driving m miles per year in a car getting x miles per gallon will of course use m/x gallons of gas; the derivative of this is -m/x2. So if you get x miles per gallon already, improving by one mile per gallon saves m/x2 gallons. (I'm assuming here that 1 is small compared to x.)
The article claims that this means people wanting to get better gas mileage, if they have multiple vehicles, should always target the least efficient vehicle -- but that's going too far. It might be cheaper to get a 1-mpg improvement for less fuel-efficient cars. There's no reason that the cost of a car should be linear in the number of miles per gallon it gets, all else being held constant.
Note that I'm also not saying the cost of a car should be linear in the number of gallons per mile it gets! In fact this would be impossible, because it would predict that cars that get zero gallons per mile could be made for a finite amount of money.
"Gallons per mile" is kind of an annoying unit, though, because all cars get less than 1. Perhaps "gallons per 100 miles" would be a good way to go, with most cars measuring between perhaps 3 and 6 on this scale. And people can picture driving 100 miles. (For example, if they have a ten-mile commute each way, it's five round-trips to work.) But on the other hand, there's a temptation to not have to deal with decimals, and there's a big difference between 4 gallons per 100 miles and 5 gallons per 100 miles. Perhaps "gallons per 1000 miles" works nicely; typical values are now 2-digit integers, and rounding to the nearest integer gives roughly the same precision as the current system.
(Readers from other countries: please spare me the "in my country we measure fuel economy in liters per 100 km" comments. I know this.)
I'll summarize: d/dx 1/x = -1/x2.
Research has been done that shows that people believe that an improvement of 1 mpg will always save them the same amount of gas. But this is obviously false, as some simple arithmetic shows. Let's say I drive 12,000 miles a year. (Why 12,000? Because everything that follows will work out to be integers.) If I improve from 15 mpg to 16 mpg, I go from using 800 gallons of gas a year to 750, a 50-gallon reduction. But if I improve from 24 mpg to 25 mpg, I go from using 500 gallons of gas a year to 480, a 20-gallon reduction.
A driver driving m miles per year in a car getting x miles per gallon will of course use m/x gallons of gas; the derivative of this is -m/x2. So if you get x miles per gallon already, improving by one mile per gallon saves m/x2 gallons. (I'm assuming here that 1 is small compared to x.)
The article claims that this means people wanting to get better gas mileage, if they have multiple vehicles, should always target the least efficient vehicle -- but that's going too far. It might be cheaper to get a 1-mpg improvement for less fuel-efficient cars. There's no reason that the cost of a car should be linear in the number of miles per gallon it gets, all else being held constant.
Note that I'm also not saying the cost of a car should be linear in the number of gallons per mile it gets! In fact this would be impossible, because it would predict that cars that get zero gallons per mile could be made for a finite amount of money.
"Gallons per mile" is kind of an annoying unit, though, because all cars get less than 1. Perhaps "gallons per 100 miles" would be a good way to go, with most cars measuring between perhaps 3 and 6 on this scale. And people can picture driving 100 miles. (For example, if they have a ten-mile commute each way, it's five round-trips to work.) But on the other hand, there's a temptation to not have to deal with decimals, and there's a big difference between 4 gallons per 100 miles and 5 gallons per 100 miles. Perhaps "gallons per 1000 miles" works nicely; typical values are now 2-digit integers, and rounding to the nearest integer gives roughly the same precision as the current system.
(Readers from other countries: please spare me the "in my country we measure fuel economy in liters per 100 km" comments. I know this.)
24 May 2008
I Will Derive
"I Will Derive", a parody of "I Will Survive".
[埋込みオブジェクト:http://www.youtube.com/v/P9dpTTpjymE&hl=en]
(via reddit.)
Now, the original song is clearly about female empowerment, and there is somebody who could be described as a "jerk" in the song. (Here are the lyrics, in case you've been living in a cave, or you're not from the US -- I'm not sure how well-known this song is in other countries.) I think this parody would be improved if it mentioned jerk, the third derivative of position.
[埋込みオブジェクト:http://www.youtube.com/v/P9dpTTpjymE&hl=en]
(via reddit.)
Now, the original song is clearly about female empowerment, and there is somebody who could be described as a "jerk" in the song. (Here are the lyrics, in case you've been living in a cave, or you're not from the US -- I'm not sure how well-known this song is in other countries.) I think this parody would be improved if it mentioned jerk, the third derivative of position.
15 April 2008
The napkin ring problem
Keith Devlin writes about The Napkin Ring Problem in his column this month. The problem is the following: consider a sphere with a cylindrical hole drilled out from the center. What is the volume of the resulting solid? At first one thinks that this should depend on the radius of the sphere and the radius of the hole, but it turns out to depend only on the height of the resulting solid; Devlin gives the computation. As it turns out, the volume is 4πh3/3, where h is the half-height of the resulting solid; this is the volume of a sphere of radius h. In fact, the corresponding cross-sectional areas of a "napkin ring" of half-height h and a sphere of radius h are the same, as one can see without calculus; by Cavalieri's principle the volumes are equal.
This is a problem that is usually assigned in our calculus courses when we get to solids of revolution. The way that it's phrased in Stewart's calculus text (which I don't have at hand right now) is in two parts. The first part refers to two such napkin rings -- call them A and B -- and says that napkin ring A comes from a larger-radius sphere than B but also has a larger-radius hole; the student is asked to guess whether A or B has greater volume.
At this point the students invariably ask "what if my guess is wrong?" I laugh and tell them that it doesn't matter; the point is that they should try to think about it for a moment before they plunge into the calculations.
The second part, if I remember correctly (my officemate has the book, so I'll check this tomorrow) asks the students to express the volume as a function of the two radii and the height; often, even if they manage to get the correct answer (which is a bit tricky) they do not seem surprised by this fact, which I was when I first saw it. Then again, it is often difficult to judge whether students are surprised by some statement made in class or on the homework; it's not the sort of thing your average college student is going to let show! (Penn students taking the calculus courses are mostly pre-professional, either in the engineering or business schools; I wonder if the future mathematicians or even the future "pure" scientists would react differently.)
(Incidentally, it is always amusing to look at reviews of textbooks at amazon.com; I often wonder how many of them are written by students who are disgruntled about their class and want somewhere to take it out.)
This is a problem that is usually assigned in our calculus courses when we get to solids of revolution. The way that it's phrased in Stewart's calculus text (which I don't have at hand right now) is in two parts. The first part refers to two such napkin rings -- call them A and B -- and says that napkin ring A comes from a larger-radius sphere than B but also has a larger-radius hole; the student is asked to guess whether A or B has greater volume.
At this point the students invariably ask "what if my guess is wrong?" I laugh and tell them that it doesn't matter; the point is that they should try to think about it for a moment before they plunge into the calculations.
The second part, if I remember correctly (my officemate has the book, so I'll check this tomorrow) asks the students to express the volume as a function of the two radii and the height; often, even if they manage to get the correct answer (which is a bit tricky) they do not seem surprised by this fact, which I was when I first saw it. Then again, it is often difficult to judge whether students are surprised by some statement made in class or on the homework; it's not the sort of thing your average college student is going to let show! (Penn students taking the calculus courses are mostly pre-professional, either in the engineering or business schools; I wonder if the future mathematicians or even the future "pure" scientists would react differently.)
(Incidentally, it is always amusing to look at reviews of textbooks at amazon.com; I often wonder how many of them are written by students who are disgruntled about their class and want somewhere to take it out.)
14 April 2008
Knuth on teaching calculus
In 1998, Donald Knuth wrote a letter on using the O-notation in teaching calculus, which Alexandre Borovik has reproduced.
09 March 2008
Approximating the length of an ellipse
Here's a question that occurred to me this morning -- what's the circumference (is this word appropriate here?) of an ellipse with semimajor axis 1+ε and semiminor axis 1? (ε is, of course, small. It could be negative, however.)
Of course, this is an elliptic integral. But I don't know much about elliptic integrals, and besides what good is that information? It doesn't give me a number. (I didn't actually need to know this for anything, but somehow the knowledge that the answer is, say, 2π+ε (it's not) is more satisfying than the fact that it can be written in terms of some special function that I don't know that well.
It turns out the answer is (2+ε)π.
Here's a sketch of a proof. This ellipse can be parametrized by x = (1+ε) cos t, y = sin t, with t varying from 0 to 2π. So the length is Expand, and let ε2 = 0, to get which simplifies to (recalling cos2 t + sin2 t = 1) Now, since ε is "small", 2ε cos2 t is also "small". In general, for small h, (1+h)1/2 ~ 1 + (h/2); thus this is approximately
and now we recall that cos2 t has average value 1/2. So this is (2+ε)π, which is the answer.
More formally, if f(a) is the length of an ellipse with axis lengths 1 and a, this shows (modulo a couple leaps of faith) that f'(1) = π -- this can easily be checked with a computer algebra system, or if you actually know more about elliptic integrals than I do. This has the nice interpretation that if the lengths of the two axes of an ellipse are close to each other, the length of the ellipse is just π times the mean of the axis lengths -- which is true for a circle, where it just says that the circumference of a circle is π times its diameter. The Taylor series for the elliptic integral which gives the length is, according to Maple,
and from numerical data, for, say, ε = 0.1, this method predicts an ellipse length of 2.1π = 6.5973; the actual length is 6.6011. Even for ε = 0.5 the error's only about one percent (7.85 versus 7.93).
The real question that I started out with, though, still isn't answered -- is there some nice geometric way to see this?
Of course, this is an elliptic integral. But I don't know much about elliptic integrals, and besides what good is that information? It doesn't give me a number. (I didn't actually need to know this for anything, but somehow the knowledge that the answer is, say, 2π+ε (it's not) is more satisfying than the fact that it can be written in terms of some special function that I don't know that well.
It turns out the answer is (2+ε)π.
Here's a sketch of a proof. This ellipse can be parametrized by x = (1+ε) cos t, y = sin t, with t varying from 0 to 2π. So the length is Expand, and let ε2 = 0, to get which simplifies to (recalling cos2 t + sin2 t = 1) Now, since ε is "small", 2ε cos2 t is also "small". In general, for small h, (1+h)1/2 ~ 1 + (h/2); thus this is approximately
and now we recall that cos2 t has average value 1/2. So this is (2+ε)π, which is the answer.
More formally, if f(a) is the length of an ellipse with axis lengths 1 and a, this shows (modulo a couple leaps of faith) that f'(1) = π -- this can easily be checked with a computer algebra system, or if you actually know more about elliptic integrals than I do. This has the nice interpretation that if the lengths of the two axes of an ellipse are close to each other, the length of the ellipse is just π times the mean of the axis lengths -- which is true for a circle, where it just says that the circumference of a circle is π times its diameter. The Taylor series for the elliptic integral which gives the length is, according to Maple,
and from numerical data, for, say, ε = 0.1, this method predicts an ellipse length of 2.1π = 6.5973; the actual length is 6.6011. Even for ε = 0.5 the error's only about one percent (7.85 versus 7.93).
The real question that I started out with, though, still isn't answered -- is there some nice geometric way to see this?
19 January 2008
Integration is weird
Why computing definite integrals isn't a simple matter of applying the Fundamental Theorem of Calculus, from the Wolfram Blog. There are discontinuities and such.
And this doesn't even mention integrals like that of exp(-x2) over the whole real line, for which there's a "trick", or real integrals that are best done by integrating over a contour in the complex plane -- the focus here is solely on integrals where there is a definite integral but something weird happens, the sort of thing where you think you know what you're doing but you really don't. (This is the sort of thing that teachers who have a reputation for being a bit sadistic pepper their tests with.)
(Feynman supposedly got a reputation for being really good at integration because he knew some contour integration tricks that a lot of other people didn't. He didn't know a lot of the tricks that they knew, but they only came to him after they had already banged their head against it. The moral of this story: people think you're smart if you know things that they don't. Edited: Efrique points out in a comment that I have this backwards -- but the idea still stands.)
And this doesn't even mention integrals like that of exp(-x2) over the whole real line, for which there's a "trick", or real integrals that are best done by integrating over a contour in the complex plane -- the focus here is solely on integrals where there is a definite integral but something weird happens, the sort of thing where you think you know what you're doing but you really don't. (This is the sort of thing that teachers who have a reputation for being a bit sadistic pepper their tests with.)
(Feynman supposedly got a reputation for being really good at integration because he knew some contour integration tricks that a lot of other people didn't. He didn't know a lot of the tricks that they knew, but they only came to him after they had already banged their head against it. The moral of this story: people think you're smart if you know things that they don't. Edited: Efrique points out in a comment that I have this backwards -- but the idea still stands.)
07 January 2008
Product rules for more complicated products
Michael Hardy wrote a paper entitled Combinatorics of Partial Derivatives. He gives Leibniz' rule for the differentiation of a product in the rather unfamiliar form
which I am calling unfamiliar not because it's a particularly deep result, but because it's just not something one usually writes out. It could be proven by induction from the more "standard" product rule (uv)' = u'v + uv'.
But why don't we teach this to freshmen? Sure, the notation might be a bit of a barrier; I get the sense that a lot of my students learn the Σ notation for the first time when we teach them about infinite sequences and series, at the end of the second-semester calculus course; of course they learn about derivatives, including multiple derivatives, sometime in the first semester. (If it is true that they are seeing the Σ notation for the first time then, it doesn't seem quite fair, because then we're asking them to assimilate this weird notation and some real understanding of the concept of infinity at the same time. Indeed, at Penn we often tell them not to worry so much about the notation.) But ignoring the notational difficulties, fix a value of k -- say, 4 -- and get
One doesn't take the fourth derivative of a product that often; but even knowing that $(uv)^{\prime\prime} = u^{\prime\prime} + 2u^\prime v^\prime + u v^{\prime\prime}$ might be preferable to
Also, one can expand a rule like this to products of more than two terms; we have
Again, this doesn't come up that often, and I don't want to try to write it for derivatives of products of an arbitrary number of factors. Still, the idea is fairly natural but how many freshmen would even know that
I really don't know the answer to this -- but products of three factors are not incredibly rare, and the rule here is quite simple -- just take the derivative of each factor in turn, and sum up the results. There's even a nice "physical" interpretation of it -- how much does the volume of a three-dimensional box change as we change its various dimensions?
The coefficients seem kind of arbitrary, though; the point of Hardy's paper is that if things get recast in terms of partial derivatives they go away, both here and in Faa di Bruno's formula for the derivative of a composition of functions. One way to think of this is to imagine that, in the product rule, we have a "prime 1", a "prime 2", and so on up to a "prime k" if we're taking kth derivatives; we attach these primes to the variables in all possible ways, sum up the results, and then "collapse" them by reading all the primes to just mean ordinary differentiation.
Reference
Hardy, Michael, "Combinatorics of Partial Derivatives", Electronic
Journal of Combinatorics, 13 (2006), #R1.
http://www.combinatorics.org/Volume_13/PDF/v13i1r1.pdf
which I am calling unfamiliar not because it's a particularly deep result, but because it's just not something one usually writes out. It could be proven by induction from the more "standard" product rule (uv)' = u'v + uv'.
But why don't we teach this to freshmen? Sure, the notation might be a bit of a barrier; I get the sense that a lot of my students learn the Σ notation for the first time when we teach them about infinite sequences and series, at the end of the second-semester calculus course; of course they learn about derivatives, including multiple derivatives, sometime in the first semester. (If it is true that they are seeing the Σ notation for the first time then, it doesn't seem quite fair, because then we're asking them to assimilate this weird notation and some real understanding of the concept of infinity at the same time. Indeed, at Penn we often tell them not to worry so much about the notation.) But ignoring the notational difficulties, fix a value of k -- say, 4 -- and get
(uv)^{\prime\prime\prime\prime} = u \cdot v^{\prime\prime\prime\prime} + 4 u^\prime \cdot v^{\prime\prime\prime} + 6 u^{\prime\prime} \cdot v^{\prime\prime} + 4 u^{\prime\prime\prime} \cdot v^\prime + u^{\prime\prime\prime\prime} \cdot v
so basically we notice two things: there are four primes in each term, and the coefficients are the binomial coefficients, which are familiar to most students.One doesn't take the fourth derivative of a product that often; but even knowing that $(uv)^{\prime\prime} = u^{\prime\prime} + 2u^\prime v^\prime + u v^{\prime\prime}$ might be preferable to
Also, one can expand a rule like this to products of more than two terms; we have
Again, this doesn't come up that often, and I don't want to try to write it for derivatives of products of an arbitrary number of factors. Still, the idea is fairly natural but how many freshmen would even know that
(uvw)^\prime = u^\prime vw + u v^\prime w + uvw^\prime?
I really don't know the answer to this -- but products of three factors are not incredibly rare, and the rule here is quite simple -- just take the derivative of each factor in turn, and sum up the results. There's even a nice "physical" interpretation of it -- how much does the volume of a three-dimensional box change as we change its various dimensions?
The coefficients seem kind of arbitrary, though; the point of Hardy's paper is that if things get recast in terms of partial derivatives they go away, both here and in Faa di Bruno's formula for the derivative of a composition of functions. One way to think of this is to imagine that, in the product rule, we have a "prime 1", a "prime 2", and so on up to a "prime k" if we're taking kth derivatives; we attach these primes to the variables in all possible ways, sum up the results, and then "collapse" them by reading all the primes to just mean ordinary differentiation.
Reference
Hardy, Michael, "Combinatorics of Partial Derivatives", Electronic
Journal of Combinatorics, 13 (2006), #R1.
http://www.combinatorics.org/Volume_13/PDF/v13i1r1.pdf
25 October 2007
Something I didn't know about generating functions (and probably should have)
I learned today, while reading Flajolet and Sedgewick's Introduction to the Analysis of Algorithms, something that I probably should have known but didn't. I should have known this because I've learned what ordinary and exponential generating functions are about four times now (since combinatorics classes often don't assume that much background, they seem to get defined over and over again).
Namely, given a sequence a0, a1, a2, ..., we can form its exponential generating function $A(z) = \sum_{n=0}^\infty a_n {z^n \over n!}$. Then the ordinary generating function $\tilde{A}(z) = \sum_{n=0}^\infty a_n z^n$ is given by the integral
when this integral exists. (This is something like the Laplace transform.)
The proof is straightforward, and I'll give it here. (I'll ignore issues of convergence.) Consider that integral; by recalling what A(z) is, it can be rewritten as
and we can interchange the integral and the sum to get
But we can pull out the part of the integrand which doesn't depend on t to get
and that integral is well-known as the integral representation for the gamma function. The integral is k!, which cancels with the k! in the denominator, and we recover $\tilde{A}(z) = \sum_{k=0}^\infty a_k z^k$.
It's easy to come up with examples to verify this; for example, the exponential generating function of the binomial coefficients ${N \choose 2}$ is z2ez/2; plugging this into our formula gives z2(1-z)-3, which is the ordinary generating function of the same sequence.
I'm not sure how useful it is to know this, though... I can't think of too many times where I had an exponential generating function for some sequence and thought "oh, if only I had the ordinary generating function."
Namely, given a sequence a0, a1, a2, ..., we can form its exponential generating function $A(z) = \sum_{n=0}^\infty a_n {z^n \over n!}$. Then the ordinary generating function $\tilde{A}(z) = \sum_{n=0}^\infty a_n z^n$ is given by the integral
when this integral exists. (This is something like the Laplace transform.)
The proof is straightforward, and I'll give it here. (I'll ignore issues of convergence.) Consider that integral; by recalling what A(z) is, it can be rewritten as
and we can interchange the integral and the sum to get
But we can pull out the part of the integrand which doesn't depend on t to get
and that integral is well-known as the integral representation for the gamma function. The integral is k!, which cancels with the k! in the denominator, and we recover $\tilde{A}(z) = \sum_{k=0}^\infty a_k z^k$.
It's easy to come up with examples to verify this; for example, the exponential generating function of the binomial coefficients ${N \choose 2}$ is z2ez/2; plugging this into our formula gives z2(1-z)-3, which is the ordinary generating function of the same sequence.
I'm not sure how useful it is to know this, though... I can't think of too many times where I had an exponential generating function for some sequence and thought "oh, if only I had the ordinary generating function."
11 October 2007
The "fleshball" -- a crude upper bound on human population
What bounds are there on the growth of human population?
Well, there are a lot of obvious ones. We might kill ourselves with global warming or nuclear war or a host of other things. We're still stuck on this planet. It might turn out that there's some race of killer aliens that will vaporize us when they discover we exist, perhaps because they want to demolish our planet to build a hyperspace bypass.
But let's say we survive all that. We'll still run into trouble when we can't find space for people to live.
And at some point, if we reproduce like we do now into the indefinite future, the sphere which holds all human flesh will be expanding faster than the speed of light.
Let's say you could pack all the humans that currently exist into a giant sphere. The volume of that sphere would be just Vn, where V is the volume of a human being and n is the number of humans; its radius can be obtained by solving the equation $Vn = {4\over 3} \pi x^3,ドル and we get $x = \left({3Vn/4\pi}\right)^{1/3}$. With current numbers of n = 6.6 billion, V = 0.070 m3 (I'm assuming the average human being weighs 70 kilograms and has the density of water), we have x = 480 meters. That's right -- all of humanity could fit into a ball not quite a kilometer across. Kind of puts things in perspective, doesn't it?
Now let's let n be a function of time. Let's say the human population grows exponentially, so we have $n(t) = n_0 e^{rt}$. Here, n0 is the population at time zero, and r is the rate of population growth; this is currently about 0.012/year.
Then we have
and so the rate of change of the radius of the giant flesh ball, with respect to time, is
where k = 3V n_0 \over 4\pi.
The time at which the fleshball will be expanding at the speed of light is just the time when this expression for the derivative is equal to c. Setting it equal to c and solving for t gives
.
Now, we have r = 0.012/yr; that's about 4 × 10-10/sec. c is of course the speed of light, 3 × 108 m/s. And k is about 1.1 × 108 m3. Plugging in numbers gives t = 2.7 × 1011 s, or about nine thousand years from the present.
The radius of the ball at that time will be 3c/r, or 2.25 × 1018 meters; that's 237 light years. (Not surprisingly, the radius of the ball at the time that it hits the speed c doesn't depend on the volume of an individual person; as far as the ball is concerned we're just one giant blob that grows at slightly over one percent per year.)
And the number of people in the ball is
which is 6.8 × 1056.
Somehow I don't think we need to worry about this. Why? A proton weighs 1.7 × 10-27 kg; about half of a person's mass is protons, so each person contains about 2 × 1028 protons. Thus this many people would contain about 1085 protons. But the number of protons in the universe is believed to be somewhere under 1080. So we'll run out of mass in the universe well before we hit this threshhold.
Besides, the whole idea of humanity being a solid ball of flesh wasn't so appealing anyway.
Well, there are a lot of obvious ones. We might kill ourselves with global warming or nuclear war or a host of other things. We're still stuck on this planet. It might turn out that there's some race of killer aliens that will vaporize us when they discover we exist, perhaps because they want to demolish our planet to build a hyperspace bypass.
But let's say we survive all that. We'll still run into trouble when we can't find space for people to live.
And at some point, if we reproduce like we do now into the indefinite future, the sphere which holds all human flesh will be expanding faster than the speed of light.
Let's say you could pack all the humans that currently exist into a giant sphere. The volume of that sphere would be just Vn, where V is the volume of a human being and n is the number of humans; its radius can be obtained by solving the equation $Vn = {4\over 3} \pi x^3,ドル and we get $x = \left({3Vn/4\pi}\right)^{1/3}$. With current numbers of n = 6.6 billion, V = 0.070 m3 (I'm assuming the average human being weighs 70 kilograms and has the density of water), we have x = 480 meters. That's right -- all of humanity could fit into a ball not quite a kilometer across. Kind of puts things in perspective, doesn't it?
Now let's let n be a function of time. Let's say the human population grows exponentially, so we have $n(t) = n_0 e^{rt}$. Here, n0 is the population at time zero, and r is the rate of population growth; this is currently about 0.012/year.
Then we have
and so the rate of change of the radius of the giant flesh ball, with respect to time, is
where k = 3V n_0 \over 4\pi.
The time at which the fleshball will be expanding at the speed of light is just the time when this expression for the derivative is equal to c. Setting it equal to c and solving for t gives
.
Now, we have r = 0.012/yr; that's about 4 × 10-10/sec. c is of course the speed of light, 3 × 108 m/s. And k is about 1.1 × 108 m3. Plugging in numbers gives t = 2.7 × 1011 s, or about nine thousand years from the present.
The radius of the ball at that time will be 3c/r, or 2.25 × 1018 meters; that's 237 light years. (Not surprisingly, the radius of the ball at the time that it hits the speed c doesn't depend on the volume of an individual person; as far as the ball is concerned we're just one giant blob that grows at slightly over one percent per year.)
And the number of people in the ball is
which is 6.8 × 1056.
Somehow I don't think we need to worry about this. Why? A proton weighs 1.7 × 10-27 kg; about half of a person's mass is protons, so each person contains about 2 × 1028 protons. Thus this many people would contain about 1085 protons. But the number of protons in the universe is believed to be somewhere under 1080. So we'll run out of mass in the universe well before we hit this threshhold.
Besides, the whole idea of humanity being a solid ball of flesh wasn't so appealing anyway.
06 October 2007
Dual numbers
You know that trick where you invent some number ε such that ε2 = 0 and use it to, basically, take derivatives?
For example, (x+ε)2 = x2 + 2xε, so if we change x by some small amount ε then we change x2 by 2x times that amount. Thus the derivative of x2 must be 2x.
It turns out that trick has a name; it's calculation in the algebra of dual numbers, which I discovered by randomly poking around Wikipedia, and it's apparently used in at least some computer algebra systems to do differentiation. I didn't know that.
Edit (Monday, 4:36 pm): Charles of Rigorous Trivialities has pointed out that dual numbers are used extensively in deformation theory.
For example, (x+ε)2 = x2 + 2xε, so if we change x by some small amount ε then we change x2 by 2x times that amount. Thus the derivative of x2 must be 2x.
It turns out that trick has a name; it's calculation in the algebra of dual numbers, which I discovered by randomly poking around Wikipedia, and it's apparently used in at least some computer algebra systems to do differentiation. I didn't know that.
Edit (Monday, 4:36 pm): Charles of Rigorous Trivialities has pointed out that dual numbers are used extensively in deformation theory.
Subscribe to:
Comments (Atom)