Skip to content
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

Improve dsolve #21743

Merged
merged 11 commits into from
Jul 22, 2021
2 changes: 1 addition & 1 deletion sympy/solvers/ode/ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ class in it. Note that a hint may do this anyway if
raise ValueError("Enter boundary conditions of the form ics={f(point): value, f(x).diff(x, order).subs(x, point): value}")

ode = SingleODEProblem(eq_orig, func, x, prep=prep, xi=xi, eta=eta)
user_hint = kwargs.get('hint','default')
user_hint = kwargs.get('hint', 'default')
# Used when dsolve is called without an explicit hint.
# We exit early to return the first valid match
early_exit = (user_hint=='default')
Expand Down
5 changes: 5 additions & 0 deletions sympy/solvers/ode/tests/test_ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ def test_classify_ode():
('1st_power_series', 'lie_group')
assert isinstance(classify_ode(Eq(f(x), 5), f(x), dict=True), dict)

#This is for new behavior of classify_ode when called internally with default, It should
# return the first hint which matches therefore, 'ordered_hints' key will not be there.
assert classify_ode(Eq(f(x).diff(x), 0), f(x),dict=True).get('ordered_hints') == None
assert classify_ode(Eq(f(x).diff(x), 0), f(x),dict=True).get('default') == 'nth_algebraic'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space after a comma.

Why doesn't this assert what the actual output of classify_ode is?

Also is the behaviour changed in cases where a hint is specified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this assert what the actual output of classify_ode is?

ok, will change it to that.

Also is the behaviour changed in cases where a hint is specified?

Earlier classify_ode didn't take hint as argument but now it has so if we pass specific hint it will return solver for that and also checks for the series solution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the output of this test is something like:

{'order': 1,
 'nth_algebraic': <sympy.solvers.ode.single.NthAlgebraic at 0x7f94c63cc160>,
 'nth_algebraic_Integral': <sympy.solvers.ode.single.NthAlgebraic at 0x7f94c63cc160>,
 'default': 'nth_algebraic'}

so how should we check with assert?



def test_classify_ode_ics():
# Dummy
Expand Down