Update: I left it running and yes, it does eventually exit. So perhaps
the question is why it takes so much longer to do the next step when n=5
than when n=4. The values of x seem to be identical in both steps.
Fernando
On 10/30/2025 4:53 PM, Fernando Gouvea wrote:
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
--
=============================================================
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/938e7324-009d-4604-aec1-9359a59682fd%40colby.edu.