Root command

andesan shared this problem 7 years ago
Solved

Please have a look at the attached file. The command Root[f, 90, 110] gives undefined as result, but Root[f, 60, 140] and Root[f, 99, 101] gives 100.


Is this a bug? Any other explanation?

https://ggbm.at/568823

Comments (9)

photo
1

It's using a numerical algorithm so is probably having trouble with the big numbers. You can use the CAS View for exact answers, or this seems more stable:

    f(x) = -10x² + 1100x - 10000

    Root[f(x) / 1000, RandomBetween[50, 99], RandomBetween[101, 150]]

photo
1

Also try:

    Root[f]

which is designed for Polynomials, Root[f, a, b] is designed for more general functions

photo
1

The actuall function was given at one of the National Exams in Norway, and the pupils want to restrict the domain to positive x values. They use the commands Function[...] or If[...] to restrict the domain. Then the command Root[f] does not work, and they need to use one of the numerical variants.

photo
1

Simply use twice

    Root[f, <StartingValue>]

as per att'd sheet.

https://ggbm.at/568825

photo
1

I know the command Root[f, <StartingValue>], and that one works fine. But why are not Root[f, a, b] working for a=90 and b=110. I think you should have a look at the code in GeoGebra to see if there is something strange in there... According to the GeoGebra manual, Root[f, a, b] uses the Regula Falsi method. I cannot see any reason why this method should not work for a simple quadratic function like the one in my example. (I can understand that you are questioning the use of this method on a simpel function like this, but the command should work anyway.)

photo
1

According to the GeoGebra manual, Root[f, a, b] uses the Regula Falsi method
Hi,

my idea is that Geogebra algorithms work properly, numerically speaking, with Newton-Raphson method (only one starting value needs), despite what the manual says. In fact, I never met discrepancies by using the root searches in such a manner. It's my thought, of course, coming from a long use of Geogebra. Cheers

Philippe

photo
1

Hi, to play with regula falsi method with this concave functtion on [90;110]

https://ggbm.at/568831

photo
1

According to the GeoGebra manual, Root[f, a, b] uses the Regula Falsi method.


It hasn't said that for a while (as it's not true any more): Root


Anyway, we've improved it for 5.0.20.0 so all answers from Root[f, a, b] will generally be more accurate now so thanks for the report :)

photo
1

Thank you!


It is a big job to keep the documention in sync with the code, and an even larger job to keep the translations of the documentation in sync. I read this in the Norwegian manual, and that one needs to be updated. (We are working on it, but it is a huge job to track all the updates...)

© 2022 International GeoGebra Institute