New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd-order ODE with irrational coefficient fails #15311

Closed
cbm755 opened this Issue Sep 30, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@cbm755
Copy link
Contributor

cbm755 commented Sep 30, 2018

Consider the 3rd-oder constant coefficient homogeneous ODE:

>>> f = Function('f')(x)
>>> eqn = Eq(sqrt(2) * f.diff(x,x,x) + f.diff(x), 0)

                3          
d              d           
──(f(x)) +2⋅───(f(x)) = 0
dx              3          
              dx           

Try to solve:

>>> dsolve(eqn)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-7-caee5fa81e82> in <module>()
----> 1 dsolve(eqn)

~/src/sympy.git/sympy/solvers/ode.py in dsolve(eq, func, hint, simplify, ics, xi, eta, x0, n, **kwargs)
    662             # The key 'hint' stores the hint needed to be solved for.
    663             hint = hints['hint']
--> 664             return _helper_simplify(eq, hint, hints, simplify, ics=ics)
    665 
    666 def _helper_simplify(eq, hint, match, simplify=True, ics=None, **kwargs):

~/src/sympy.git/sympy/solvers/ode.py in _helper_simplify(eq, hint, match, simplify, ics, **kwargs)
    687         # attempt to solve for func, and apply any other hint specific
    688         # simplifications
--> 689         sols = solvefunc(eq, func, order, match)
    690         if isinstance(sols, Expr):
    691             rv =  odesimp(sols, func, order, cons(sols), hint)

~/src/sympy.git/sympy/solvers/ode.py in ode_nth_linear_constant_coeff_homogeneous(eq, func, order, match, returns)
   4737 
   4738     chareq = Poly(chareq, symbol)
-> 4739     chareqroots = [rootof(chareq, k) for k in range(chareq.degree())]
   4740     chareq_is_complex = not all([i.is_real for i in chareq.all_coeffs()])
   4741 

~/src/sympy.git/sympy/solvers/ode.py in <listcomp>(.0)
   4737 
   4738     chareq = Poly(chareq, symbol)
-> 4739     chareqroots = [rootof(chareq, k) for k in range(chareq.degree())]
   4740     chareq_is_complex = not all([i.is_real for i in chareq.all_coeffs()])
   4741 

~/src/sympy.git/sympy/polys/rootoftools.py in rootof(f, x, index, radicals, expand)
    153              Expand ``f``.
    154     """
--> 155     return CRootOf(f, x, index=index, radicals=radicals, expand=expand)
    156 
    157 

~/src/sympy.git/sympy/polys/rootoftools.py in __new__(cls, f, x, index, radicals, expand)
    332 
    333         if not dom.is_ZZ:
--> 334             raise NotImplementedError("CRootOf is not supported over %s" % dom)
    335 
    336         root = cls._indexed_root(poly, index)

NotImplementedError: CRootOf is not supported over EX

It's fine with Rational(3,2). But similar failures for I, pi and radicals.

Perhaps it would be be enough to specify the domain of that Poly as Complex.

@oscarbenjamin

This comment has been minimized.

Copy link
Contributor

oscarbenjamin commented Oct 20, 2018

I've added a PR for this in #15408

skirpichev added a commit to skirpichev/diofant that referenced this issue Oct 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment