Sage find_root error

42 views
Skip to first unread message

Paul Royik

unread,
May 2, 2015, 6:50:55 PM5/2/15
to sage-s...@googlegroups.com
Don't know why but find_root(x*tan(x), -1, 5) gives me 1.570796 which is incorrect, since it is pi/2, the value at which tangent doesn't exist.

Dominique Laurain

unread,
May 3, 2015, 3:27:44 AM5/3/15
to sage-s...@googlegroups.com

I bet I know why : we can trick mathematical sofware in various ways,...,but why should we ?
find_root is "numerical" function to get approximate real root of function in interval....when we know ( "theorically") the root exists !!
the function can be implemented in various ways, and for example, if using a Newton tangent algorithm, it needs only the function to be continuous and with derivative, to get, in finite steps, a better approximate as the one given

In http://www.sagemath.org/doc/reference/numerical/sage/numerical/optimize.html the help doc gives xtol=1.e-12 (default) and the algorithm terminated when new approximate x_n is in range [pi/2 - xtol, pi/2 + xtol] for your function
For me, "find_root_approximate" would have been better name than find_root

Paul Royik

unread,
May 3, 2015, 4:28:54 AM5/3/15
to sage-s...@googlegroups.com
Thank you for your answer.
And what should be done in this case?

Dominique Laurain

unread,
May 3, 2015, 7:55:14 AM5/3/15
to sage-s...@googlegroups.com

What can be done ?
It depends of what you are looking for. : why you have to solve "x tan x = 0" ?
A human will handle factorization and get the answer : x = 0 or tan x = 0...and you can continue yourself wthout computer, no ?


Paul Royik

unread,
May 4, 2015, 8:59:07 AM5/4/15
to sage-s...@googlegroups.com
This is incorrect question.
You are actually asking what is sage for?

I need to solve arbitrary equations, so I don't know ahead of time how it will look like.
Reply all
Reply to author
Forward
0 new messages