Fix typo in display-html-help
[maxima.git] / share / contrib / diffequations / tests / rtestode_kamke_1_1.mac
blob3c1e43c075e9adf4a6e6c8deb3361e08221e0f2d
1 (load("contrib_ode"),0);
2 0$
4 /* ODE tests - Equations 1-100
6   Reference:
7     E Kamke, Differentialgleichungen Losungsmethoden und Losungen, 
8     Vol 1, Geest & Portig, Leipzig, 1961
10     E. S. Cheb-Terrab, T. Koloknikov,  First Order ODEs, 
11     Symmetries and Linear Transformations, European Journal of 
12     Applied Mathematics, Vol. 14, No. 2, pp. 231-246 (2003). 
13     (http://lie.uwaterloo.ca/papers/ode_iv.pdf)
15 /* Don't kill(all); It messes up trigsimp */
17 /* Print ode number*/
18 (pn_(n_):=print("Kamke ODE 1.",n_),true);
19 true;
21 /*   1 */
22 (pn_(1),ans:contrib_ode(eqn:'diff(y,x)-(a4*x^4+a3*x^3+a2*x^2+a1*x+a0)^(-1/2),y,x));
23 [y = 'integrate(1/sqrt(a4*x^4+a3*x^3+a2*x^2+a1*x+a0),x)+%c];
24 [method,ode_check(eqn,ans[1])];
25 [linear,0];
27 /* 2 */
28 (pn_(2),ans:contrib_ode(eqn:'diff(y,x)+a*y-c*exp(b*x),y,x));
29 [y = %e^-(a*x)*(c*%e^(b*x+a*x)/(b+a)+%c)];
30 [method,ode_check(eqn,ans[1])];
31 [linear,0];
33 /* 3 */
34 (pn_(3),ans:contrib_ode(eqn:'diff(y,x)+a*y-b*sin(c*x),y,x));
35 [y=%e^-(a*x)*(b*%e^(a*x)*(a*sin(c*x)-c*cos(c*x))/(c^2+a^2)+%c)];
36 [method,ode_check(eqn,ans[1])];
37 [linear,0];
39 /* 4 */
40 (pn_(4),ans:contrib_ode(eqn:'diff(y,x)+2*x*y-x*exp(-x^2),y,x));
41 [y=(x^2/2+%c)*%e^-x^2];
42 [method,ode_check(eqn,ans[1])];
43 [linear,0];
45 /* 5 */
46 (pn_(5),ans:contrib_ode(eqn:'diff(y,x)+y*cos(x)-exp(2*x),y,x));
47 [y=%e^-sin(x)*('integrate(%e^(sin(x)+2*x),x)+%c)];
48 [method,ode_check(eqn,ans[1])];
49 [linear,0];
51 /* 6 */
52 (pn_(6),ans:contrib_ode(eqn:'diff(y,x)+y*cos(x)-sin(2*x)/2,y,x));
53 [y=%e^-sin(x)*((sin(x)-1)*%e^sin(x)+%c)];
54 [method,ode_check(eqn,ans[1])];
55 [linear,0];
57 /* 7 */
58 (pn_(7),ans:contrib_ode(eqn:'diff(y,x)+y*cos(x)-exp(-sin(x)),y,x));
59 [y = (x+%c)*%e^-sin(x)];
60 [method,ode_check(eqn,ans[1])];
61 [linear,0];
63 /* 8 */
64 (pn_(8),ans:contrib_ode(eqn: 'diff(y,x) + y*tan(x) - sin(2*x),y,x));
65 [y = (%c-2*cos(x))/sec(x)];
66 [method,ode_check(eqn,ans[1])];
67 [linear,0];
69 /* 9 */
70 (pn_(9),ans:contrib_ode(eqn:'diff(y,x)-(sin(log(x))+cos(log(x))+a)*y,y,x));
71 [y=%c*%e^(x*(sin(log(x))+cos(log(x)))/2+x*(sin(log(x))-cos(log(x)))/2+a*x)];
72 [method,ode_check(eqn,ans[1])];
73 [linear,0];
75 /* 10 */
76 (pn_(10),ans:contrib_ode(eqn: 'diff(y,x) + 'diff(f(x),x)*y - f(x)*'diff(f(x),x),y,x));
77 [y=%e^-f(x)*('integrate(f(x)*%e^f(x)*'diff(f(x),x,1),x)+%c)];
78 [method,ode_check(eqn,ans[1])];
79 [linear,0];
81 /* 11 */
82 (pn_(11),ans:contrib_ode(eqn: 'diff(y,x)  + f(x)*y - g(x),y,x));
83 [y = %e^-('integrate(f(x),x))*('integrate(g(x)*%e^'integrate(f(x),x),x)+%c)];
84 [method,ode_check(eqn,ans[1])];
85 [linear,0];
87 /* 12 */
88 (pn_(12),ans:contrib_ode(eqn:'diff(y,x) + y^2 - 1,y,x));
89 [(log(y+1)-log(y-1))/2=x+%c];
90 solve(map(exp,2*ans[1]),y);
91 [y = (%e^(2*x+2*%c)+1)/(%e^(2*x+2*%c)-1)];
92 [method,ode_check(eqn,%[1])];
93 [separable,0];
95 /* 13 - Riccati eqn */
96 (pn_(13),ans:contrib_ode(eqn:'diff(y,x) + y^2 - a*x - b,y,x),0);
99 [y = -(((-bessel_y(1/3,2*%i*(a*x+b)^(3/2)/(3*a))*%c
100         -bessel_j(1/3,2*%i*(a*x+b)^(3/2)/(3*a)))*a*sqrt(a*x+b)
101    +%i*((bessel_y(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
102         -bessel_y(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*%c
103         +bessel_j(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
104         -bessel_j(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*a^2*x^2
105  +%i*((2*bessel_y(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
106       -2*bessel_y(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*%c
107       +2*bessel_j(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
108       -2*bessel_j(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*a*b*x
109    +%i*((bessel_y(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
110         -bessel_y(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*%c
111         +bessel_j(4/3,2*%i*(a*x+b)^(3/2)/(3*a))
112         -bessel_j(-(2/3),2*%i*(a*x+b)^(3/2)/(3*a)))*b^2)
113     /((2*bessel_y(1/3,2*%i*(a*x+b)^(3/2)/(3*a))*%c
114       +2*bessel_j(1/3,2*%i*(a*x+b)^(3/2)/(3*a)))*a*x*sqrt(a*x+b)
115      +(2*bessel_y(1/3,2*%i*(a*x+b)^(3/2)/(3*a))*%c
116       +2*bessel_j(1/3,2*%i*(a*x+b)^(3/2)/(3*a)))*b*sqrt(a*x+b)))];
117  */
118 /* FIXME: bind stack overflow when checking 2015-04-06
119 [method,ode_check(eqn,ans[1])];
120 [riccati,0];
123 /* 14 - The constraints need some work 
124          want m # -2, rather than m > -2 */
125 assume(m>-2,a>0);
126 [m>-2,a>0];
127 (pn_("14i"),ans:contrib_ode(eqn: 'diff(y,x) + y^2 + a*x^m,y,x),0);
130 [y = -((sqrt(a)*(bessel_j((m+3)/(m+2),2*sqrt(a)*x^(m/2+1)/(m+2))
131             -%c*bessel_j(-((m+3)/(m+2)),2*sqrt(a)*x^(m/2+1)/(m+2))
132             +%c*bessel_j((m+1)/(m+2),2*sqrt(a)*x^(m/2+1)/(m+2))
133                -bessel_j(-((m+1)/(m+2)),2*sqrt(a)*x^(m/2+1)/(m+2)))*x^(m/2+1)
134                -bessel_j(1/(m+2),2*sqrt(a)*x^(m/2+1)/(m+2))
135             -%c*bessel_j(-(1/(m+2)),2*sqrt(a)*x^(m/2+1)/(m+2)))
136           /((2*bessel_j(1/(m+2),2*sqrt(a)*x^(m/2+1)/(m+2))
137          +2*%c*bessel_j(-(1/(m+2)),2*sqrt(a)*x^(m/2+1)/(m+2)))*x))];
138  */
139 [method,ratsimp(ode_check(eqn,ans[1]))];
140 [riccati,0];
141 forget(m>-2,a>0);
142 [m>-2,a>0];
144 assume(m>-2,a<0);
145 [m>-2,a<0];
146 (pn_("14ii"),ans:contrib_ode(eqn: 'diff(y,x) + y^2 + a*x^m,y,x),0);
149  [y = -(sqrt(-a)*(%c*bessel_k((m+1)/(m+2),2*sqrt(-a)*x^(m/2+1)/(m+2))-bessel_i(-((m+1)/(m+2)),2*sqrt(-a)*x^(m/2+1)/(m+2)))*x^(m/2)/(%c*bessel_k(1/(m+2),2*sqrt(-a)*x^(m/2+1)/(m+2))+bessel_i(1/(m+2),2*sqrt(-a)*x^(m/2+1)/(m+2))))];
150  */
151 [method,ratsimp(ode_check(eqn,ans[1]))];
152 [riccati,0];
153 forget(m>-2,a<0);
154 [m>-2,a<0];
156 (m:-2,assume(a > 1/4));
157 [a>1/4];
158 (pn_("14iii"),ans:contrib_ode(eqn: 'diff(y,x) + y^2 + a*x^m,y,x));
159 [ x = %c*%e^-(2*atan((2*x*y-1)/sqrt(4*a-1))/sqrt(4*a-1))];
160 solve(map(log,ans[1]/%c),y);
161 [y = -((sqrt(4*a-1)*tan(sqrt(4*a-1)*log(x/%c)/2)-1)/(2*x))];
162 [method,ode_check(eqn,%[1])];
163 [genhom,0];
164 (kill(m),forget(a > 1/4));
165 [a>1/4];
167 (m:-2,assume(a < 1/4));
168 [a < 1/4];
169 (pn_("14iv"),ans:contrib_ode(eqn: 'diff(y,x) + y^2 + a*x^m,y,x));
170 [x=%c*%e^-(log(-((-2*x*y+sqrt(1-4*a)+1)/(2*x*y+sqrt(1-4*a)-1)))/sqrt(1-4*a))];
171 solve(map(log,ans[1]/%c),y);
172 [y = ((sqrt(1-4*a)+1)*%e^(sqrt(1-4*a)*log(x/%c))+sqrt(1-4*a)-1)/(2*x*%e^(sqrt(1-4*a)*log(x/%c))-2*x)];
173 [method,ode_check(eqn,%[1])];
174 [genhom,0];  
175 (kill(m),forget(a < 1/4));
176 [a < 1/4];
178 /* 15 This is a Riccati eqn */
179 (pn_(15),ans:contrib_ode(eqn:'diff(y,x) + y^2 - 2*x^2*y + x^4 -2*x-1,y,x));
180  [y = (x^2*(%c*%e^(2*x)+1)+%c*%e^(2*x)-1)/(%c*%e^(2*x)+1)];
181 [method,ode_check(eqn,ans[1])];
182 [riccati,0];
184 /* 16 This is a Riccati eqn */
185 (pn_(16),ans:contrib_ode(eqn:'diff(y,x) + y^2 +(x*y-1)*f(x),y,x));
186 [[y='diff(%u,x,1)/%u,-'diff(%u,x,1)*x*f(x)+%u*f(x)-'diff(%u,x,2)=0]];
187 method;
188 riccati;
190 /* 17 */
191 (pn_(17),ans:contrib_ode(eqn:'diff(y,x) - y^2 -3*y + 4,y,x));
192 [-((log(y+4)-log(y-1))/5) = x+%c];
193 solve(map(exp,ans[1]*5),y);
194 [y = -((4*%e^(5*x+5*%c)+1)/(%e^(5*x+5*%c)-1))];
195 [method,ode_check(eqn,%[1])];
196 [separable,0];
198 /* 18 */
199 (pn_(18),ans:contrib_ode(eqn:'diff(y,x)-y^2-x*y-x+1,y,x),0);
202 [y = -(%e^-(2*x)*(%e^(2*x)*(sqrt(2)*sqrt(%pi)*%c
203                                          *erf((%i*x-2*%i)/sqrt(2))
204                                  +sqrt(2)*%e^2*sqrt(%pi))
205                        +2*%i*%c*%e^(x^2/2+2))
206  /(sqrt(2)*sqrt(%pi)*%c*erf((%i*x-2*%i)/sqrt(2))+sqrt(2)*%e^2*sqrt(%pi)))];
207  */
208 [method,ode_check(eqn,ans[1])];
209 [riccati,0];
211 /* 19 */
212 (pn_(19),ans:contrib_ode(eqn:'diff(y,x) - (y + x)^2,y,x));
213 [[x=%c-atan(sqrt(%t)),y=-x-sqrt(%t)],[x=atan(sqrt(%t))+%c,y=sqrt(%t)-x]];
215 solve(ans[1][2],sqrt(%t));
216 [sqrt(%t) = -y-x];
217 ans[1][1],%;
218 x=atan(y+x)+%c;
219 ans[1]:first(solve(%,y));
220 y = tan(x-%c)-x;
221 solve(ans[2][2],sqrt(%t));
222 [sqrt(%t) = y+x];
223 ans[2][1],%;
224 x = atan(y+x)+%c;
225 ans[2]:first(solve(%,y));
226 y = tan(x-%c)-x;
228 [method,ode_check(eqn,ans[1]),ode_check(eqn,ans[2])];
229 [lagrange,0,0];
231 /* 20 */
232 (pn_(20),ans:contrib_ode(eqn:'diff(y,x)-y^2+(x^2+1)*y-2*x,y,x));
233 [y = ((x^2+1)*'integrate(%e^(x^3/3+x),x)-%e^(x^3/3+x)+%c*x^2+%c)/('integrate(%e^(x^3/3+x),x)+%c)];
234 [method,ode_check(eqn,ans[1])];
235 [riccati,0];
237 /* 21 */
238 (pn_(21),ans:contrib_ode(eqn:'diff(y,x)-y^2+y*sin(x)-cos(x),y,x));
239  [y = (%e^cos(x)*sin(x)*'integrate(%e^-cos(x),x)+%c*%e^cos(x)*sin(x)-1)/(%e^cos(x)*'integrate(%e^-cos(x),x)+%c*%e^cos(x))];
240 [method,ode_check(eqn,ans[1])];
241 [riccati,0];
243 /* 22 */
244 (pn_(22),ans:contrib_ode(eqn:'diff(y,x)-y^2-y*sin(2*x)-cos(2*x),y,x));
245 [[y=-'diff(%u,x,1)/%u,-'diff(%u,x,1)*sin(2*x)+%u*cos(2*x)+'diff(%u,x,2)=0]];
247 /* 23 */
248 assume(a>0,b>0);
249 [a>0,b>0];
250 (pn_(23),ans:contrib_ode(eqn:'diff(y,x) + a*y^2 - b,y,x));
251 [-(log(-((sqrt(a)*sqrt(b)-a*y)/(a*y+sqrt(a)*sqrt(b))))/(2*sqrt(a)*sqrt(b)))=x+%c];
252 solve(map(exp,2*sqrt(a)*sqrt(b)*ans[1]),y);
253 [y=sqrt(b)*(%e^(2*sqrt(a)*sqrt(b)*x+2*%c*sqrt(a)*sqrt(b))+1)/(sqrt(a)*(%e^(2*sqrt(a)*sqrt(b)*x+2*%c*sqrt(a)*sqrt(b))-1))];
254 [method,ode_check(eqn,%[1])];
255 [separable,0];
256 forget(a>0,b>0);
257 [a>0,b>0];
259 /* 24 */
260 assume(nu>-2,a>0,b>0);
261 [nu > -2,a>0,b>0];
262 (pn_(24),ans:contrib_ode(eqn:'diff(y,x) + a*y^2 - b*x^nu,y,x),0);
265 [y = -(sqrt(a)*sqrt(b)*(%c*bessel_k((nu+1)/(nu+2),2*sqrt(a)*sqrt(b)*x^(nu/2+1)/(nu+2))-bessel_i(-((nu+1)/(nu+2)),2*sqrt(a)*sqrt(b)*x^(nu/2+1)/(nu+2)))*x^(nu/2)/(%c*a*bessel_k(1/(nu+2),2*sqrt(a)*sqrt(b)*x^(nu/2+1)/(nu+2))+a*bessel_i(1/(nu+2),2*sqrt(a)*sqrt(b)*x^(nu/2+1)/(nu+2))))];
266  */
267 [method,ratsimp(ode_check(eqn,ans[1]))];
268 [riccati,0];
269 forget(nu>-2,a>0,b>0);
270 [nu>-2,a>0,b>0];
272 /* 25 - This is a Riccati equation */
273 (pn_(25),ans:contrib_ode(eqn:'diff(y,x)+a*y^2-b*x^(2*nu)-c*x^(nu-1),y,x));
274 [[y='diff(%u,x,1)/(%u*a),%u*a^2*(b*x^(2*nu)+c*x^(nu-1))-'diff(%u,x,2)*a=0]];
275 method;
276 riccati;
278 /* 26 */
279 (pn_(26),ans:contrib_ode(eqn:'diff(y,x)-(A*y- a)*(B*y-b),y,x));
280 [((log(B*y-b)-log(A*y-a))/(A*b-a*B)) = x+%c];
281 [method,ode_check(eqn,ans[1])];
282 [separable,0];
284 /* 27 - also Murphy 1.62*/
285 (pn_(27),ans:contrib_ode(eqn:'diff(y,x) + a*y*(y-x) - 1,y,x),0);
286 /* [y = (sqrt(%pi)*a*x*%e^(a*x^2/2)*erf(sqrt(a)*x/sqrt(2))
287          +sqrt(a)*(sqrt(2)*%c*a*x*%e^(a*x^2/2)+sqrt(2)))
288          /(sqrt(%pi)*a*%e^(a*x^2/2)*erf(sqrt(a)*x/sqrt(2))
289           +sqrt(2)*%c*a^(3/2)*%e^(a*x^2/2))]; */
291 [method,ode_check(eqn,ans[1])];
292 [riccati,0];
294 /* 28 */
295 (pn_(28),ans:contrib_ode(eqn:'diff(y,x)+x*y^2-x^3*y-2*x,y,x));
296 [y = %e^-(x^4/4)*(x^2*%e^(x^4/4)*(sqrt(%pi)*%c*erf(x^2/2)+sqrt(%pi))+2*%c)
297           /(sqrt(%pi)*%c*erf(x^2/2)+sqrt(%pi))];
298 [method,ode_check(eqn,ans[1])];
299 [riccati,0];
301 /* 29 */
302 (pn_(29),ans:contrib_ode(eqn:'diff(y,x) - x*y^2 - 3*x*y,y,x));
303 [-((log(y+3)-log(y))/3) = x^2/2+%c];
304 solve(map(exp,3*ans[1]),y);
305 [y = -3*%e^(3*x^2/2+3*%c)/(%e^(3*x^2/2+3*%c)-1)];
306 [method,ode_check(eqn,%[1])];
307 [separable,0];
309 /* 30 */
310 (pn_(30),ans:contrib_ode(eqn:'diff(y,x)+x^(-a-1)*y^2-x^a,y,x));
311 [y = -(((%c*bessel_y(a+1,2*sqrt(-x))+bessel_j(a+1,2*sqrt(-x))
312        -%c*bessel_y(a-1,2*sqrt(-x))-bessel_j(a-1,2*sqrt(-x)))*sqrt(-x)
313     +a*(%c*bessel_y(a,2*sqrt(-x))+bessel_j(a,2*sqrt(-x))))*x^a
314     /(2*%c*bessel_y(a,2*sqrt(-x))+2*bessel_j(a,2*sqrt(-x))))];
315 [method,ode_check(eqn,ans[1])];
316 [riccati,0];
318 /* 31 */
319 assume(n>-1);
320 [n>-1];
321 (pn_(31),ans:contrib_ode(eqn:'diff(y,x) - a*x^n*(y^2+1),y,x));
322 [atan(y)/a = x^(n+1)/(n+1)+%c];
323 solve(ans[1],y);
324 [y = tan(a*x^(n+1)/(n+1)+%c*a*n/(n+1)+%c*a/(n+1))];
325 [method,ode_check(eqn,%[1])];
326 [separable,0];
327 forget(n>-1);
328 [n>-1];
330 /* 32 - FIXME: Why the %i in the solution? */
331 assume(cos(x)>0);
332 [cos(x)>0];
333 (pn_(32),ans:contrib_ode(eqn:'diff(y,x) + y^2*sin(x) - 2*sin(x)/cos(x)^2,y,x));
334 [y = ((3*%c-%i)*sinh(3*log(cos(x))/2)+(%c-3*%i)*cosh(3*log(cos(x))/2))/(2*%i*cos(x)*sinh(3*log(cos(x))/2)-2*%c*cos(x)*cosh(3*log(cos(x))/2))];
335 [method,ode_check(eqn,ans[1])];
336 [riccati,0];
337 forget(cos(x)>0);
338 [cos(x)>0];
340 /* 33 */
341 (pn_(33),ans:contrib_ode(eqn:'diff(y,x)-y^2*'diff(f(x),x)/g(x)+'diff(g(x),x)/f(x),y,x));
342 [[y = -'diff(%u,x,1)*g(x)/(%u*'diff(f(x),x,1)),-'diff(%u,x,1)*('diff(f(x),x,2)/g(x)-'diff(f(x),x,1)*'diff(g(x),x,1)/g(x)^2)-%u*('diff(f(x),x,1))^2*'diff(g(x),x,1)/(f(x)*g(x)^2)+'diff(%u,x,2)*'diff(f(x),x,1)/g(x)=0]];
343 method;
344 riccati;
346 /* 34 */
347 (pn_(34),ans:contrib_ode(eqn:'diff(y,x)+f(x)*y^2+g(x)*y,y,x));
348 [y=%e^-('integrate(g(x),x))/('integrate(f(x)*%e^-'integrate(g(x),x),x)+%c)];
349 [method,ode_check(eqn,ans[1])];
350 [bernoulli,0];
352 /* 35 */
353 assume(4*a^2>4*b);
354 [4*a^2>4*b];
355 (pn_(35),ans:contrib_ode(eqn:'diff(y,x)+f(x)*(y^2+2*a*y+b),y,x));
356 [-(log(-((-y+sqrt(a^2-b)-a)/(y+sqrt(a^2-b)+a)))/(2*sqrt(a^2-b)))='integrate(f(x),x)+%c];
357 solve(map(exp,2*sqrt(a^2-b)*ans[1]),y);
358 [y=(sqrt(a^2-b)*(%e^(2*sqrt(a^2-b)*'integrate(f(x),x)+2*%c*sqrt(a^2-b))+1)+a*(1-%e^(2*sqrt(a^2-b)*'integrate(f(x),x)+2*%c*sqrt(a^2-b))))/(%e^(2*sqrt(a^2-b)*'integrate(f(x),x)+2*%c*sqrt(a^2-b))-1)];
359 [method,ode_check(eqn,%[1])];
360 [separable,0];
361 forget(4*a^2>4*b);
362 [4*a^2>4*b];
364 /* 36 */
365 (pn_(36),ans:contrib_ode(eqn:'diff(y,x) + y^3 + a*x*y^2,y,x));
366 false;
368 /* 37 */
369 (pn_(37),ans:contrib_ode(eqn:'diff(y,x)-y^3-a*exp(x)*y^2,y,x));
370 false;
372 /* Kamke 38 - Chini invariant constant - 1/(8*a*b^2) 
374    One integrable case is a:-1/6  b:1/3
376 (pn_(38),a:-1/6,b:1/3,ans:contrib_ode(eqn:'diff(y,x) - a*y^3 - b*x^(-3/2),y,x));
377 [x = %c*%e^((sqrt(x)*(2*y*log(sqrt(x)*y+1)-2*y*log(sqrt(x)*y-2))+2*log(sqrt(x)*y+1)-2*log(sqrt(x)*y-2)-6)/(3*sqrt(x)*y+3))];
378 method;
379 genhom;
380 kill(a,b);
381 done;
383 /* 39 */
384 (pn_(39),ans:contrib_ode(eqn:'diff(y,x)-a3*y^3-a2*y^2-a1*y-a0,y,x));
385 ['integrate(1/(a3*y^3+a2*y^2+a1*y+a0),y)=x+%c];
387 /* 40 */
388 (pn_(40),ans:contrib_ode(eqn:'diff(y,x)+3*a*y^3+6*a*x*y^2,y,x));
389 false;
391 /* 41 */
392 assume(b^2+4*a>0);
393 [b^2+4*a>0];
394 (pn_(41),ans:contrib_ode(eqn:'diff(y,x)+a*x*y^3+b*y^2,y,x));
395 [x=%c*%e^-((b*log(-((-2*a*x*y+sqrt(b^2+4*a)-b)/(2*a*x*y+sqrt(b^2+4*a)+b)))+sqrt(b^2+4*a)*(log(a*x^2*y^2+b*x*y-1)-2*log(x*y)))/(2*sqrt(b^2+4*a)))];
396 method;
397 genhom;
398 forget(b^2+4*a>0);
399 [b^2+4*a>0];
401 /* 42 */
402 (pn_(42),ans:contrib_ode(eqn:'diff(y,x)-x*(x+2)*y^3-(x+3)*y^2,y,x));
403 false;
405 /* 43 */
406 (pn_(43),ans:contrib_ode(eqn:'diff(y,x)+(3*a*x^2+4*a^2*x+b)*y^3+3*x*y^2,y,x));
407 false;
409 /* 44 */
410 (pn_(44),ans:contrib_ode(eqn:'diff(y,x)+2*a*x^3*y^3+2*x*y,y,x));
411 [y=%e^-x^2/sqrt(%c-a*(2*x^2+1)*%e^-(2*x^2)/2)];
412 [method,ode_check(eqn,ans[1])];
413 [bernoulli,0];
415 /* 45 */
416 (pn_(45),ans:contrib_ode(eqn:'diff(y,x)+2*(a^2*x^3-b^2*x)*y^3+3*b*y^2,y,x));
417 false;
419 /* 46 Abel eqn with relative invariant = 0 */
420 (kn_("46i"),a:1,ans:contrib_ode(eqn:'diff(y,x)- x^a*y^3+3*y^2-x^(-a)*y-x^(-2*a)+ a*x^(-a-1),y,x));
421 [x = %c*%e^-((2*log(x*y-1)-log(x*y-2)-log(x*y))/2)];
422 /* This doesn't work.  Bug is ode_check??  ***FIXME***
423 [method,ode_check(eqn,ans[1])];
424 [genhom,0]; */
425 radcan(ans[1])^2;
426 x^2 = %c^2*x*y*(x*y-2)/(x*y-1)^2;
427 ans:solve(%,y);
428 [y = (%c*sqrt(%c^2-x^2)+x^2-%c^2)/(x^3-%c^2*x), y = -((%c*sqrt(%c^2-x^2)-x^2+%c^2)/(x^3-%c^2*x))];
429 [method,ode_check(eqn,ans[1]),ode_check(eqn,ans[2])];
430 [genhom,0,0];
431 kill(a);
432 done;
434 (pn_("46ii"),assume(a>1),ans:contrib_ode(eqn:'diff(y,x) - x^a*y^3 + 3*y^2 - x^(-a)*y -x^(-2*a) + a*x^(-a-1),y,x));
435 [y=%e^-(2*x^(1-a)/(1-a))/sqrt(2*(a-1)^((a+1)/(1-a))
436   *gamma_incomplete((a+1)/(1-a),-4*x^(1-a)/(a-1))*x^(a+1)
437    /((1-a)*4^((a+1)/(1-a))*(-x^(1-a))^((a+1)/(1-a)))+%c)+1/x^a];
438 [method,ode_check(eqn,ans[1])];
439 [abel,0];
440 forget(a>1);
441 [a>1];
443 /* 47 - Too general - E S Cheb-Terrab and T Kolokolnikov */
444 /* 48 - Too general - E S Cheb-Terrab and T Kolokolnikov */
445 /* 49 - Crash */
446 /* 50 - Too general - E S Cheb-Terrab and T Kolokolnikov */
447 /* 51 infinite run time */
449 /* 52 Asks if n is integer */
450 /* (pn_(52),ans:'diff(y,x)-a*y^n-b*x^(n/(1-n)),y,x)); */
452 /* 53 */
453 /* (pn_(53),ans:contrib_ode(eqn:'diff(y,x)-f(x)^(1-n)*'diff(g(x),x)*y^n/(a*g(x)+b)^n-'diff(f(x),x)*y/f(x)-f(x)*'diff(g(x),x),y,x));
454 false; */
456 /* 54 */
457 /* (pn_(54),ans:contrib_ode(eqn:'diff(y,x)-a^n*f(x)^(1-n)*'diff(g(x),x)*y^n-'diff(f(x),x)*y/f(x)-f(x)*'diff(g(x),x),y,x));
458 false; */
460 /* 55 - Too general - E S Cheb-Terrab and T Kolokolnikov */
461 /* 56 - Too general - E S Cheb-Terrab and T Kolokolnikov */
463 /* 57 */
464 (pn_(57),ans:contrib_ode(eqn:'diff(y,x)-sqrt(abs(y)),y,x));
465 ['integrate(1/sqrt(abs(y)),y)=x+%c];
466 [method,ode_check(eqn,ans[1])];
467 [separable,0];
469 /* 58 */
470 assume((8*b+a^2)>0,x>0);
471 [(8*b+a^2)>0,x>0];
472 (pn_(58),ans:contrib_ode(eqn:'diff(y,x)-a*sqrt(y)-b*x,y,x));
473 [x=%c*%e^-(((sqrt(8*b+a^2)*log(-((-2*y+a*x*sqrt(y)+b*x^2)/x^2))+a*log(-((-4*sqrt(y)+sqrt(8*b+a^2)*x+a*x)/(4*sqrt(y)+sqrt(8*b+a^2)*x-a*x))))/(2*sqrt(8*b+a^2))))];
474 forget((8*b+a^2)>0,x>0);
475 [(8*b+a^2)>0,x>0];
477 /* 59 */
478 (pn_(59),ans:contrib_ode(eqn:'diff(y,x)-a*sqrt(y^2+1)-b,y,x));
479 ['integrate(1/(a*sqrt(y^2+1)+b),y) = x+%c];
480 /* maxima no longer integrates this 2006-09-02
481 assume(y>0);
482 [y>0];
483 ans[1],abs,integrate;
484 2*sqrt(y)=x+%c;
485 [method,ode_check(eqn,%)];
486 [separable,0];
487 forget(y>0);
488 [y>0];*/
490 /* 60 */
491 (pn_(60),ans:contrib_ode(eqn:'diff(y,x)-sqrt(y^2-1)/sqrt(x^2-1),y,x));
492 [log(2*sqrt(y^2-1)+2*y)=log(2*sqrt(x^2-1)+2*x)+%c];
493 [method,ode_check(eqn,ans[1])];
494 [separable,0];
496 /* 61 */
497 (pn_(61),ans:contrib_ode(eqn:'diff(y,x)-sqrt(x^2-1)/sqrt(y^2-1),y,x));
498 [(y*sqrt(y^2-1)-log(2*sqrt(y^2-1)+2*y))/2=(x*sqrt(x^2-1)-log(2*sqrt(x^2-1)+2*x))/2+%c];
499 [method,ode_check(eqn,ans[1])];
500 [separable,0];
502 /* 62 "infinite" run time */
504 /* 63 */
505 (pn_(63),ans:contrib_ode(eqn:'diff(y,x)-(1+ y^2)/(abs(y+sqrt(1+y))*sqrt(1+x)^3),y,x));
506 ['integrate(abs(sqrt(y+1)+y)/(y^2+1),y)= %c-2/sqrt(x+1)];
507 [method,ode_check(eqn,%)];
508 [separable,0];
510 /* 64 */
511 /* Used to pass but now fails due to integration problems.
512    Almost certainly related to bug # 1487703
514 assume(a>0,b>0,4*a*c>b^2);
515 [a>0,b>0,4*a*c>b^2];
516 (pn_(64),ans:contrib_ode(eqn: 'diff(y,x)-sqrt((a*y^2+b*y+c)/(a*x^2+b*x+c)),y,x));
517 [(sqrt(a)*sqrt(2*a*y^2+2*b*y+2*c)*asinh((4*a*y+2*b)/sqrt(16*a*c-4*b^2))-sqrt(2)*sqrt(a)*asinh((2*a*x+b)/sqrt(4*a*c-b^2))*sqrt(a*y^2+b*y+c))/(sqrt(2)*a*sqrt(2*a*y^2+2*b*y+2*c))=%c];
518 method;
519 exact;
520 forget(a>0,b>0,4*a*c>b^2);
521 [a>0,b>0,4*a*c>b^2];
524 /* 65 */
525 (pn_(65),ans:contrib_ode(eqn:'diff(y,x)-sqrt((y^3+1)/(x^3+1)),y,x));
526 [-((sqrt(2*y^3+2)*'integrate((3*y^2*'integrate(sqrt((y^3+1)/(x^3+1)),x)+(-3*y^5-3*y^2)*'integrate(1/((x^3+1)*sqrt((y^3+1)/(x^3+1))),x)-2*y^3-2)/(2*y^3+2)^(3/2),y)+'integrate(sqrt((y^3+1)/(x^3+1)),x))/sqrt(2*y^3+2))=%c];
527 method;
528 exact;
530 /* 66 */
531 (pn_(66),ans:contrib_ode(eqn:'diff(y,x)-sqrt(abs(y*(1-y)*(1-a*y)))/sqrt(abs(x*(1-x)*(1-a*x))),y,x));
532 ['integrate(1/(sqrt(abs(y-1))*sqrt(abs(y))*sqrt(abs(a*y-1))),y)='integrate(1/(sqrt(abs(x-1))*sqrt(abs(x))*sqrt(abs(a*x-1))),x)+%c];
533 [method,ode_check(eqn,%)];
534 [separable,0];
536 /* 67 */
537 (pn_(67),ans:contrib_ode(eqn:'diff(y,x)-sqrt(1-y^4)/sqrt(1-x^4),y,x));
538 ['integrate(1/sqrt(1-y^4),y) = 'integrate(1/sqrt(1-x^4),x)+%c];
539 [method,ode_check(eqn,ans[1])];
540 [separable,0];
542 /* 68 */
543 /*(pn_(68),ans:contrib_ode(eqn:'diff(y,x)-sqrt((a*y^4+b*y^2+1)/(a*x^4+b*x^2+1)),y,x));
544 ['integrate(1/sqrt(a*y^4+b*y^2+1),y)='integrate(1/sqrt(a*x^4+b*x^2+1),x)+%c]; */
546 /* 69 */
548 /* 74 - Too general - E S Cheb-Terrab and T Kolokolnikov */
550 /* 75 */
551 (pn_(75),ans:contrib_ode(eqn:'diff(y,x)-exp(x-y)+exp(x),y,x));
552 [log(%e^y-1)+%e^x=%c];
553 solve(ans[1],y);
554 [y=log(%e^(%c-%e^x)+1)];
555 [method,ode_check(eqn,%[1])];
556 [exact,0];
558 /* 76 */
559 assume(4*a^2>4*b^2);
560 [4*a^2>4*b^2];
561 (pn_(76),ans:contrib_ode(eqn:'diff(y,x)-a*cos(y)+b,y,x));
562 [-(log(-(((-b-a)*sin(y)+sqrt(a^2-b^2)*(cos(y)+1))/((b+a)*sin(y)+sqrt(a^2-b^2)*(cos(y)+1))))/sqrt(a^2-b^2))=x+%c];
563 method;
564 separable;
565 forget(4*a^2>4*b^2);
566 [4*a^2>4*b^2];
568 /* 77 infinite run time */
569 /* 78 infinite run time */
570 /* 79 - Too general - E S Cheb-Terrab and T Kolokolnikov */
572 /* 80 */
573 (pn_(80),ans:contrib_ode(eqn:'diff(y,x)+f(x)*sin(y)+(1-'diff(f(x),x))*cos(y)-'diff(f(x),x)-1,y,x));
574 false;
576 /* 81 - Crash */
577 /* 82 - Too general - E S Cheb-Terrab and T Kolokolnikov */
579 /* 83 */
580 (pn_(83),ans:contrib_ode(eqn:'diff(y,x)-tan(x*y),y,x));
581 false;
583 /* 84 */
584 use_pdiff:true;
585 true;
586 (pn_(84),ans:contrib_ode(eqn:'diff(y,x)-f(a*x+b*y),y,x));
587 [b*'integrate(f(b*y+a*x)/(b*f(b*y+a*x)+a),x)-'integrate(((a*b^3*f(b*y+a*x)+a^2*b^2)*'integrate(pderivop(f,1)(b*y+a*x)/(b^2*f(b*y+a*x)^2+2*a*b*f(b*y+a*x)+a^2),x)+b)/(b*f(b*y+a*x)+a),y)=%c];
588 method;
589 lie;
590 use_pdiff:false;
591 false;
593 /* 85 - Crash */
594 /* 86 infinite run time */
595 /* 87 infinite run time */
597 /* 88 */
598 (pn_(88),ans:contrib_ode(eqn:2*'diff(y,x)-3*y^2-4*a*y-b-c*exp(-2*a*x),y,x));
599 [[y=-2*'diff(%u,x,1)/(3*%u),9*%u*(c*%e^-(2*a*x)/2+b/2)/4-3*'diff(%u,x,1)*a+3*'diff(%u,x,2)/2=0]];
600 method;
601 riccati;
603 /* 89 */
604 assume(a>0);
605 [a>0];
606 (pn_(89),ans:contrib_ode(eqn: x*'diff(y,x)-sqrt(a^2-x^2),y,x));
607 [y = -a*log(2*a*sqrt(a^2-x^2)/abs(x)+2*a^2/abs(x))+sqrt(a^2-x^2)+%c];
608 [method,ode_check(eqn,%[1])];
609 [linear,0];
610 forget(a>0);
611 [a>0];
613 /* 90 */
614 (pn_(90),ans:contrib_ode(eqn:x*'diff(y,x)+y-x*sin(x),y,x));
615 [y=(sin(x)-x*cos(x)+%c)/x];
616 [method,ode_check(eqn,ans[1])];
617 [linear,0];
619 /* 91 */
620 (pn_(91),ans:contrib_ode(eqn:x*'diff(y,x)-y-x/log(x),y,x));
621 [y=x*(log(log(x))+%c)];
622 [method,ode_check(eqn,ans[1])];
623 [linear,0];
625 /* 92 */
626 (pn_(92),ans:contrib_ode(eqn:x*'diff(y,x)-y-x^2*sin(x),y,x));
627 [y=x*(%c-cos(x))];
628 [method,ode_check(eqn,ans[1])];
629 [linear,0];
631 /* 93 */
632 (pn_(93),ans:contrib_ode(eqn:x*'diff(y,x)-y-x*cos(log(log(x)))/log(x),y,x));
633 [y=x*(sin(log(log(x)))+%c)];
634 [method,ode_check(eqn,ans[1])];
635 [linear,0];
637 /* 94 */
638 (pn_(94),ans:contrib_ode(eqn:x*'diff(y,x)+a*y+b*x^n,y,x));
639 [y=%e^-(a*log(x))*(%c-b*%e^(n*log(x)+a*log(x))/(n+a))];
640 [method,radcan(ode_check(eqn,ans[1]))];
641 [linear,0];
643 /* 95 */
644 (pn_(95),ans:contrib_ode(eqn:x*'diff(y,x)+y^2+x^2,y,x));
645 [y=-((bessel_y(1,x)*%c+bessel_j(1,x))*x/(bessel_y(0,x)*%c+bessel_j(0,x)))];
646 [method,ode_check(eqn,ans[1])];
647 [riccati,0];
649 /* 96 */
650 (pn_(96),ans:contrib_ode(eqn:x*'diff(y,x)-y^2+1,y,x));
651 [-((log(y+1)-log(y-1))/2)=log(x)+%c];
652 solve(map(exp,-2*ans[1]),y);
653 [y=-((%e^(2*%c)*x^2+1)/(%e^(2*%c)*x^2-1))];
654 [method,ode_check(eqn,%[1])];
655 [separable,0];
657 /* 97 */
658 assume(a>0,b>0);
659 [a>0,b>0];
660 (pn_(97),ans:contrib_ode(eqn:x*'diff(y,x)+a*y^2-y+b*x^2,y,x));
661 [y=-sqrt(b)*x*tan(sqrt(a)*sqrt(b)*x-%c)/sqrt(a)];
662 [method,ode_check(eqn,ans[1])];
663 [riccati,0];
664 forget(a>0,b>0);
665 [a>0,b>0];
667 /* 98 */ 
668 assume(a>0,b>0,c>0);
669 [a>0,b>0,c>0];
670 (pn_(98),ans:contrib_ode(eqn:x*'diff(y,x)+a*y^2-b*y+c*x^(2*b),y,x));
671 [y=-sqrt(c)*x^b*tan(sqrt(a)*sqrt(c)*x^b/b-%c)/sqrt(a)];
672 [method,ode_check(eqn,ans[1])];
673 [riccati,0];
674 forget(a>0,b>0,c>0);
675 [a>0,b>0,c>0];
677 /* 99  Requires specific values of beta and b */
678 (beta:4,b:3,assume(a>0,c>0),done);
679 done;
680 (pn_(99),ans:contrib_ode(eqn:x*'diff(y,x)+a*y^2-b*y-c*x^beta,y,x));
681 [y = -((((bessel_k(7/4,sqrt(a)*sqrt(c)*x^2/2)+bessel_k(1/4,sqrt(a)*sqrt(c)*x^2/2))*%c
682   -bessel_i(7/4,sqrt(a)*sqrt(c)*x^2/2)-bessel_i(-(1/4),sqrt(a)*sqrt(c)*x^2/2))*sqrt(a)*sqrt(c)*x^2
683  -3*bessel_k(3/4,sqrt(a)*sqrt(c)*x^2/2)*%c-3*bessel_i(3/4,sqrt(a)*sqrt(c)*x^2/2))
684  /((2*'bessel_k(3/4,sqrt(a)*sqrt(c)*x^2/2)*%c+2*'bessel_i(3/4,sqrt(a)*sqrt(c)*x^2/2))*a))];
685 [method,ode_check(eqn,ans[1])];
686 [riccati,0];
687 (kill(beta,b),forget(a>0,c>0),done);
688 done;
690 /* 100 */
691 assume(a>0);
692 [a>0];
693 (pn_(100),ans:contrib_ode(eqn:x*'diff(y,x)+x*y^2+a,y,x));
694 [y = -((((bessel_y(2,2*sqrt(a)*sqrt(x))-bessel_y(0,2*sqrt(a)*sqrt(x)))*%c
695         +bessel_j(2,2*sqrt(a)*sqrt(x))-bessel_j(0,2*sqrt(a)*sqrt(x)))*sqrt(a)*sqrt(x)
696         -bessel_y(1,2*sqrt(a)*sqrt(x))*%c-bessel_j(1,2*sqrt(a)*sqrt(x)))
697       /((2*bessel_y(1,2*sqrt(a)*sqrt(x))*%c+2*bessel_j(1,2*sqrt(a)*sqrt(x)))*x))];
698 [method,ode_check(eqn,ans[1])];
699 [riccati,0];
700 forget(a>0);
701 [a>0];