|
13 | 13 | _eqs2dict, _dict2graph)
|
14 | 14 | from sympy.functions import airyai, airybi
|
15 | 15 | from sympy.integrals.integrals import Integral
|
| 16 | +from sympy.simplify.ratsimp import ratsimp |
16 | 17 | from sympy.testing.pytest import ON_TRAVIS, raises, slow, skip, XFAIL
|
17 | 18 |
|
18 | 19 |
|
@@ -2173,60 +2174,22 @@ def test_dsolve():
|
2173 | 2174 | dsolve(eqs)
|
2174 | 2175 |
|
2175 | 2176 |
|
2176 |
| -def _higher_order_slow1(): |
| 2177 | +@slow |
| 2178 | +def test_higher_order1_slow1(): |
2177 | 2179 | x, y = symbols("x y", cls=Function)
|
2178 | 2180 | t = symbols("t")
|
2179 | 2181 |
|
2180 |
| - eq = (Eq(diff(x(t),t,t), (log(t)+t**2)*diff(x(t),t)+(log(t)+t**2)*3*diff(y(t),t)), Eq(diff(y(t),t,t), \ |
2181 |
| - (log(t)+t**2)*2*diff(x(t),t)+(log(t)+t**2)*9*diff(y(t),t))) |
2182 |
| - _x1 = log(t)**2 |
2183 |
| - _x2 = sqrt(22) |
2184 |
| - _x3 = sqrt(9*_x1 + t**4 + 6*t**2*log(t) - 6*t**2 - 18*log(t) + 9) |
2185 |
| - _x4 = 1/(-_x2*_x3*t/3 - 4*t**3/3 - 4*t*log(t) + 4*t) |
2186 |
| - _x5 = 1/(_x2*_x3*t/3 - 4*t**3/3 - 4*t*log(t) + 4*t) |
2187 |
| - _x6 = 1/(-_x4*t**3 - 3*_x4*t*log(t) + 3*_x4*t + _x5*t**3 + 3*_x5*t*log(t) - 3*_x5*t) |
2188 |
| - _x7 = exp(-_x2*_x3*t/3 + 5*t**3/3 + 5*t*log(t) - 5*t) |
2189 |
| - _x8 = exp(_x2*_x3*t/3 + 5*t**3/3 + 5*t*log(t) - 5*t) |
2190 |
| - _x9 = 1/(18*_x1*_x4*t**5 - 54*_x1*_x4*t**3 - 18*_x1*_x5*t**5 + 54*_x1*_x5*t**3 + 2*_x4*t**9/3 + 6*_x4*t**7*log(t) - |
2191 |
| - 6*_x4*t**7 - 36*_x4*t**5*log(t) + 18*_x4*t**5 + 18*_x4*t**3*log(t)**3 + 54*_x4*t**3*log(t) - 18*_x4*t**3 - |
2192 |
| - 2*_x5*t**9/3 - 6*_x5*t**7*log(t) + 6*_x5*t**7 + 36*_x5*t**5*log(t) - 18*_x5*t**5 - 18*_x5*t**3*log(t)**3 - |
2193 |
| - 54*_x5*t**3*log(t) + 18*_x5*t**3) |
2194 |
| - _x10 = -12*_x1*_x5*t**2 |
2195 |
| - _x11 = 24*_x5*t**2*log(t) |
2196 |
| - _x12 = 8*_x4*t**4*log(t) |
2197 |
| - _x13 = -24*_x4*t**2*log(t) |
2198 |
| - _x14 = -8*_x5*t**4*log(t) |
2199 |
| - _x15 = 1/(12*_x1*_x4*t**2 + _x10 + _x11 + _x12 + _x13 + _x14 + _x2*_x3*_x4*t**4/3 + _x2*_x3*_x4*t**2*log(t) - |
2200 |
| - _x2*_x3*_x4*t**2 - _x2*_x3*_x5*t**4/3 - _x2*_x3*_x5*t**2*log(t) + _x2*_x3*_x5*t**2 + 4*_x4*t**6/3 - |
2201 |
| - 8*_x4*t**4 + 12*_x4*t**2 - 4*_x5*t**6/3 + 8*_x5*t**4 - 12*_x5*t**2) |
2202 |
| - _x16 = 1/(12*_x1*_x4*t**2 + _x10 + _x11 + _x12 + _x13 + _x14 - _x2*_x3*_x4*t**4/3 - _x2*_x3*_x4*t**2*log(t) + |
2203 |
| - _x2*_x3*_x4*t**2 + _x2*_x3*_x5*t**4/3 + _x2*_x3*_x5*t**2*log(t) - _x2*_x3*_x5*t**2 + 4*_x4*t**6/3 - |
2204 |
| - 8*_x4*t**4 + 12*_x4*t**2 - 4*_x5*t**6/3 + 8*_x5*t**4 - 12*_x5*t**2) |
2205 |
| - _x17 = (t**3 + 3*t*log(t) - 3*t)**2 |
2206 |
| - sol = [ |
2207 |
| - Eq(x(t), C1 + Integral(-C2*_x15*_x8*t**3 - 3*C2*_x15*_x8*t*log(t) + 3*C2*_x15*_x8*t + C2*_x16*_x7*t**3 + |
2208 |
| - 3*C2*_x16*_x7*t*log(t) - 3*C2*_x16*_x7*t + C3*_x17*_x7*_x9 - C3*_x17*_x8*_x9, t)), |
2209 |
| - Eq(y(t), C4 + Integral(-C2*_x6*_x7 + C2*_x6*_x8 - C3*_x15*_x7*t**3 - 3*C3*_x15*_x7*t*log(t) + 3*C3*_x15*_x7*t + |
2210 |
| - C3*_x16*_x8*t**3 + 3*C3*_x16*_x8*t*log(t) - 3*C3*_x16*_x8*t, t)), |
| 2182 | + eq = [ |
| 2183 | + Eq(diff(x(t),t,t), (log(t)+t**2)*diff(x(t),t)+(log(t)+t**2)*3*diff(y(t),t)), |
| 2184 | + Eq(diff(y(t),t,t), (log(t)+t**2)*2*diff(x(t),t)+(log(t)+t**2)*9*diff(y(t),t)) |
2211 | 2185 | ]
|
2212 |
| - |
2213 |
| - return eq, sol |
2214 |
| - |
2215 |
| - |
2216 |
| -@slow |
2217 |
| -def test_higher_order_slow1(): |
2218 |
| - eq, sol = _higher_order_slow1() |
2219 |
| - |
2220 |
| - assert dsolve_system(eq, simplify=False, doit=False) == [sol] |
2221 |
| - |
2222 |
| - |
2223 |
| -@slow |
2224 |
| -def test_higher_order1_slow1_check(): |
2225 |
| - if ON_TRAVIS: |
2226 |
| - skip("Too slow for travis.") |
2227 |
| - |
2228 |
| - eq, sol = _higher_order_slow1() |
2229 |
| - assert checksysodesol(eq, sol) == (True, [0, 0]) |
| 2186 | + sol, = dsolve_system(eq, simplify=False, doit=False) |
| 2187 | + # The solution is too long to write out explicitly and checkodesol is too |
| 2188 | + # slow so we test for particular values of t: |
| 2189 | + for e in eq: |
| 2190 | + res = (e.lhs - e.rhs).subs({sol[0].lhs:sol[0].rhs, sol[1].lhs:sol[1].rhs}) |
| 2191 | + res = res.subs({d: d.doit(deep=False) for d in res.atoms(Derivative)}) |
| 2192 | + assert ratsimp(res.subs(t, 1)) == 0 |
2230 | 2193 |
|
2231 | 2194 |
|
2232 | 2195 | @slow
|
|
0 commit comments