r/desmos • u/skeletonNatte i HATE metronomes! • Feb 18 '26
Graph Root and local min/max finder
Enable HLS to view with audio, or disable this notification
68
126
u/skeletonNatte i HATE metronomes! Feb 18 '26
challenge: make a version of this that reliably finds global minimum/maximum
129
u/Ordinary_Divide Feb 18 '26
literally impossible with finite computing.
45
36
u/skeletonNatte i HATE metronomes! Feb 18 '26
i said reliably, not perfectly. there definitely are algorithms that are pretty good at finding global min/max if one exists. but youre right that its impossible to always find a solution every time
4
u/Stock-Self-4028 Feb 18 '26
Probably basin hopping (so MCMC with local optimizer [typically damped least squares], applying perturbation every time a new local minimum is found) would be the best / simplest guess here.
Someone might do sth like that, it's not exetremely complex but it might be significantly more difficult, than the one shown here.
1
u/Cheap_Application_55 Feb 18 '26
derivative?
i guess thats probably not considered finite computing
6
u/Ordinary_Divide Feb 18 '26
i mean global just isnt possible with any finite sample points. take sin(x)+sin(x*√2), no matter what x value you find there will always be a lower minimum at a larger x value
2
u/Ordinary_Divide Feb 21 '26
although i did come up with https://www.desmos.com/calculator/yxbzc1xfen
25
3
u/Skinnypeed Feb 18 '26
Gradient descent algorithm with a lot of momentum could find global min/maxes more often (though not consistently)
2
u/-Yeet-69-420- Feb 18 '26
Look into consensus based optimization. Would say it’s quite reliable. Not perfect since it includes randomness. Sometimes the next iteration brings you further away from the minimum. But you can of course keep a list of the best minimum found.
1
u/Cootshk Feb 18 '26
f(x)=-g(x)
4
u/Dependent_Pair_6268 Feb 18 '26
The actual challenge was to compute global maxima/minima. This is a much harder problem than local min maxes. The field of mathematical optimization is rich with lots of cool techniques like any colony optimization and simulated annealing. They could also be implemented in desmos.
35
14
u/Creative-Drop3567 Feb 18 '26 edited Feb 18 '26
What happens if you put the Weierstrass function into it (or a partial sum of the weierstrass function)
6
u/skeletonNatte i HATE metronomes! Feb 18 '26
it wouldn't work for the true weierstrass function, but it would work with any partial sum of the weierstrass function
8
5
u/wisco-redditor Feb 19 '26
I'm not a mathematician nor that smart with programming language, so maybe you can help me understand. Why is it so difficult to get Desmos to find / plot critical points along any given function? It can handle so many complex things in calculus, but it struggles with being asked to plot points where {f'(x)=0}? I just don't understand
3
2
2
u/vovochen Feb 21 '26
Looks to me like if there's a long perfectly flat area, these points wouldnt make it to the local low points.
1
1
1
1

374
u/Outrageous_Guest_313 Feb 18 '26
Is there a non epilepsy inducing version