| 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,
| 2 | No.2 Revision |
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,
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.