Ask Your Question

Finding all the roots at once numerically

asked 2011-05-05 00:17:27 -0600

ebs gravatar image

updated 2011-05-05 08:32:32 -0600

Kelvin Li gravatar image

I want to calculate the roots of equations like

tanh(ax) = x

numerically. But the problem is sage gives option of finding just one root provided I give it the interval where the root may be found.


But sometimes the interval is not so obvious and I need to know all the numerical roots at once (If the number of roots are finite that is). Is There a way to do that?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2011-05-05 08:25:53 -0600

Kelvin Li gravatar image

updated 2011-05-05 14:32:09 -0600

Returning only one root in a given interval is not a limitation of Sage, per se. Without any sort of "insight" into the given function, the number of roots, whether there are an infinite number of roots, or the approximate locations of the roots are all impossible to determine.

In practice, one must have some understanding the behavior of the function in order to use numerical methods to find all roots.

In the given case $f(x) = \tanh(a \cdot x) - x$:

  • If $a \leq 1$, then the only root of $f(x)$ is $x = 0$.

  • If $a > 1$, then there are three distinct roots: $0$, $r$, and $-r$. It can be shown that $0 < r < 1$.

edit flag offensive delete link more


but wolfram alpha does give all the numerical solutions in most of the cases. If roots are not finite, wolfram alpha returns some of the roots. So, can this functionality be implemented in sage also? You are right. it is necessary to understand the behavior of the function.

ebs gravatar imageebs ( 2011-05-05 11:27:46 -0600 )edit

I doubt that wolfram alpha does anything much more sophisticated than using a sort of process of elimination, where each failure to find a root over a given interval eliminates the possibility of a root existing in that interval. In that sense, yes, this heuristic can be implemented in Sage. However, this probably is not very useful for most applications, where at least some information can be obtained about the system.

Kelvin Li gravatar imageKelvin Li ( 2011-05-05 14:44:11 -0600 )edit

Thank you!

ebs gravatar imageebs ( 2011-06-26 20:53:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-05-05 00:17:27 -0600

Seen: 1,558 times

Last updated: May 05 '11