Ask Your Question

Finding all the roots at once numerically

asked 2011-05-05 07:17:27 +0200

ebs gravatar image

updated 2011-05-05 15:32:32 +0200

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 15:25:53 +0200

Kelvin Li gravatar image

updated 2011-05-05 21:32:09 +0200

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 18:27:46 +0200 )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 21:44:11 +0200 )edit

Thank you!

ebs gravatar imageebs ( 2011-06-27 03:53:49 +0200 )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 07:17:27 +0200

Seen: 2,442 times

Last updated: May 05 '11