Skip to content

Commit d18e2a2

Browse files
added test_issues of 1st exact
1 parent f885d0c commit d18e2a2

File tree

2 files changed

+26
-31
lines changed

2 files changed

+26
-31
lines changed

sympy/solvers/ode/tests/test_ode.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,18 +2342,6 @@ def test_issue_10867():
23422342
assert checkodesol(eq, sol, order=2, solve_for_func=False) == (True, 0)
23432343

23442344

2345-
def test_issue_11290():
2346-
eq = cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x)
2347-
sol_1 = dsolve(eq, f(x), simplify=False, hint='1st_exact_Integral')
2348-
sol_0 = dsolve(eq, f(x), simplify=False, hint='1st_exact')
2349-
assert sol_1.dummy_eq(Eq(Subs(
2350-
Integral(u**2 - x*sin(u) - Integral(-sin(u), x), u) +
2351-
Integral(cos(u), x), u, f(x)), C1))
2352-
assert sol_1.doit() == sol_0
2353-
assert checkodesol(eq, sol_0, order=1, solve_for_func=False)
2354-
assert checkodesol(eq, sol_1, order=1, solve_for_func=False)
2355-
2356-
23572345
def test_issue_4838():
23582346
# Issue #15999
23592347
eq = f(x).diff(x) - C1*f(x)
@@ -2542,21 +2530,3 @@ def test_issue_18408():
25422530
sol = Eq(f(x), C1 + C3*exp(-x) + x*sinh(x)/2 + (C2 + x/2)*exp(x))
25432531
assert sol == dsolve(eq, hint='nth_linear_constant_coeff_undetermined_coefficients')
25442532
assert checkodesol(eq, sol) == (True, 0)
2545-
2546-
2547-
def test_issue_9446():
2548-
f = Function('f')
2549-
assert dsolve(Eq(f(2 * x), sin(Derivative(f(x)))), f(x)) == \
2550-
[Eq(f(x), C1 + pi*x - Integral(asin(f(2*x)), x)), Eq(f(x), C1 + Integral(asin(f(2*x)), x))]
2551-
2552-
assert integrate(-asin(f(2*x)+pi), x) == -Integral(asin(pi + f(2*x)), x)
2553-
2554-
def test_issue_20192():
2555-
# kamke ode 1.1
2556-
a0,a1,a2,a3,a4 = symbols('a0, a1, a2, a3, a4')
2557-
2558-
eq = f(x).diff(x)-(a4*x**4 + a3*x**3 + a2*x**2 + a1*x + a0)**(-1/2)
2559-
sol = Eq(f(x), C1 + Integral(1/sqrt(a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4), x))
2560-
2561-
assert sol == dsolve(eq,hint='factorable')
2562-
assert checkodesol(eq, sol) == (True, 0)

sympy/solvers/ode/tests/test_single.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
3434
"""
3535
from sympy import (acos, asin, atan, cos, Derivative, Dummy, diff,
36-
E, Eq, exp, I, LambertW, log, pi, Piecewise, Rational, S, sin, sinh, tan,
36+
E, Eq, exp, I, Integral, integrate, LambertW, log, pi, Piecewise, Rational, S, sin, sinh, tan,
3737
sqrt, symbols, Ei, erfi)
3838

3939
from sympy.core import Function, Symbol
@@ -322,6 +322,9 @@ def test_nth_algebraic():
322322

323323
@slow
324324
def test_slow_examples_1st_exact():
325+
eq = cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x)
326+
sol_1 = dsolve(eq, f(x), simplify=False, hint='1st_exact_Integral')
327+
assert checkodesol(eq, sol_1, order=1, solve_for_func=False)
325328
_ode_solver_test(_get_examples_ode_sol_1st_exact(), run_slow_test=True)
326329

327330

@@ -364,6 +367,7 @@ def test_separable():
364367

365368

366369
def test_factorable():
370+
assert integrate(-asin(f(2*x)+pi), x) == -Integral(asin(pi + f(2*x)), x)
367371
_ode_solver_test(_get_examples_ode_sol_factorable())
368372

369373

@@ -608,6 +612,7 @@ def _get_examples_ode_sol_factorable():
608612
nth_linear_constant_coeff_undetermined_coefficients"""
609613

610614
y = Dummy('y')
615+
a0,a1,a2,a3,a4 = symbols('a0, a1, a2, a3, a4')
611616
return {
612617
'hint': "factorable",
613618
'func': f(x),
@@ -710,6 +715,19 @@ def _get_examples_ode_sol_factorable():
710715
'eq': f(x).diff(x)**2 - f(x)**3,
711716
'sol': [Eq(f(x), 4/(C1**2 - 2*C1*x + x**2))]
712717
},
718+
719+
# kamke ode 1.1
720+
'fact_17': {
721+
'eq': f(x).diff(x)-(a4*x**4 + a3*x**3 + a2*x**2 + a1*x + a0)**(-1/2),
722+
'sol': [Eq(f(x), C1 + Integral(1/sqrt(a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4), x))]
723+
},
724+
725+
# This is from issue: https://github.com/sympy/sympy/issues/9446
726+
'fact_18':{
727+
'eq': Eq(f(2 * x), sin(Derivative(f(x)))),
728+
'sol': [Eq(f(x), C1 + pi*x - Integral(asin(f(2*x)), x)), Eq(f(x), C1 + Integral(asin(f(2*x)), x))],
729+
'checkodesol_XFAIL':True
730+
},
713731
}
714732
}
715733

@@ -1331,6 +1349,13 @@ def _get_examples_ode_sol_1st_exact():
13311349
'slow': True,
13321350
'simplify_flag':False
13331351
},
1352+
1353+
# This was from issue: https://github.com/sympy/sympy/issues/11290
1354+
'1st_exact_06': {
1355+
'eq': cos(f(x)) - (x*sin(f(x)) - f(x)**2)*f(x).diff(x),
1356+
'sol': [Eq(x*cos(f(x)) + f(x)**3/3, C1)],
1357+
'simplify_flag':False
1358+
},
13341359
}
13351360
}
13361361

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