Skip to content

Commit e17f3df

Browse files
added simplify_flag as key and marked example 2 as checkodesol_xfail
1 parent e578d97 commit e17f3df

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sympy/solvers/ode/tests/test_single.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def _ode_solver_test(ode_examples, run_slow_test=False):
150150
'func': ode_examples['examples'][example].get('func',ode_examples['func']),
151151
'example_name': example,
152152
'slow': ode_examples['examples'][example].get('slow', False),
153+
'simplify_flag':ode_examples['examples'][example].get('simplify_flag',True),
153154
'checkodesol_XFAIL': ode_examples['examples'][example].get('checkodesol_XFAIL', False)
154155
}
155156
if (not run_slow_test) and temp['slow']:
@@ -160,7 +161,7 @@ def _ode_solver_test(ode_examples, run_slow_test=False):
160161
print(result['xpass_msg'])
161162

162163

163-
def _test_all_hints(runxfail=False):
164+
def test_all_hints(runxfail=False):
164165
all_hints = list(allhints)+["default"]
165166
all_examples = _get_all_examples()
166167

@@ -191,6 +192,7 @@ def _test_particular_example(our_hint, ode_example, solver_flag=False):
191192
xfail = our_hint in ode_example['XFAIL']
192193
func = ode_example['func']
193194
result = {'msg': '', 'xpass_msg': ''}
195+
simplify_flag=ode_example['simplify_flag']
194196
checkodesol_XFAIL = ode_example['checkodesol_XFAIL']
195197
xpass = True
196198
if solver_flag:
@@ -201,7 +203,7 @@ def _test_particular_example(our_hint, ode_example, solver_flag=False):
201203
if our_hint in classify_ode(eq, func):
202204
result['match_list'] = example
203205
try:
204-
dsolve_sol = dsolve(eq, func, hint=our_hint)
206+
dsolve_sol = dsolve(eq, func, simplify=simplify_flag,hint=our_hint)
205207

206208
except Exception as e:
207209
dsolve_sol = []
@@ -318,7 +320,7 @@ def test_nth_algebraic():
318320
_ode_solver_test(_get_examples_ode_sol_nth_algebraic())
319321

320322

321-
@slow
323+
# @slow
322324
def test_slow_examples_1st_exact():
323325
_ode_solver_test(_get_examples_ode_sol_1st_exact(), run_slow_test=True)
324326

@@ -1305,12 +1307,15 @@ def _get_examples_ode_sol_1st_exact():
13051307
'1st_exact_02': {
13061308
'eq': (2*x*f(x) + 1)/f(x) + (f(x) - x)/f(x)**2*f(x).diff(x),
13071309
'sol': [Eq(f(x), exp(C1 - x**2 + LambertW(-x*exp(-C1 + x**2))))],
1310+
'XFAIL': ['lie_group'], #It shows dsolve raises an exception: List index out of range for lie_group
13081311
'slow': True,
1312+
'checkodesol_XFAIL':True
13091313
},
13101314

13111315
'1st_exact_03': {
13121316
'eq': 2*x + f(x)*cos(x) + (2*f(x) + sin(x) - sin(f(x)))*f(x).diff(x),
13131317
'sol': [Eq(f(x)*sin(x) + cos(f(x)) + x**2 + f(x)**2, C1)],
1318+
'XFAIL': ['lie_group'], #It goes into infinite loop for lie_group.
13141319
'slow': True,
13151320
},
13161321

@@ -1323,9 +1328,8 @@ def _get_examples_ode_sol_1st_exact():
13231328
'1st_exact_05': {
13241329
'eq': 2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x),
13251330
'sol': [Eq(x**2*f(x) + f(x)**3/3, C1)],
1326-
# 'sol':[Eq(f(x), 2**Rational(1, 3)*(x**2/(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3) - 2**Rational(1, 3)*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)/2)), Eq(f(x), 2**Rational(1, 3)*(2*x**2/((-1 - sqrt(3)*I)*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)) + 2**Rational(1, 3)*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)/4 + 2**Rational(1, 3)*sqrt(3)*I*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)/4)),
1327-
# Eq(f(x), 2**Rational(1, 3)*(2*x**2/((-1 + sqrt(3)*I)*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)) + 2**Rational(1, 3)*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)/4 - 2**Rational(1, 3)*sqrt(3)*I*(-3*C1 + sqrt(9*C1**2 + 4*x**6))**Rational(1, 3)/4))],
13281331
'slow': True,
1332+
'simplify_flag':False
13291333
},
13301334
}
13311335
}
@@ -1340,6 +1344,7 @@ def _get_all_examples():
13401344
_get_examples_ode_sol_nth_algebraic(),
13411345
_get_examples_ode_sol_riccati(),
13421346
_get_examples_ode_sol_1st_linear(),
1347+
_get_examples_ode_sol_1st_exact(),
13431348
_get_examples_ode_sol_almost_linear(),
13441349
_get_examples_ode_sol_nth_order_reducible(),
13451350
_get_examples_ode_sol_nth_linear_undetermined_coefficients(),
@@ -1356,6 +1361,7 @@ def _get_all_examples():
13561361
'eq': solver['examples'][example]['eq'],
13571362
'sol': solver['examples'][example]['sol'],
13581363
'XFAIL': solver['examples'][example].get('XFAIL',[]),
1364+
'simplify_flag':solver['examples'][example].get('simplify_flag',True),
13591365
'checkodesol_XFAIL': solver['examples'][example].get('checkodesol_XFAIL', False),
13601366
'example_name': example,
13611367
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy