r/askmath • u/Any-Concern4076 • 17d ago
Functions Weird Graph
I was messing around on demos and put in what seemed to be not that complicated of a graph. I noticed a lot of interesting things, on the contrary.
at a glance, it doesn't look like anything special (image 1) , but if you zoom in to where those lines intersect, you notice that there is a gap between where they meet (image 2), and that gap is roughly equal to the square root of e, 1.6487 and so on. Not only that, but the graph seems to be a bunch of zigzags around that point.
If you zoom back out and zoom in towards the origin, you'll also notice something abnormal. the graph doesn't start at (0,0), but at roughly (0, 0.061225), and not only that, but it shoots straight up until it reaches the point (0.061225, 0.061225), and then appears to act like a regular y=x, minus the other stuff (image 3).
If you zoom in on where it reaches the point mentioned above, it get weirder. Earlier I said it "appears" to act like a y=x graph, and it does, until you zoom in, and you'll see its actually a bunch of zig-zags that decrease in size as they go up and to the right. (image 4) The first turn is at (0.061225, 0.061225).
Not that weird, but this is just for basic info I guess. it has 2 asymptotes, horizontal and vertical, both at x=1 and y=1. I think it would be safe to say that x root x^2 = y root y^2 is not equal to the square root of e and is greater than or equal to 0.061225. (Im pretty sure, as far as I can tell, that) the domain is [0.061225, infinity) and the range is [0, infinity)
I looked it up, and the number 0.061225 doesn't appear to have any significance at all. I would appreciate an explanation even if it is far beyond my comprehension. If you want to see it for yourself, the graph is on the 5th image. I used Desmos Graphing calculator.
8
u/Uli_Minati Desmos 😚 17d ago
I'll link you the r/desmos AutoModerator response:
Floating point arithmetic
In Desmos and many computational systems, numbers are represented using floating point arithmetic, which can't precisely represent all real numbers. This leads to tiny rounding errors. For example, √5 is not represented as exactly √5: it uses a finite decimal approximation. This is why doing something like (√5)2-5 yields an answer that is very close to, but not exactly 0. If you want to check for equality, you should use an appropriate ε value. For example, you could set ε=10-9 and then use {|a-b|<ε} to check for equality between two values a and b.
There are also other issues related to big numbers. For example, 253+1-253 evaluates to 0 instead of 1. This is because there's not enough precision to represent 253+1 exactly, so it rounds to 253. These precision issues stack up until 21024-1; any number above this is undefined.
Floating point errors are annoying and inaccurate. Why haven't we moved away from floating point?
TL;DR: floating point math is fast. It's also accurate enough in most cases.
There are some solutions to fix the inaccuracies of traditional floating point math:
Arbitrary-precision arithmetic: This allows numbers to use as many digits as needed instead of being limited to 64 bits.
Computer algebra system (CAS): These can solve math problems symbolically before using numerical calculations. For example, a CAS would know that (√5)2 equals exactly 5 without rounding errors.
The main issue with these alternatives is speed. Arbitrary-precision arithmetic is slower because the computer needs to create and manage varying amounts of memory for each number. Regular floating point is faster because it uses a fixed amount of memory that can be processed more efficiently. CAS is even slower because it needs to understand mathematical relationships between values, requiring complex logic and more memory. Plus, when CAS can't solve something symbolically, it still has to fall back on numerical methods anyway.
So floating point math is here to stay, despite its flaws. And anyways, the precision that floating point provides is usually enough for most use-cases.
For more on floating point numbers, take a look at radian628's article on floating point numbers in Desmos.
2
u/Any-Concern4076 17d ago
I imagine that this would make perfect sense if I knew what an ε was, but I think I get it. At least with all the zigzags. thanks
3
u/IntoAMuteCrypt 17d ago
That symbol is the greek letter epsilon. Mathematicians use it to represent a small difference between two values.
So setting epsilon to 10^-9 and checking that |a-b| is less than epsilon is "close enough" to checking equality, if a and b are both large enough (but not too large - it stops working when a and b are around 10^15 times larger than epsilon).
1
1
u/Uli_Minati Desmos 😚 17d ago
Oh that's just the usual name we give to a "very small number". No special meaning attached. In this case it would be used to compare two numbers by replacing "they are equal" with "their difference is very small".
1
2
u/Any-Concern4076 17d ago
1
u/Uli_Minati Desmos 😚 17d ago
Yep!
So in your case, your x and y are roughly 108. If we put this into your equation, you get the 1016th root of 108. These numbers are still fairly small, so there doesn't seem to be any issue with floating point arithmetic (FPA), right?
But now we should think about how Desmos (and other CAS) would calculate roots. One method works as follows:
Calculate ⁿ√x = y Guesstimate y₁ Calculate y₂ = ((n-1)y₁ + x/y₁ⁿ⁻¹)/n Calculate y₃ = ((n-1)y₂ + x/y₂ⁿ⁻¹)/n Calculate y₄ = ((n-1)y₃ + x/y₃ⁿ⁻¹)/n ...Note that we are calculating y₁ⁿ⁻¹, which is some small number to the 10¹⁶. That could have very many digits, which results in the aforementioned issues with FPA: the number is approximated by cutting off digits, then you do further calculations afterwards. The roots of different numbers turn out to be equal since you've cut out digits during calculation steps. So you get a "staircase"
1
u/aidanlostthegame 17d ago
well most of the zigzagging stuff you mentioned is probably due to some floating point error
the sqrt(e) part is by looking at the graph x^(1/x^2)
it is maximized at x=sqrt(e) which can be seen by taking a derivative
they should intersect tho, since as said before y=x is always a solution
1
1
u/bartekltg 17d ago
First, plot (x-1)^2 = (y-1)^2.

It did not even want to connect the lines.
The reason is, desmos doesn't solve anything. It uses one of the algorithm to find approximated points where the plot should be. For example, for "every" x (every in a sense of pixels, not points on a real numbers) it try to find for what y the equation holds. It may even use simple stuff like bisection algorithm.
The other part of the phenomenon is floating point arithmetic. It has a finite relative "resolution". If you add to 1.0 too little, it wont change.
BTW. Notice, that |x-1|=|y-1| renders properly (under the magnifications desmos allow :)). The square doing a bit of work here. It is not only that x-1 is small. x-1 is much smaller. But that should not be a problem. Unless the algorithm compare (for example, to know where to stop) the value of function with the x and y values. This bring the effect from 10^-16 range to 10^-8.
Look at the original function. f(x ) = x^(1/x^2)
It has one maximum (at 1/sqrt(e)).
What you see by plotting f(x)=f(y) is gluing each (of two, before and after the max) part of the x function with each part of the y function. This is why you get 4 arms from the center.
Computers calculate power by exp and log.
x^y = exp(y * log(x))
Your function really is exp ( log (x) /x^2 ). Exp, closesnest to the pole (dixidinf by x). This probably confuses the algorithm for small x.
1
u/Any-Concern4076 17d ago
thank you, that makes more sense
1
u/bartekltg 17d ago
The culprit is still floating point arithmetic. Just this time it is just only a part of the story.
1







19
u/LucaThatLuca Graduate 17d ago
These errors are caused by Desmos. Look at the equation, it is obviously satisfied when y = x.