ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 19 Feb 2024 16:46:11 +0100Comparison between SageMath ODE solvers and Scipy ODE solvershttps://ask.sagemath.org/question/76091/comparison-between-sagemath-ode-solvers-and-scipy-ode-solvers/ I'm pretty new to SageMath and I'm currently trying to work on solving geodesic equations in well-defined spacetime manifolds. I found the documentation of SageMath pretty extensive and broad and it gave me a lot of confidence in the software. But I'm still hesitating to use Sage ODE solvers because I know the capabilities of `RK45` from `scipy.integrate` as I have use that many times. I just want to know on a broad scale, are SageMath solvers faster than Scipy solvers and how reliable and stable are the solutions in general ?
Thanks in advance for the replies! AKGSageMon, 19 Feb 2024 16:46:11 +0100https://ask.sagemath.org/question/76091/Using desolve_odeint with external stimulushttps://ask.sagemath.org/question/36132/using-desolve_odeint-with-external-stimulus/I'm trying to numerically solve a two-variable system of differential equations with a periodic external driver (square wave). Right now, the code I have is:
from scipy.signal import square
def sqstim(t, amp=1):
return (amp/2)*float(square(t))+amp/2
var("V,w")
trange=srange(0,100,0.1)
def eqns(t):
return [1/100*(-w+(V^3-V)+sqstim(t)), V-0.2*w]
sol=desolve_odeint(eqns, times=trange, ics=[0.1,0.1], dvars=[V,w])
This gives `"TypeError: 'function' object is not iterable"`. What should I do instead?jaiaSat, 31 Dec 2016 22:54:09 +0100https://ask.sagemath.org/question/36132/