Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your code finds one solution then *stops*.

To get the other solutions, you shound recursively search solutions in the intervaldefined by the bounds of the original interval and your first solution.

The trick is, of course, to detect when to stop... Left to the reader as a ((very) interesting) exercise. Hint : what your function should do when asked to find the roots of $\sin\frac{1}{x}$ between $-\pi$ and $\pi$ ?

BTW, the use of numpy is irrelevant. you might as well use the code fior Newton's method already existing in Sage, using numpy-defined variables and functions.

HTH,

Your code finds one solution then *stopsstops*..

To get the other solutions, you shound recursively search solutions in the intervaldefined by the bounds of the original interval and your first solution.

The trick is, of course, to detect when to stop... stop for good... Left to the reader as a ((very) interesting) exercise. Hint : what your function should do when asked to find the roots of $\sin\frac{1}{x}$ between $-\pi$ and $\pi$ ?

BTW, the use of numpy is irrelevant. you might as well use the code fior Newton's method already existing in Sage, using numpy-defined variables and functions.

HTH,