ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 05 Feb 2014 07:47:15 -0600Looong computation by desolve_rk4http://ask.sagemath.org/question/10996/looong-computation-by-desolve_rk4/I'm having an issue with very long computation times for numerical solutions to DEs using desolve_rk4. It happens when computing a solution that runs off to +/- infinity. For example, the following command will do it:
t,y = var('t,y')
f(t,y) = 6+y-y^2
desolve_rk4(f(t,y), y, ivar=t, ics=[0,-4], end_points=[0,10], output='plot')
If I make "end_points" run from 0 to something much smaller, like 0.1, everything is okay. But I want some way to fix this behavior so that I can change the initial conditions easily for classroom demos without having to constantly change the endpoints (in an interact, for example). I also don't quite understand why it should be taking so long simply to run to infinity -- this behavior doesn't match my understanding of the RK4 algorithm. (I can understand that we might hit overflow quickly, but I would expect it should simply stop computation at that point.)
Any suggestions?AndyWed, 05 Feb 2014 07:47:15 -0600http://ask.sagemath.org/question/10996/