Hi all,
I want to check is my code correct to compute IVP of
\frac{dx}{dt} = \sqrt{2g} \frac{R}{\sqrt{R+x}}
the initial condition is x(0)=0
using SymPy
@syms t, g, R
@syms x()
# Computing IVP with SymPy
x(t).diff(t)
diffeq = Eq(x(t).diff(t), sqrt(2g)*R*(1/sqrt(R+x(t))) ); string(diffeq)
# To solve the ODE, pass it and the function to solve for to dsolve.
xt = dsolve(diffeq, x(t))
diffeq3 = xt[3](Dict(R => 4000, g => 78545 ))
# To solve the Initial Value Problem, initial condition is 0
ivp = dsolve(diffeq3, x(t), ics = Dict(x(0) => 0 ))
there are 3 solutions at xt and when I try to compute IVP it becomes error:
PyError ($(Expr(:escape, :(ccall(#= /home/browni/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class âValueErrorâ>
ValueError(âCouldnât solve for initial conditionsâ)
** File â/home/browni/.julia/conda/3/envs/lasthrim_env/lib/python3.10/site-packages/sympy/solvers/ode/ode.pyâ, line 640, in dsolve**
** return _helper_simplify(eq, hint, hints, simplify, ics=ics)**
** File â/home/browni/.julia/conda/3/envs/lasthrim_env/lib/python3.10/site-packages/sympy/solvers/ode/ode.pyâ, line 695, in _helper_simplify**
** solved_constants = solve_ics([rv], [r[âfuncâ]], cons(rv), ics)**
** File â/home/browni/.julia/conda/3/envs/lasthrim_env/lib/python3.10/site-packages/sympy/solvers/ode/ode.pyâ, line 802, in solve_ics**
** raise ValueError(âCouldnât solve for initial conditionsâ)**
Stacktrace: