Skip to content

Commit

Permalink
Merge pull request #1803 from Manoj-Kumar-S/1996_issue
Browse files Browse the repository at this point in the history
Incorrect Exception in dsolve() : First implementation
  • Loading branch information
asmeurer committed Feb 21, 2013
2 parents 892c29a + 742fb1e commit 06c919e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sympy/solvers/ode.py
Expand Up @@ -529,7 +529,12 @@ def dsolve(eq, func=None, hint="default", simplify=True, prep=True, **kwargs):

if not hints['default']:
# classify_ode will set hints['default'] to None if no hints match.
raise NotImplementedError("dsolve: Cannot solve " + str(eq))
if hint not in allhints and hint != 'default':
raise ValueError("Hint not recognized: " + hint)
elif hint not in hints['ordered_hints'] and hint != 'default':
raise ValueError("ODE " + str(eq) + " does not match hint " + hint)
else:
raise NotImplementedError("dsolve: Cannot solve " + str(eq))

if hint == 'default':
return dsolve(eq, func, hint=hints['default'], simplify=simplify,
Expand Down
5 changes: 5 additions & 0 deletions sympy/solvers/tests/test_ode.py
Expand Up @@ -1427,3 +1427,8 @@ def test_nth_order_linear_euler_eq_homogeneous():
assert our_hint in classify_ode(eq)
assert dsolve(eq, y(t), hint=our_hint).rhs in (sol, sols)
assert checkodesol(eq, sol, order=2, solve_for_func=False)[0]

def test_issue_1996():
f = Function('f')
raises(ValueError, lambda: dsolve(f(x).diff(x)**2, f(x), 'seperable'))
raises(ValueError, lambda: dsolve(f(x).diff(x)**2, f(x), 'fdsjf'))

0 comments on commit 06c919e

Please sign in to comment.