You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ODE below should be easy for dsolve to solve using the nth_algebraic hint. It doesn't work though because dsolve preprocesses the ODE and evaluates all the derivatives so the nth_algebraic solver doesn't get to see the unevaluated derivative form that it knows how to solve. Although classify_ode says nth_algebraic can solve it dsolve will not use the nth_algebraic hint and then an exception is raised in the series solvers. The preprocessing in dsolve should be removed so that nth_algebraic can access the ODE in its original unprocessed form.
In [1]: eq=Derivative(f(x)*g(x), (x, 2))
In [2]: eqOut[2]:
2d
───(f(x)⋅g(x))
2dxIn [3]: classify_ode(eq, f(x))
Out[3]: ('nth_algebraic', '2nd_power_series_ordinary', 'nth_algebraic_Integral')
In [4]: dsolve(eq, f(x))
---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)
<ipython-input-4-3a286ce8891f>in<module>---->1dsolve(eq, f(x))
~/current/sympy/sympy/sympy/solvers/ode/ode.pyindsolve(eq, func, hint, simplify, ics, xi, eta, x0, n, **kwargs)
637# The key 'hint' stores the hint needed to be solved for.638hint=hints['hint']
-->639return_helper_simplify(eq, hint, hints, simplify, ics=ics)
640641def_helper_simplify(eq, hint, match, simplify=True, ics=None, **kwargs):
~/current/sympy/sympy/sympy/solvers/ode/ode.pyin_helper_simplify(eq, hint, match, simplify, ics, **kwargs)
668sols=solvefunc.get_general_solution()
669else:
-->670sols=solvefunc(eq, func, order, match)
671ifiterable(sols):
672rv= [odesimp(eq, s, func, hint) forsinsols]
~/current/sympy/sympy/sympy/solvers/ode/ode.pyinode_2nd_power_series_ordinary(eq, func, order, match)
2391# Finding the recurrence relation in terms of the largest term.2392fargs=req.atoms(AppliedUndef)
->2393maxf=max(fargs, key=lambdax: x.args[0])
2394minf=min(fargs, key=lambdax: x.args[0])
2395ifminf.args[0].is_Symbol:
~/current/sympy/sympy/sympy/core/relational.pyin__bool__(self)
396397def__bool__(self):
-->398raiseTypeError("cannot determine truth value of Relational")
399400def_eval_as_set(self):
TypeError: cannotdeterminetruthvalueofRelational
There also seems to be a bug here in the 2nd_power_series_ordinary solver.
The text was updated successfully, but these errors were encountered:
CC @Mohitbalwani26
The ODE below should be easy for
dsolve
to solve using thenth_algebraic
hint. It doesn't work though becausedsolve
preprocesses the ODE and evaluates all the derivatives so thenth_algebraic
solver doesn't get to see the unevaluated derivative form that it knows how to solve. Althoughclassify_ode
saysnth_algebraic
can solve itdsolve
will not use thenth_algebraic
hint and then an exception is raised in the series solvers. The preprocessing indsolve
should be removed so thatnth_algebraic
can access the ODE in its original unprocessed form.There also seems to be a bug here in the
2nd_power_series_ordinary
solver.The text was updated successfully, but these errors were encountered: