Re: [sympy] Solution of nonlinear ODE

2021-09-10 Thread Aaron Meurer
Perhaps it would help to set a variable for the initial condition and solve for that. Unfortunately, dsolve() doesn't presently handle the case where the initial condition splits into two solutions. >>> var('t0') t0 >>> dsolve(ode, f(t), ics={f(0): t0}) Traceback (most recent call last): File

Re: [sympy] Solution of nonlinear ODE

2021-09-10 Thread Oscar Benjamin
On Fri, 10 Sept 2021 at 16:40, Nicolas Guarin wrote: > > > I have the following ODE > > z'' = 1 - z² > > That has as solutions z=tanh(C + t) and z=coth(C + t), depending on the initial condition being greater or less than 1. When I use dsolve I get the latter > > > from sympy import * >

[sympy] Solution of nonlinear ODE

2021-09-10 Thread Nicolas Guarin
I have the following ODE z'' = 1 - z² That has as solutions z=tanh(C + t) and z=coth(C + t), depending on the initial condition being greater or less than 1. When I use dsolve I get the latter from sympy import * init_session() ode = Eq(f(t).diff(t), 1 - f(t)**2) sol = dsolve(ode, f(t))