|
1 | 1 | from sympy import (acos, acosh, asinh, atan, cos, Derivative, diff,
|
2 |
| - Dummy, Eq, Ne, erfi, exp, Function, I, Integral, LambertW, log, O, pi, |
| 2 | + Dummy, Eq, Ne, exp, Function, I, Integral, LambertW, log, O, pi, |
3 | 3 | Rational, rootof, S, sin, sqrt, Subs, Symbol, tan, asin, sinh,
|
4 | 4 | Piecewise, symbols, Poly, sec, Ei, re, im, atan2, collect, hyper, simplify, integrate)
|
5 | 5 | from sympy.solvers.ode import (classify_ode,
|
@@ -1496,15 +1496,6 @@ def test_old_ode_tests():
|
1496 | 1496 | assert checkodesol(eq11, sol11, order=1, solve_for_func=False)[0]
|
1497 | 1497 |
|
1498 | 1498 |
|
1499 |
| -def test_1st_linear(): |
1500 |
| - # Type: first order linear form f'(x)+p(x)f(x)=q(x) |
1501 |
| - eq = Eq(f(x).diff(x) + x*f(x), x**2) |
1502 |
| - sol = Eq(f(x), (C1 + x*exp(x**2/2) |
1503 |
| - - sqrt(2)*sqrt(pi)*erfi(sqrt(2)*x/2)/2)*exp(-x**2/2)) |
1504 |
| - assert dsolve(eq, hint='1st_linear') == sol |
1505 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
1506 |
| - |
1507 |
| - |
1508 | 1499 | @slow
|
1509 | 1500 | def test_1st_exact1():
|
1510 | 1501 | # Type: Exact differential equation, p(x,f) + q(x,f)*f' == 0,
|
@@ -2565,52 +2556,6 @@ def test_nth_linear_constant_coeff_variation_of_parameters_simplify_False():
|
2565 | 2556 | assert checkodesol(eq, sol_simp, order=5, solve_for_func=False) == (True, 0)
|
2566 | 2557 |
|
2567 | 2558 |
|
2568 |
| -def test_Liouville_ODE(): |
2569 |
| - hint = 'Liouville' |
2570 |
| - # The first part here used to be test_ODE_1() from test_solvers.py |
2571 |
| - eq1 = diff(f(x), x)/x + diff(f(x), x, x)/2 - diff(f(x), x)**2/2 |
2572 |
| - eq1a = diff(x*exp(-f(x)), x, x) |
2573 |
| - # compare to test_unexpanded_Liouville_ODE() below |
2574 |
| - eq2 = (eq1*exp(-f(x))/exp(f(x))).expand() |
2575 |
| - eq3 = diff(f(x), x, x) + 1/f(x)*(diff(f(x), x))**2 + 1/x*diff(f(x), x) |
2576 |
| - eq4 = x*diff(f(x), x, x) + x/f(x)*diff(f(x), x)**2 + x*diff(f(x), x) |
2577 |
| - eq5 = Eq((x*exp(f(x))).diff(x, x), 0) |
2578 |
| - sol1 = Eq(f(x), log(x/(C1 + C2*x))) |
2579 |
| - sol1a = Eq(C1 + C2/x - exp(-f(x)), 0) |
2580 |
| - sol2 = sol1 |
2581 |
| - sol3 = set( |
2582 |
| - [Eq(f(x), -sqrt(C1 + C2*log(x))), |
2583 |
| - Eq(f(x), sqrt(C1 + C2*log(x)))]) |
2584 |
| - sol4 = set([Eq(f(x), sqrt(C1 + C2*exp(x))*exp(-x/2)), |
2585 |
| - Eq(f(x), -sqrt(C1 + C2*exp(x))*exp(-x/2))]) |
2586 |
| - sol5 = Eq(f(x), log(C1 + C2/x)) |
2587 |
| - sol1s = constant_renumber(sol1) |
2588 |
| - sol2s = constant_renumber(sol2) |
2589 |
| - sol3s = constant_renumber(sol3) |
2590 |
| - sol4s = constant_renumber(sol4) |
2591 |
| - sol5s = constant_renumber(sol5) |
2592 |
| - assert dsolve(eq1, hint=hint) in (sol1, sol1s) |
2593 |
| - assert dsolve(eq1a, hint=hint) in (sol1, sol1s) |
2594 |
| - assert dsolve(eq2, hint=hint) in (sol2, sol2s) |
2595 |
| - assert set(dsolve(eq3, hint=hint)) in (sol3, sol3s) |
2596 |
| - assert set(dsolve(eq4, hint=hint)) in (sol4, sol4s) |
2597 |
| - assert dsolve(eq5, hint=hint) in (sol5, sol5s) |
2598 |
| - assert checkodesol(eq1, sol1, order=2, solve_for_func=False)[0] |
2599 |
| - assert checkodesol(eq1a, sol1a, order=2, solve_for_func=False)[0] |
2600 |
| - assert checkodesol(eq2, sol2, order=2, solve_for_func=False)[0] |
2601 |
| - assert checkodesol(eq3, sol3, order=2, solve_for_func=False) == {(True, 0)} |
2602 |
| - assert checkodesol(eq4, sol4, order=2, solve_for_func=False) == {(True, 0)} |
2603 |
| - assert checkodesol(eq5, sol5, order=2, solve_for_func=False)[0] |
2604 |
| - not_Liouville1 = classify_ode(diff(f(x), x)/x + f(x)*diff(f(x), x, x)/2 - |
2605 |
| - diff(f(x), x)**2/2, f(x)) |
2606 |
| - not_Liouville2 = classify_ode(diff(f(x), x)/x + diff(f(x), x, x)/2 - |
2607 |
| - x*diff(f(x), x)**2/2, f(x)) |
2608 |
| - assert hint not in not_Liouville1 |
2609 |
| - assert hint not in not_Liouville2 |
2610 |
| - assert hint + '_Integral' not in not_Liouville1 |
2611 |
| - assert hint + '_Integral' not in not_Liouville2 |
2612 |
| - |
2613 |
| - |
2614 | 2559 | def test_unexpanded_Liouville_ODE():
|
2615 | 2560 | # This is the same as eq1 from test_Liouville_ODE() above.
|
2616 | 2561 | eq1 = diff(f(x), x)/x + diff(f(x), x, x)/2 - diff(f(x), x)**2/2
|
@@ -2686,43 +2631,6 @@ def test_issue_5095():
|
2686 | 2631 | raises(ValueError, lambda: dsolve(f(x).diff(x)**2, f(x), 'fdsjf'))
|
2687 | 2632 |
|
2688 | 2633 |
|
2689 |
| -def test_almost_linear(): |
2690 |
| - from sympy import Ei |
2691 |
| - A = Symbol('A', positive=True) |
2692 |
| - our_hint = 'almost_linear' |
2693 |
| - f = Function('f') |
2694 |
| - d = f(x).diff(x) |
2695 |
| - eq = x**2*f(x)**2*d + f(x)**3 + 1 |
2696 |
| - sol = dsolve(eq, f(x), hint = 'almost_linear') |
2697 |
| - assert sol[0].rhs == (C1*exp(3/x) - 1)**Rational(1, 3) |
2698 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
2699 |
| - |
2700 |
| - eq = x*f(x)*d + 2*x*f(x)**2 + 1 |
2701 |
| - sol = [ |
2702 |
| - Eq(f(x), -sqrt((C1 - 2*Ei(4*x))*exp(-4*x))), |
2703 |
| - Eq(f(x), sqrt((C1 - 2*Ei(4*x))*exp(-4*x))) |
2704 |
| - ] |
2705 |
| - assert set(dsolve(eq, f(x), hint = 'almost_linear')) == set(sol) |
2706 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
2707 |
| - |
2708 |
| - eq = x*d + x*f(x) + 1 |
2709 |
| - sol = dsolve(eq, f(x), hint = 'almost_linear') |
2710 |
| - assert sol.rhs == (C1 - Ei(x))*exp(-x) |
2711 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
2712 |
| - assert our_hint in classify_ode(eq, f(x)) |
2713 |
| - |
2714 |
| - eq = x*exp(f(x))*d + exp(f(x)) + 3*x |
2715 |
| - sol = dsolve(eq, f(x), hint = 'almost_linear') |
2716 |
| - assert sol.rhs == log(C1/x - x*Rational(3, 2)) |
2717 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
2718 |
| - |
2719 |
| - eq = x + A*(x + diff(f(x), x) + f(x)) + diff(f(x), x) + f(x) + 2 |
2720 |
| - sol = dsolve(eq, f(x), hint = 'almost_linear') |
2721 |
| - assert sol.rhs == (C1 + Piecewise( |
2722 |
| - (x, Eq(A + 1, 0)), ((-A*x + A - x - 1)*exp(x)/(A + 1), True)))*exp(-x) |
2723 |
| - assert checkodesol(eq, sol, order=1, solve_for_func=False)[0] |
2724 |
| - |
2725 |
| - |
2726 | 2634 | def test_exact_enhancement():
|
2727 | 2635 | f = Function('f')(x)
|
2728 | 2636 | df = Derivative(f, x)
|
|
0 commit comments