inkliing Posted February 11, 2010 Posted February 11, 2010 I noticed some unexpected behavior in the real-valued f(x)=(1+x)^1/x, as a function of real numbers, when plotting it on wolfram alpha. I inputed: plot (1+x)^1/x from x=-0.0000001 to x=0.0000001 and saw that it unexpectedly seemed to oscillate near zero. I took a closer look with: plot (1+x)^1/x from x=-0.00000000001 to x=0.00000000001 and saw that it definitely seems to oscillate near zero. My original rough graph on paper using a hand calculator suggested the curve was smooth near zero, and even windows calculator's 32 decimal places were unable to reveal the oscillation when I manually calculated many different values near zero. I don't think f(x) is smooth near zero, though, since d/dx[f(x)]=f(x)d/dx[1/xln(1+x)] so all of f(x)'s derivatives have a discontinuity at zero. Since Leonhard Euler showed limf(x)=e as x approaches zero, and this limit is the same as you approach zero from the left or from the right, then the discontinuity of f(x) at zero is removable and the function f(x)=(1+x)^1/x, x not = 0 f(0)=0 x=0 is continous. But the discontinuities in the derivatives don't appear to be removable. Each derivative will have a term containing the factor 1/x (not the 1/x in the exponent of f(x)) which cannot be removed. E.g. d/dx[f(x)]=f(x)[(1/x)(1/(1+x)+(-1/x^2)(ln(x+1))] the 1/x in the 1st term is not removable. I'm not saying it doesn't oscillate near zero, I'm just saying that this is unexpected. I need confirming opinions and confirming logic to explain it so I can believe it. So the questions are: 1. Does f(x) oscillate near zero? 2. Why does f(x) oscillate near zero? 3. Why does this behavior not appear until |x|<~10^-7? 4. Is it a glitch in Mathimatica? [doubt it] 5. If it doesn't oscillate [which it probably does] then how is the behavior of the derivatives explained near zero? 6. If it oscillates, then why is it so hard to replicate this oscillation manually on a calculator? Note#1: This behavior concerns the real-valued f(x). I don't think Re[f(z)] or Im[f(z)], z complex, are of interest here. Note#2: This behavior concerns (1+x)^1/x. I dont think either (1+1/x)^x or lim(1+1/x)^x as x goes to infinty are of interest here. Thx in advance and Kudos to the person with the explanation!
insane_alien Posted February 11, 2010 Posted February 11, 2010 its likely just due to the way wolfram alpha calculates this for plotting, its not going to be going for accuracy as the servers will typically be under a heavy load. it is obviously not calculating with sifficient resolution. looks like it is rounding error to me.
Cap'n Refsmmat Posted February 11, 2010 Posted February 11, 2010 No, that's not it. I just plotted it in Mathematica and got a similar oscillation. I find it hard to believe it's just a rounding error, as Mathematica uses GMP for arbitrary-precision floating point numbers. I think the reason a calculator doesn't show it is, in fact, rounding. Look at the scale on the graph: each label is, in fact, exactly the same. The variance here is incredibly tiny, and you're not going to spot it without using something like Mathematica. Now, as for why the function does that, I don't know...
insane_alien Posted February 11, 2010 Posted February 11, 2010 yes, it uses arbitrary precision, but don't you have to tell it when you want really high precision? try increasing it and see what happens.
Cap'n Refsmmat Posted February 11, 2010 Posted February 11, 2010 Aha. Apparently Mathematica uses machine-precision integers by default on plots. I told it to use 60 digits of precision in its calculations and the plot is now a straight line.
D H Posted February 11, 2010 Posted February 11, 2010 I don't think f(x) is smooth near zero, though, since d/dx[f(x)]=f(x)d/dx[1/xln(1+x)] so all of f(x)'s derivatives have a discontinuity at zero. Since Leonhard Euler showed limf(x)=e as x approaches zero, and this limit is the same as you approach zero from the left or from the right, then the discontinuity of f(x) at zero is removable and the function f(x)=(1+x)^1/x, x not = 0 f(0)=0 x=0 is continous. Whoa! certainly you mean [math] f(x) =\Biggl{\lbrace}\aligned &(1+x)^{1/x} && x\ne 0 \\ &e && x=0 \endaligned [/math] But the discontinuities in the derivatives don't appear to be removable. Sure they are. Use L'Hopital's rule. The problematic term is [math] \left.\frac d {dx} \frac{\ln(1+x)}x\right|_{x=0} [/math] This derivative is defined for all real [math]x>-1[/math] except for [math]x=0[/math]: [math] \frac d {dx} \frac{\ln(1+x)}x = \frac{x-(1+x)\ln(1+x)}{x^2(1+x)} [/math] The numerator and denominator are both zero at x=0. You will need to apply L'Hopital's rule twice. The oscillation is merely a computational effect. It isn't real.
ajb Posted February 11, 2010 Posted February 11, 2010 I also think it is to do with the precision. In Mathematica I set the WorkingProssison option to 20. I get what looks like a straight line. Which is what we expect. Expanding the function about x = 0 gives [math]f(x) = e + \frac{e}{2}x + \cdots[/math]. Any wild behaviour with big or small numbers is likely to be due to the precision used.
insane_alien Posted February 11, 2010 Posted February 11, 2010 /me sticks his toungue out at capn na na na na na! this is why i always ask engineers about math questions rather than mathematicians. engineers understand the concept of 'close enough' and what 'not close enough' looks like. mathematicians think everything is an ideal case.
D H Posted February 11, 2010 Posted February 11, 2010 Expanding the function about x = 0 gives [math]f(x) = e + \frac{e}{2}x + \cdots[/math]. Sign error. The above should be [math]f(x) = e - \frac{e}{2}x + \cdots[/math] which is consistent with [math]\lim_{x\to 0}\frac d{dx}\frac{\ln(1+x)}x = -\,\frac 1 2[/math]
ajb Posted February 11, 2010 Posted February 11, 2010 Sign error. The above should be [math]f(x) = e - \frac{e}{2}x + \cdots[/math] which is consistent with [math]\lim_{x\to 0}\frac d{dx}\frac{\ln(1+x)}x = -\,\frac 1 2[/math] LOL, yes your right, the slope gives us the sign by just looking at it.
inkliing Posted February 12, 2010 Author Posted February 12, 2010 Thx all for the replies. I should have known the problem was mathematica's [wolfram alpha] behavior when doing certain calculations. Merged post follows: Consecutive posts mergedBtw, could any1 tell me if I can set wolfram alpha [i don't have mathematica] to a high number of digits (high precision, say >20), such as Cap'n Refsmmat & ajb suggested, when plotting functions? can this setting be part of the inputted command [e.g. plot (1+x)^1/x workingprecision=20, or some such]?
insane_alien Posted February 12, 2010 Posted February 12, 2010 probably not. wolfram alpha is a stripped down version of mathematica. and the fact the have to run it on their servers probably means they don't want people doing intensive calculations(which is what happens when you use high precision maths.
Cap'n Refsmmat Posted February 12, 2010 Posted February 12, 2010 Yeah. You can do arbitrary precision addition and such, but I can't find an option for plotting.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now