Skip to content

Commit c345886

Browse files
added dsolve_too_slow flag to skip on travis
1 parent 000e7e0 commit c345886

File tree

2 files changed

+46
-59
lines changed

2 files changed

+46
-59
lines changed

sympy/solvers/ode/tests/test_ode.py

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sympy import (acos, acosh, asinh, atan, cos, Derivative, diff,
1+
from sympy import (acos, acosh, atan, cos, Derivative, diff,
22
Dummy, Eq, Ne, exp, Function, I, Integral, LambertW, log, O, pi,
33
Rational, rootof, S, sin, sqrt, Subs, Symbol, tan, asin, sinh,
44
Piecewise, symbols, Poly, sec, re, im, atan2, collect, hyper)
@@ -813,50 +813,6 @@ def test_old_ode_tests():
813813
assert checkodesol(eq11, sol11, order=1, solve_for_func=False)[0]
814814

815815

816-
@slow
817-
@XFAIL
818-
def test_1st_exact2_broken():
819-
"""
820-
This is an exact equation that fails under the exact engine. It is caught
821-
by first order homogeneous albeit with a much contorted solution. The
822-
exact engine fails because of a poorly simplified integral of q(0,y)dy,
823-
where q is the function multiplying f'. The solutions should be
824-
Eq(sqrt(x**2+f(x)**2)**3+y**3, C1). The equation below is
825-
equivalent, but it is so complex that checkodesol fails, and takes a long
826-
time to do so.
827-
"""
828-
if ON_TRAVIS:
829-
skip("Too slow for travis.")
830-
eq = (x*sqrt(x**2 + f(x)**2) - (x**2*f(x)/(f(x) -
831-
sqrt(x**2 + f(x)**2)))*f(x).diff(x))
832-
sol = Eq(log(x),
833-
C1 - 9*sqrt(1 + f(x)**2/x**2)*asinh(f(x)/x)/(-27*f(x)/x +
834-
27*sqrt(1 + f(x)**2/x**2)) - 9*sqrt(1 + f(x)**2/x**2)*
835-
log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
836-
(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2)) +
837-
9*asinh(f(x)/x)*f(x)/(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))) +
838-
9*f(x)*log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
839-
(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))))
840-
assert dsolve(eq) == sol # Slow
841-
# FIXME: Checked in test_1st_exact2_broken_check below
842-
843-
844-
@slow
845-
def test_1st_exact2_broken_check():
846-
# See test_1st_exact2_broken above
847-
eq = (x*sqrt(x**2 + f(x)**2) - (x**2*f(x)/(f(x) -
848-
sqrt(x**2 + f(x)**2)))*f(x).diff(x))
849-
sol = Eq(log(x),
850-
C1 - 9*sqrt(1 + f(x)**2/x**2)*asinh(f(x)/x)/(-27*f(x)/x +
851-
27*sqrt(1 + f(x)**2/x**2)) - 9*sqrt(1 + f(x)**2/x**2)*
852-
log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
853-
(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2)) +
854-
9*asinh(f(x)/x)*f(x)/(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))) +
855-
9*f(x)*log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
856-
(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))))
857-
assert checkodesol(eq, sol, order=1, solve_for_func=False)[0]
858-
859-
860816
def test_homogeneous_order():
861817
assert homogeneous_order(exp(y/x) + tan(y/x), x, y) == 0
862818
assert homogeneous_order(x**2 + sin(x)*cos(y), x, y) is None

sympy/solvers/ode/tests/test_single.py

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
ODEs which raises exception.
3333
3434
"""
35-
from sympy import (acos, asin, atan, cos, Derivative, Dummy, diff,
35+
from sympy import (acos, asin, asinh, atan, cos, Derivative, Dummy, diff,
3636
E, Eq, exp, I, Integral, integrate, LambertW, log, pi, Piecewise, Rational, S, sin, sinh, tan,
3737
sqrt, symbols, Ei, erfi)
3838

@@ -46,7 +46,7 @@
4646

4747
from sympy.solvers.ode.subscheck import checkodesol
4848

49-
from sympy.testing.pytest import raises, slow
49+
from sympy.testing.pytest import raises, slow, ON_TRAVIS
5050
import traceback
5151

5252

@@ -151,7 +151,9 @@ def _ode_solver_test(ode_examples, run_slow_test=False):
151151
'example_name': example,
152152
'slow': ode_examples['examples'][example].get('slow', False),
153153
'simplify_flag':ode_examples['examples'][example].get('simplify_flag',True),
154-
'checkodesol_XFAIL': ode_examples['examples'][example].get('checkodesol_XFAIL', False)
154+
'checkodesol_XFAIL': ode_examples['examples'][example].get('checkodesol_XFAIL', False),
155+
'dsolve_too_slow':ode_examples['examples'][example].get('dsolve_too_slow',False),
156+
'checkodesol_too_slow':ode_examples['examples'][example].get('checkodesol_too_slow',False),
155157
}
156158
if (not run_slow_test) and temp['slow']:
157159
continue
@@ -194,6 +196,8 @@ def _test_particular_example(our_hint, ode_example, solver_flag=False):
194196
result = {'msg': '', 'xpass_msg': ''}
195197
simplify_flag=ode_example['simplify_flag']
196198
checkodesol_XFAIL = ode_example['checkodesol_XFAIL']
199+
dsolve_too_slow = ode_example['dsolve_too_slow']
200+
checkodesol_too_slow = ode_example['checkodesol_too_slow']
197201
xpass = True
198202
if solver_flag:
199203
if our_hint not in classify_ode(eq, func):
@@ -203,7 +207,10 @@ def _test_particular_example(our_hint, ode_example, solver_flag=False):
203207
if our_hint in classify_ode(eq, func):
204208
result['match_list'] = example
205209
try:
206-
dsolve_sol = dsolve(eq, func, simplify=simplify_flag,hint=our_hint)
210+
if not (dsolve_too_slow and ON_TRAVIS):
211+
dsolve_sol = dsolve(eq, func, simplify=simplify_flag,hint=our_hint)
212+
else:
213+
dsolve_sol = expected_sol
207214

208215
except Exception as e:
209216
dsolve_sol = []
@@ -237,16 +244,17 @@ def _test_particular_example(our_hint, ode_example, solver_flag=False):
237244
if len(expected_sol) == 1:
238245
expected_checkodesol = (True, 0)
239246

240-
if not checkodesol_XFAIL:
241-
if checkodesol(eq, dsolve_sol, solve_for_func=False) != expected_checkodesol:
242-
result['unsolve_list'] = example
243-
xpass = False
244-
message = dsol_incorrect_msg.format(hint=our_hint, eq=eq, sol=expected_sol,dsolve_sol=dsolve_sol)
245-
if solver_flag:
246-
message = checkodesol_msg.format(example=example, eq=eq)
247-
raise AssertionError(message)
248-
else:
249-
result['msg'] = 'AssertionError: ' + message
247+
if not (checkodesol_too_slow and ON_TRAVIS):
248+
if not checkodesol_XFAIL:
249+
if checkodesol(eq, dsolve_sol, solve_for_func=False) != expected_checkodesol:
250+
result['unsolve_list'] = example
251+
xpass = False
252+
message = dsol_incorrect_msg.format(hint=our_hint, eq=eq, sol=expected_sol,dsolve_sol=dsolve_sol)
253+
if solver_flag:
254+
message = checkodesol_msg.format(example=example, eq=eq)
255+
raise AssertionError(message)
256+
else:
257+
result['msg'] = 'AssertionError: ' + message
250258

251259
if xpass and xfail:
252260
result['xpass_msg'] = example + "is now passing for the hint" + our_hint
@@ -1312,6 +1320,15 @@ def _get_examples_ode_sol_separable():
13121320
def _get_examples_ode_sol_1st_exact():
13131321
# Type: Exact differential equation, p(x,f) + q(x,f)*f' == 0,
13141322
# where dp/df == dq/dx
1323+
'''
1324+
Example 7 is an exact equation that fails under the exact engine. It is caught
1325+
by first order homogeneous albeit with a much contorted solution. The
1326+
exact engine fails because of a poorly simplified integral of q(0,y)dy,
1327+
where q is the function multiplying f'. The solutions should be
1328+
Eq(sqrt(x**2+f(x)**2)**3+y**3, C1). The equation below is
1329+
equivalent, but it is so complex that checkodesol fails, and takes a long
1330+
time to do so.
1331+
'''
13151332
return {
13161333
'hint': "1st_exact",
13171334
'func': f(x),
@@ -1356,6 +1373,20 @@ def _get_examples_ode_sol_1st_exact():
13561373
'sol': [Eq(x*cos(f(x)) + f(x)**3/3, C1)],
13571374
'simplify_flag':False
13581375
},
1376+
1377+
'1st_exact_07': {
1378+
'eq': x*sqrt(x**2 + f(x)**2) - (x**2*f(x)/(f(x) - sqrt(x**2 + f(x)**2)))*f(x).diff(x),
1379+
'sol': [Eq(log(x),
1380+
C1 - 9*sqrt(1 + f(x)**2/x**2)*asinh(f(x)/x)/(-27*f(x)/x +
1381+
27*sqrt(1 + f(x)**2/x**2)) - 9*sqrt(1 + f(x)**2/x**2)*
1382+
log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
1383+
(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2)) +
1384+
9*asinh(f(x)/x)*f(x)/(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))) +
1385+
9*f(x)*log(1 - sqrt(1 + f(x)**2/x**2)*f(x)/x + 2*f(x)**2/x**2)/
1386+
(x*(-27*f(x)/x + 27*sqrt(1 + f(x)**2/x**2))))],
1387+
'slow': True,
1388+
'dsolve_too_slow':True
1389+
},
13591390
}
13601391
}
13611392

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