I'm trying to run this code, a simple-minded implementation of Newton's
method:
g(x) = cos(x)-x
g_prime(x) = g.diff()
start = 1
number_of_steps = 5
x = start
for n in range(number_of_steps+1):
print('step number: ',n,'; Newton estimate: ',x.n())
if g_prime(x)!=0:
x = x - g(x)/g_prime(x)
On my old Windows based 9.2 (terminal), it takes a minute but prints out
steps 0 to 5 and gives me a new prompt.
On 10.6, however (running in WSL, Jupyter notebook), it prints out steps
0 to 4, waits quite a while, prints out step 5, and then the notebook
prompt stays [*] indicating that the kernel is still running.
If I change the number of steps to 8, even in 9.2 it hangs. And it slows
down dramatically in the later steps. I'm clearly doing something wrong.
What?
Thanks,
Fernando
--
=============================================================
Fernando Q. Gouveahttp://www.colby.edu/~fqgouvea
Carter Professor of Mathematics
Dept. of Mathematics
Colby College
5836 Mayflower Hill
Waterville, ME 04901
You can go wrong by being too skeptical as readily as by being too trusting.
-- Robert A. Heinlein
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/sage-support/4108ab28-8ef0-42fe-b0c3-876b95f69e59%40colby.edu.