Fix typo in display-html-help
[maxima.git] / share / contrib / diffequations / tests / rtestode_kamke_1_2.mac
blobdf495fe0c463fad2e417be1598dbfae14728be84
1 (load("contrib_ode"),0);
2 0$
4 /* ODE tests - Equations 101-200
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 /* 101 */
22 (pn_(101),ans:contrib_ode(eqn:x*'diff(y,x)+x*y^2-y,y,x));
23 [(x^2*y-2*x)/(2*y)=%c];
24 solve(ans[1],y);
25 [y=2*x/(x^2-2*%c)];
26 [method,ode_check(eqn,%[1])];
27 [exact,0];
29 /* 102 - FIXME: Why the complex solution? */
30 assume(a>0);
31 [a>0];
32 (pn_(102),ans:contrib_ode(eqn:x*'diff(y,x)+x*y^2-y-a*x^3,y,x));
33 [y=sqrt(a)*(%c*x*sinh(sqrt(a)*x^2/2)+%i*x*cosh(sqrt(a)*x^2/2))/(%i*sinh(sqrt(a)*x^2/2)+%c*cosh(sqrt(a)*x^2/2))];
34 [method,ode_check(eqn,ans[1])];
35 [riccati,0];
36 forget(a>0);
37 [a>0];
39 /* 103  - FIXME: Why the complex solution? */
40 (pn_(103),ans:contrib_ode(eqn:x*'diff(y,x)+x*y^2-(2*x^2+1)*y-x^3,y,x));
41 [y=((sqrt(2)*%c+%i)*x*sinh(sqrt(2)*x^2/2)+(%c+sqrt(2)*%i)*x*cosh(sqrt(2)*x^2/2))/(%i*sinh(sqrt(2)*x^2/2)+%c*cosh(sqrt(2)*x^2/2))];
42 [method,ode_check(eqn,ans[1])];
43 [riccati,0];
45 /* 104 */
46 (pn_(104),ans:contrib_ode(eqn: x*'diff(y,x)+a*x*y^2+2*y+b*x,y,x));
47 [y = (x*(%c*sqrt(a)*sqrt(-b)*%e^(2*sqrt(a)*sqrt(-b)*x)
48                -sqrt(a)*sqrt(-b))
49           -%c*%e^(2*sqrt(a)*sqrt(-b)*x)-1)
50           /(a*x*(%c*%e^(2*sqrt(a)*sqrt(-b)*x)+1))];
51 [method,ode_check(eqn,ans[1])];
52 [riccati,0];
54 /* 105 */
55 (pn_(105),ans:contrib_ode(eqn:x*'diff(y,x)+a*x*y^2+b*y+c*x+d,y,x));
56 [y = (sqrt(a)*sqrt(-c)
57                     *(%c*kummer_u(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
58                                   -2*sqrt(a)*sqrt(-c)*x)
59                      -2*%c
60                        *dkummer_u(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
61                                   -2*sqrt(a)*sqrt(-c)*x))
62           +sqrt(a)*sqrt(-c)
63                   *kummer_m(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
64                             -2*sqrt(a)*sqrt(-c)*x)
65           -2*sqrt(a)*sqrt(-c)
66             *dkummer_m(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
67                        -2*sqrt(a)*sqrt(-c)*x))
68           /(a*(%c*kummer_u(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
69                            -2*sqrt(a)*sqrt(-c)*x)
70               +kummer_m(-((sqrt(a)*sqrt(-c)*d-b*c)/(2*c)),b,
71                         -2*sqrt(a)*sqrt(-c)*x)))];
72 [method,ode_check(eqn,ans[1])];
73 [riccati,0];
75 /* 106 */
76 assume(not(equal(b+a,0)));
77 [notequal(b+a,0)];
78 (pn_("106a"),ans:contrib_ode(eqn:x*'diff(y,x)+x^a*y^2+(a-b)*y/2+x^b,y,x));
79 [y=-((%c*x^(b/2+a/2)*sin(2*x^(b/2+a/2)/(b+a))-x^(b/2+a/2)*cos(2*x^(b/2+a/2)/(b+a)))/(x^a*sin(2*x^(b/2+a/2)/(b+a))+%c*x^a*cos(2*x^(b/2+a/2)/(b+a))))];
80 [method,ode_check(eqn,ans[1])];
81 [riccati,0];
82 forget(notequal(b + a,0));
83 [notequal(b+a,0)];
85 assume(equal(a+b,0),x>0);
86 [equal(b + a, 0),x>0];
87 (pn_("106b"),ans:contrib_ode(eqn:x*'diff(y,x)+x^a*y^2+(a-b)*y/2+x^b,y,x));
88 [y = -((%c*sin(log(x))-cos(log(x)))/(x^a*sin(log(x))+%c*x^a*cos(log(x))))];
89 [method,subst(-a,b,ode_check(eqn,ans[1]))];  /* Need to use a+b=0 */
90 [riccati,0];
91 forget(equal(a+b,0),x>0);
92 [equal(b + a, 0),x>0];
94 /* 107 */
95 (pn_(107),ans:contrib_ode(eqn:x*'diff(y,x)+a*x^alpha*y^2+b*y-c*x^beta,y,x));
96 [[y = 'diff(%u,x,1)*x^(1-alpha)/(%u*a),%u*a^2*c*x^(beta+2*(alpha-1)-1)-'diff(%u,x,2)*a*x^(alpha-1)-'diff(%u,x,1)*(a*b*x^(alpha-2)-a*(alpha-1)*x^(alpha-2))=0]];
97 method;
98 riccati;
100 /* 108 */
101 (pn_(108),ans:contrib_ode(eqn:x*'diff(y,x)-y^2*log(x)+y,y,x));
102 [y=1/(x*(log(x)/x+1/x+%c))];
103 [method,ode_check(eqn,ans[1])];
104 [bernoulli,0];
106 /* 109 */
107 (pn_(109),ans:contrib_ode(eqn:x*'diff(y,x)-y*(2*y*log(x)-1),y,x));
108 [y=1/(x*(%c-2*(-log(x)/x-1/x)))];
109 [method,ode_check(eqn,ans[1])];
110 [bernoulli,0];
112 /* 110 Why the complex solution? */
113 (pn_(110),ans:contrib_ode(eqn:x*'diff(y,x)+ f(x)*(y^2-x^2)-y,y,x));
114 [y=(%c*x*sinh('integrate(f(x),x))+%i*x*cosh('integrate(f(x),x)))/(%i*sinh('integrate(f(x),x))+%c*cosh('integrate(f(x),x)))];
115 [method,ode_check(eqn,ans[1])];
116 [riccati,0];
118 /* 111 */
119 (pn_(111),ans:contrib_ode(eqn: x*'diff(y,x) + y^3 + 3*x*y^2,y,x));
120 false;
122 /* 112 */
123 (pn_(112),ans:contrib_ode(eqn:x*'diff(y,x)-sqrt(y^2+x^2)-y,y,x));
124 [x = %c*%e^(x*asinh(y/x)/abs(x))];
125 assume(x>0);
126 [x>0];
127 solve(map(log,ans[1]/%c),y);
128 [y = x*sinh(log(x/%c))];
129 [method,ode_check(eqn,%[1])];
130 [genhom,0];
131 forget(x>0);
132 [x>0];
134 /* 113 */
135 (pn_(113),ans:contrib_ode(eqn:x*'diff(y,x)+a*sqrt(y^2+x^2)-y,y,x));
136 [x=%c*%e^-(x*asinh(y/x)/(a*abs(x)))];
137 assume(x>0);
138 [x>0];
139 solve(map(log,ans[1]/%c),y);
140 [y=-x*sinh(a*log(x/%c))];
141 [method,ode_check(eqn,%[1])];
142 [genhom,0];
143 forget(x>0);
144 [x>0];
146 /* 114 */
147 assume(x>0,y>0);
148 [x>0,y>0];
149 (pn_(114),ans:contrib_ode(eqn:x*'diff(y,x)-x*sqrt(y^2+x^2)-y,y,x));
150 [x-asinh(y/x)=%c];
151 solve(ans[1],y);
152 [y=x*sinh(x-%c)];
153 [method,ode_check(eqn,%[1])];
154 [lie,0];
155 forget(x>0,y>0);
156 [x>0,y>0];
158 /* 115 - "solution" has changed - Jan 2007.  Don't care at present */
160 (pn_(115),ans:contrib_ode(eqn:x*'diff(y,x)-x*(y-x)*sqrt(y^2+x^2)-y,y,x));
161 [(2*'integrate((sqrt(y^2+x^2)*((y^2-x*y)*'integrate((2*y^2-x*y+x^2)*%e^-(log(y^2+x^2)/2)/(y^4-2*x*y^3+2*x^2*y^2-2*x^3*y+x^4),x)+(x-y)*'integrate(%e^-(log(y^2+x^2)/2)/(y-x),x))-x)/((y-x)*sqrt(y^2+x^2)),y)+2*y*'integrate(%e^-(log(y^2+x^2)/2)/(y-x),x)+x^2)/2=%c];
162 method;
163 lie;
166 /* 116 - "solution" has changed - Jan 2007.  Don't care at present */
168 (pn_(116),ans:contrib_ode(eqn:x*'diff(y,x)-x*sqrt((y^2-x^2)*(y^2-4*x^2))-y,y,x)); 
169 [(2*'integrate((sqrt(y^4-5*x^2*y^2+4*x^4)*(y*'integrate((2*y^3-5*x^2*y)*%e^(-log(y+2*x)/2-log(y+x)/2-log(y-x)/2-log(y-2*x)/2)/(y^4-5*x^2*y^2+4*x^4),x)-'integrate(%e^(-log(y+2*x)/2-log(y+x)/2-log(y-x)/2-log(y-2*x)/2),x))-x)/sqrt(y^4-5*x^2*y^2+4*x^4),y)+2*y*'integrate(%e^(-log(y+2*x)/2-log(y+x)/2-log(y-x)/2-log(y-2*x)/2),x)+x^2)/2=%c];
170 method;
171 lie;
174 /* 117 */
175 (pn_(117),ans:contrib_ode(eqn:x*'diff(y,x)-x*exp(y/x)-y-x,y,x));
176 [%c*x=%e^-((x*log(%e^(y/x)+1)-y)/x)];
177 method;
178 homogeneous;
180 /* 118 */
181 (pn_(118),ans:contrib_ode(eqn:x*'diff(y,x)-y*log(y),y,x));
182 [log(log(y))=log(x)+%c];
183 solve(ans[1],y);
184 [y=%e^(%e^%c*x)];
185 [method,ode_check(eqn,%[1])];
186 [separable,0];
188 /* 119 */
189 (pn_(119),ans:contrib_ode(eqn:x*'diff(y,x)-y*(log(x*y)-1),y,x));
190 [x = %c*log(x*y)];
191 solve(ans[1],y);
192 [y=%e^(x/%c)/x];
193 [method,ode_check(eqn,%[1])];
194 [genhom,0];
196 /* 120  Error return from ode1_lie - symmetries exist, see rtest_ode_sym.mac */
197 /* (pn_(120),ans:contrib_ode(eqn:x*'diff(y,x)-y*(x*log(x^2/y)+2),y,x)); */
199 /* 121 */
200 (pn_(121),ans:contrib_ode(eqn:x*'diff(y,x)+sin(y-x),y,x));
201 false;
203 /* 122 */
204 (pn_(122),ans:contrib_ode(eqn:x*'diff(y,x)+(sin(y)-3*x^2*cos(y))*cos(y),y,x));
205 false;
207 /* 123 */
208 (pn_(123),ans:contrib_ode(eqn:x*'diff(y,x)-x*sin(y/x)-y,y,x));
209 [%c*x=%e^-((log(cos(y/x)+1)-log(cos(y/x)-1))/2)];
210 method;
211 homogeneous;
213 /* 124 */
214 (pn_(124),ans:contrib_ode(eqn:x*'diff(y,x)+x*cos(y/x)-y+x,y,x));
215 [%c*x=%e^-(sin(y/x)/(cos(y/x)+1))];
216 method;
217 homogeneous;
219 /* 125 */
220 (pn_(125),ans:contrib_ode(eqn:x*'diff(y,x)+x*tan(y/x)-y,y,x));
221 [%c*x=1/sin(y/x)];
222 solve(ans[1],y);
223 [y = asin(1/(%c*x))*x];
224 [method,ode_check(eqn,%[1])];
225 [homogeneous,0];
227 /* Equations 126 to 128 need pdiff */
228 use_pdiff:true;
229 true;
231 /* 126 */
232 (pn_(126),ans:contrib_ode(eqn:x*'diff(y,x)-y*f(x*y),y,x));
233 [y*'integrate(f(x*y)/(x*y*f(x*y)+x*y),x)-'integrate(((y^2*f(x*y)+y^2)*'integrate((x*y*pderivop(f,1)(x*y)-f(x*y)^2-f(x*y))/(x*y^2*f(x*y)^2+2*x*y^2*f(x*y)+x*y^2),x)+(y*f(x*y)+y)*'integrate(f(x*y)/(x*y*f(x*y)+x*y),x)+1)/(y*f(x*y)+y),y)=%c];
234 method;
235 lie;
237 /* 127  */
238 (pn_(127),ans:contrib_ode(eqn:x*'diff(y,x)-y*f(x^a*y^b),y,x));
239 [b*y*'integrate(f(x^a*y^b)/(b*x*y*f(x^a*y^b)+a*x*y),x)-'integrate(((b^2*y^2*f(x^a*y^b)+a*b*y^2)*'integrate((a*b*x^a*y^b*pderivop(f,1)(x^a*y^b)-b*f(x^a*y^b)^2-a*f(x^a*y^b))/(b^2*x*y^2*f(x^a*y^b)^2+2*a*b*x*y^2*f(x^a*y^b)+a^2*x*y^2),x)+(b^2*y*f(x^a*y^b)+a*b*y)*'integrate(f(x^a*y^b)/(b*x*y*f(x^a*y^b)+a*x*y),x)+b)/(b*y*f(x^a*y^b)+a*y),y)=%c];
240 method;
241 lie;
243 /* 128  */
244 (pn_(128),ans:contrib_ode(eqn:x*'diff(y,x)+a*y-f(x)*g(x^a*y),y,x));
245 ['integrate((x^a*f(x)*g(x^a*y)-a*x^a*y)/(x*g(x^a*y)),x)-'integrate((g(x^a*y)*'integrate((a*x^(2*a)*y*pderivop(g,1)(x^a*y)-a*x^a*g(x^a*y))/(x*g(x^a*y)^2),x)+x^a)/g(x^a*y),y)=%c];
246 method;
247 lie;
249 use_pdiff:false;
250 false;
252 /* 129 */
253 (pn_(129),ans:contrib_ode(eqn:(x+1)*'diff(y,x)+y*(y-x),y,x));
254 [y = %e^x/((x+1)*(%c-%e^-1*expintegral_e(2,-x-1)/(x+1)))];
255 [method,ode_check(eqn,ans[1])];
256 [bernoulli,0];
258 /* 130 */
259 (pn_(130),ans:contrib_ode(eqn:2*x*'diff(y,x)-y-2*x^3,y,x));
260 [y=%e^(log(x)/2)*(2*%e^(5*log(x)/2)/5+%c)];
261 [method,ode_check(eqn,ans[1])];
262 [linear,0];
264 /*  131  */ 
265 (pn_(131),ans:contrib_ode(eqn:(2*x+1)*'diff(y,x,1)-4*%e^-y+2,y,x));
266 [-log(%e^y-2)/2=log(2*x+1)/2+%c];
267 [method,ode_check(eqn,ans[1])];
268 [separable,0];
270 /*  132  */ 
271 (pn_(132),ans:contrib_ode(eqn:3*x*'diff(y,x,1)-3*x*log(x)*y^4-y,y,x));
272 [-(((6*x^2*log(x)-3*x^2)*y^3+4*x)/(4*y^3))=%c];
273 [method,ode_check(eqn,ans[1])];
274 [exact,0];
276 /*  133  */ 
277 (pn_(133),ans:contrib_ode(eqn:x^2*'diff(y,x,1)+y-x,y,x));
278 [y = (%c + gamma_incomplete(0,1/x))*%e^(1/x)];
279 [method,ode_check(eqn,ans[1])];
280 [linear,0];
282 /*  134  */ 
283 (pn_(134),ans:contrib_ode(eqn:x^2*'diff(y,x,1)-y+x^2*%e^(x-1/x),y,x));
284 [y=%e^-(1/x)*(%c-%e^x)];
285 [method,ode_check(eqn,ans[1])];
286 [linear,0];
288 /*  135  */ 
289 (pn_(135),ans:contrib_ode(eqn:x^2*'diff(y,x,1)-(x-1)*y,y,x));
290 [y=%c*x*%e^(1/x)];
291 [method,ode_check(eqn,ans[1])];
292 [linear,0];
294 /*  136  */ 
295 (pn_(136),ans:contrib_ode(eqn:x^2*'diff(y,x,1)+y^2+x*y+x^2,y,x));
296 [%c*x=%e^(x/(y+x))];
297 solve(ans[1],y);
298 [y=-((x*log(%c*x)-x)/log(%c*x))];
299 [method,ode_check(eqn,%[1])];
300 [homogeneous,0];
302 /*  137  */ 
303 (pn_(137),ans:contrib_ode(eqn:x^2*'diff(y,x,1)-y^2-x*y,y,x));
304 [%c*x=%e^-(x/y)];
305 solve(ans[1],y);
306 [y=x/log(1/(%c*x))];
307 [method,ode_check(eqn,%[1])];
308 [homogeneous,0];
310 /*  138  */ 
311 (pn_(138),ans:contrib_ode(eqn:x^2*'diff(y,x,1)-y^2-x*y-x^2,y,x));
312 [%c*x=%e^atan(y/x)];
313 solve(map(log,ans[1]),y);
314 [y=x*tan(log(%c*x))];
315 [method,ode_check(eqn,%[1])];
316 [homogeneous,0];
318 /*  139  */ 
319 (pn_(139),ans:contrib_ode(eqn:x^2*('diff(y,x,1)+y^2)+a*x^k-(b-1)*b,y,x));
320 [[y='diff(%u,x,1)/%u,%u*(-a*x^(k-2)+b^2/x^2-b/x^2)-'diff(%u,x,2)=0]];
321 method;
322 riccati;
324 /*  140  */ 
325 (pn_(140),ans:contrib_ode(eqn:x^2*('diff(y,x,1)+y^2)+4*x*y+2,y,x));
326 [x=%c*(x*y+2)/(x*y+1)];
327 solve(ans[1],y);
328 [y=-((x-2*%c)/(x^2-%c*x))];
329 [method,ode_check(eqn,%[1])];
330 [genhom,0];
332 /*  141  */ 
333 assume(4*b-a^2+2*a-1>0);
334 [4*b-a^2+2*a-1>0];
335 (pn_(141),ans:contrib_ode(eqn:x^2*('diff(y,x,1)+y^2)+a*x*y+b,y,x));
336 [x=%c*%e^-(2*atan((2*x*y+a-1)/sqrt(4*b-a^2+2*a-1))/sqrt(4*b-a^2+2*a-1))];
337 map(log,ans[1]/%c);
338 log(x/%c)=-2*atan((2*x*y+a-1)/sqrt(4*b-a^2+2*a-1))/sqrt(4*b-a^2+2*a-1);
339 solve(%,y);
340 [y=-((sqrt(4*b-a^2+2*a-1)*tan(sqrt(4*b-a^2+2*a-1)*log(x/%c)/2)+a-1)/(2*x))];
341 [method,ode_check(eqn,%[1])];
342 [genhom,0];
343 forget(4*b-a^2+2*a-1>0);
344 [4*b-a^2+2*a-1>0];
346 /*  142  */ 
347 (pn_(142),ans:contrib_ode(eqn:x^2*('diff(y,x,1)-y^2)-a*x^2*y+a*x+2,y,x));
348 [y = -((%c*a^3*x^3*%e^(a*x)-%c*a^2*x^2*%e^(a*x)+2*%c*a*x*%e^(a*x)
349                                  -2*%c*%e^(a*x)-1)
350           /(x*(2*%c*%e^(a*x)+1)+%c*a^2*x^3*%e^(a*x)-2*%c*a*x^2*%e^(a*x)))];
351 [method,ode_check(eqn,ans[1])];
352 [riccati,0];
355 /*  143  */ 
356 assume(4*a*b>-1);
357 [a*b>-(1/4)];
358 (pn_(143),ans:contrib_ode(eqn:x^2*('diff(y,x,1)+a*y^2)-b,y,x));
359 [x=%c*%e^-((log(-((-2*a*x*y+sqrt(4*a*b+1)+1)/(2*a*x*y+sqrt(4*a*b+1)-1)))
360   /sqrt(4*a*b+1)))];
361 method;
362 genhom;
363 forget(4*a*b>-1);
364 [a*b>-(1/4)];
366 /*  144  */ 
367 (pn_(144),ans:contrib_ode(eqn:x^2*('diff(y,x,1)+a*y^2)+b*x^alpha+c,y,x));
368 [[y='diff(%u,x,1)/(%u*a),%u*a^2*(-b*x^(alpha-2)-c/x^2)-'diff(%u,x,2)*a=0]];
369 method;
370 riccati;
372 /*  145  */ 
373 (pn_(145),ans:contrib_ode(eqn:x^2*'diff(y,x,1)+a*y^3-a*x^2*y^2,y,x));
374 false;
376 /*  146  */ 
377 (pn_(146),ans:contrib_ode(eqn:x^2*'diff(y,x,1)+x*y^3+a*y^2,y,x));
378 false;
380 /*  147  */ 
381 (pn_(147),ans:contrib_ode(eqn:x^2*'diff(y,x,1)+a*x^2*y^3+b*y^2,y,x));
382 false;
384 /*  148  */ 
385 (pn_(148),ans:contrib_ode(eqn:(x^2+1)*'diff(y,x,1)+x*y-1,y,x));
386 [y=(asinh(x)+%c)*%e^-(log(x^2+1)/2)];
387 [method,radcan(ode_check(eqn,ans[1]))];    
388 [linear,0];
390 /*  149  */ 
391 (pn_(149),ans:contrib_ode(eqn:(x^2+1)*'diff(y,x,1)+x*y-x*(x^2+1),y,x));
392 [y=((x^2+1)^(3/2)/3+%c)*%e^-(log(x^2+1)/2)];
393 [method,radcan(ode_check(eqn,ans[1]))];    
394 [linear,0];
396 /*  150  */ 
397 (pn_(150),ans:contrib_ode(eqn:(x^2+1)*'diff(y,x,1)+2*x*y-2*x^2,y,x));
398 [y=(2*x^3/3+%c)/(x^2+1)];
399 [method,ode_check(eqn,ans[1])];
400 [linear,0];
402 /*  151  */ 
403 (pn_(151),ans:contrib_ode(eqn:(x^2+1)*'diff(y,x,1)+(2*x*y-1)*(y^2+1),y,x));
404 false;
406 /*  152  */ 
407 (pn_(152),ans:contrib_ode(eqn:(x^2+1)*'diff(y,x,1)+x*cos(y)*sin(y)-x*(x^2+1)*cos(y)^2,y,x));
408 false;
410 /*  153  */ 
411 (pn_(153),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)-x*y+a,y,x));
412 [y=(a*x/sqrt(x^2-1)+%c)*%e^(log(x^2-1)/2)];
413 [method,radcan(ode_check(eqn,ans[1]))];
414 [linear,0];
416 /*  154  */ 
417 (pn_(154),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)+2*x*y-cos(x),y,x));
418 [y=(sin(x)+%c)/(x^2-1)];
419 [method,ode_check(eqn,ans[1])];
420 [linear,0];
422 /*  155  */ 
423 (pn_(155),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)+y^2-2*x*y+1,y,x),0);
425 /*[y = (x^2*((x-1)*(%c*log(x+1)-%c*log(x-1)+2*%c+1)
426                  +(x+1)*(%c*log(x+1)-%c*log(x-1)-2*%c+1))
427           +(x+1)*(-%c*log(x+1)+%c*log(x-1)+2*%c-1)
428           +(x-1)*(-%c*log(x+1)+%c*log(x-1)-2*%c-1))
429           /((x-1)*(x+1)*(2*%c*log(x+1)-2*%c*log(x-1)+2))]; */
430 [method,ode_check(eqn,ans[1])];
431 [riccati,0];
433 /*  156  */ 
434 (pn_(156),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)-y*(y-x),y,x));
435 [y=%e^-(log(x^2-1)/2)/(x/sqrt(x^2-1)+%c)];
436 [method,radcan(ode_check(eqn,ans[1]))];
437 [bernoulli,0];
439 /*  157  */ 
440 (pn_(157),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)+a*(y^2-2*x*y+1),y,x));
441 [y = -(((%c*dgauss_b(1-a,a,1,-((x-1)/2))+dgauss_a(1-a,a,1,-((x-1)/2)))*x^2
442        +(-2*%c*gauss_b(1-a,a,1,-((x-1)/2))-2*gauss_a(1-a,a,1,-((x-1)/2)))*a*x
443        -%c*dgauss_b(1-a,a,1,-((x-1)/2))-dgauss_a(1-a,a,1,-((x-1)/2)))
444        /((2*%c*gauss_b(1-a,a,1,-((x-1)/2))+2*gauss_a(1-a,a,1,-((x-1)/2)))*a))];
445 [method,ode_check(eqn,ans[1])];
446 [riccati,0];
448 /*  158  */ 
449 (pn_(158),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)+a*x*y^2+x*y,y,x));
450 [log(a*y+1)-log(y)=(log(x+1)+log(x-1))/2+%c];
451 [method,ode_check(eqn,ans[1])];
452 [separable,0];
454 /*  159  */ 
455 (pn_(159),ans:contrib_ode(eqn:(x^2-1)*'diff(y,x,1)-2*x*y*log(y),y,x));
456 [log(log(y))/2=(log(x+1)+log(x-1))/2+%c];
457 [method,ode_check(eqn,ans[1])];
458 [separable,0];
460 /*  160  */ 
461 (pn_(160),ans:contrib_ode(eqn:(x^2-4)*'diff(y,x,1)+(x+2)*y^2-4*y,y,x));
462 [y=%e^(4*(log(x-2)/4-log(x+2)/4))/(3*log(x+2)/4-4*(-log(x+2)/16+log(x-2)/16+1/(4*x+8))+log(x-2)/4+1/(x+2)+%c)];
463 [method,ode_check(eqn,ans[1])];
464 [bernoulli,0];
466 /*  161  */ 
467 (pn_(161),ans:contrib_ode(eqn:(x^2-5*x+6)*'diff(y,x,1)+3*x*y-8*y+x^2,y,x));
468 [y=(%c-(3*x^4-8*x^3)/12)/((x-3)*(x-2)^2)];
469 [method,ode_check(eqn,ans[1])];
470 [linear,0];
472 /*  162  */ 
473 (pn_(162),ans:contrib_ode(eqn:(x-a)*(x-b)*'diff(y,x,1)+y^2+k*(y+x-a)*(y+x-b),y,x));
474 [y = -((k*(-b*(x-b)^k-%c*a*(x-a)^k)+k*x*((x-b)^k+%c*(x-a)^k))
475           /(k*((x-b)^k+%c*(x-a)^k)+(x-b)^k+%c*(x-a)^k))];
476 [method,ode_check(eqn,ans[1])];
477 [riccati,0];
479 /*  163  */
480 assume(x>0);
481 [x>0];
482 (pn_(163),ans:contrib_ode(eqn:2*x^2*'diff(y,x,1)-2*y^2-x*y+2*a^2*x,y,x));
483 [y=-((%c*a*sinh(2*a/sqrt(x))-%i*a*cosh(2*a/sqrt(x)))*sqrt(x)/(%i*sinh(2*a/sqrt(x))-%c*cosh(2*a/sqrt(x))))];
484 [method,ode_check(eqn,ans[1])];
485 [riccati,0];
486 forget(x>0);
487 [x>0];
489 /*  164  */ 
490 (pn_(164),ans:contrib_ode(eqn:2*x^2*'diff(y,x,1)-2*y^2-3*x*y+2*a^2*x,y,x),0);
493 [y=-(((bessel_y(-(1/2),2*a/sqrt(-x))*%c+bessel_j(-(1/2),2*a/sqrt(-x)))*x
494    +((2*bessel_y(-(3/2),2*a/sqrt(-x))-2*bessel_y(1/2,2*a/sqrt(-x)))*%c
495     -2*bessel_j(1/2,2*a/sqrt(-x))+2*bessel_j(-(3/2),2*a/sqrt(-x)))*a*sqrt(-x))
496     /(4*bessel_y(-(1/2),2*a/sqrt(-x))*%c+4*bessel_j(-(1/2),2*a/sqrt(-x))))];
497  */
498 /* FIXME 2015-04-06  Form of solution has changed.
499                      ode_check() crashes with stack overflow 
500 [method,ode_check(eqn,ans[1])];
501 [riccati,0];
504 /*  165  */ 
505 (pn_(165),ans:contrib_ode(eqn:x*(2*x-1)*'diff(y,x,1)+y^2+(-4*x-1)*y+4*x,y,x));
506 [(x*y-2*x^2)/(y-1)=%c];
507 [method,ode_check(eqn,ans[1])];
508 [exact,0];
510 /*  166  */ 
511 (pn_(166),ans:contrib_ode(eqn:2*(x-1)*x*'diff(y,x,1)+(x-1)*y^2-x,y,x));
512 [y = ((2*dgauss_b(1/2,3/2,1,x)*%c+2*dgauss_a(1/2,3/2,1,x))*x^2
513           +(2*gauss_b(1/2,3/2,1,x)*%c-2*dgauss_b(1/2,3/2,1,x)*%c
514                                      +2*gauss_a(1/2,3/2,1,x)
515                                      -2*dgauss_a(1/2,3/2,1,x))
516            *x)
517           /((gauss_b(1/2,3/2,1,x)*%c+gauss_a(1/2,3/2,1,x))*x
518            -gauss_b(1/2,3/2,1,x)*%c-gauss_a(1/2,3/2,1,x))];
519 [method,ode_check(eqn,ans[1])];
520 [riccati,0];
522 /*  167  */ 
523 (pn_(167),ans:contrib_ode(eqn:3*x^2*'diff(y,x,1)-7*y^2-3*x*y-x^2,y,x));
524 [%c*x=%e^(3*atan(7*y/(sqrt(7)*x))/sqrt(7))];
525 solve(map(log,ans[1]),y);
526 [y=sqrt(7)*x*tan(sqrt(7)*log(%c*x)/3)/7];
527 [method,ode_check(eqn,%[1])];
528 [homogeneous,0];
530 /*  168  */ 
531 (pn_(168),ans:contrib_ode(eqn:3*(x^2-4)*'diff(y,x,1)+y^2-x*y-3,y,x),0);
534 [y = -( ((3*dgauss_b(1/2,7/6,4/3,-((x-2)/4))*%c
535          +3*dgauss_a(1/2,7/6,4/3,-((x-2)/4)))
536           *x^2
537      +(-6*gauss_b(1/2,7/6,4/3,-((x-2)/4))*%c
538        -6*gauss_a(1/2,7/6,4/3,-((x-2)/4)))
539            *x-12*dgauss_b(1/2,7/6,4/3,-((x-2)/4))*%c
540           -12*dgauss_a(1/2,7/6,4/3,-((x-2)/4)))
541    /(4*gauss_b(1/2,7/6,4/3,-((x-2)/4))*%c
542     +4*gauss_a(1/2,7/6,4/3,-((x-2)/4))) )  ];
543  */
544 [method,ode_check(eqn,ans[1])];
545 [riccati,0];
547 /*  169  */ 
548 (pn_(169),ans:contrib_ode(eqn:(a*x+b)^2*'diff(y,x,1)+(a*x+b)*y^3+c*y^2,y,x));
549 false;
551 /*  170  */ 
552 (pn_(170),ans:contrib_ode(eqn:x^3*'diff(y,x,1)-y^2-x^4,y,x));
553 [x=%c*%e^-(x^2/(y-x^2))];
554  solve(ans[1],y);
555 [y=(log(%c/x)+1)*x^2/log(%c/x)];
556 [method,ode_check(eqn,%[1])];
557 [genhom,0];
559 /*  171  */ 
560 (pn_(171),ans:contrib_ode(eqn:x^3*'diff(y,x,1)-y^2-x^2*y,y,x));
561 [y=x/(1/x+%c)];
562 [method,ode_check(eqn,ans[1])];
563 [bernoulli,0];
565 /*  172  */ 
566 (pn_(172),ans:contrib_ode(eqn:x^3*'diff(y,x,1)-x^4*y^2+x^2*y+20,y,x));
567 [x=%c*%e^-((log(x^2*y+5)-log(x^2*y-4))/9)];
568 method;
569 genhom;
571 /*  173  */ 
572 (pn_(173),ans:contrib_ode(eqn:x^3*'diff(y,x,1)-x^6*y^2+(3-2*x)*x^2*y+3,y,x));
573 [y=-((3*%e^(4*x)-%c)/(x^3*%e^(4*x)+%c*x^3))];
574 [method,ode_check(eqn,ans[1])];
575 [riccati,0];
577 /*  174  */ 
578 (pn_(174),ans:contrib_ode(eqn:x*(x^2+1)*'diff(y,x,1)+x^2*y,y,x));
579 [y=%c*%e^-(log(x^2+1)/2)];
580 [method,ode_check(eqn,ans[1])];
581 [linear,0];
583 /*  175  */ 
584 (pn_(175),ans:contrib_ode(eqn:x*(x^2-1)*'diff(y,x,1)-(2*x^2-1)*y+a*x^3,y,x));
585 [y=x*(a/sqrt(x^2-1)+%c)*%e^(log(x+1)/2+log(x-1)/2)];
586 [method,radcan(ode_check(eqn,ans[1]))];
587 [linear,0];
589 /*  176  */
590 (pn_(176),ans:contrib_ode(eqn:x*(x^2-1)*'diff(y,x,1)+(x^2-1)*y^2-x^2,y,x));
591 [[y='diff(%u,x,1)*x/%u,%u/(x*(x^2-1))-'diff(%u,x,2)/x-'diff(%u,x,1)/x^2=0]];
592 method;
593 riccati;
595 /*  177  */ 
596 (pn_(177),ans:contrib_ode(eqn:(x-1)*x^2*'diff(y,x,1)-y^2-(x-2)*x*y,y,x));
597 [y=(x-1)*%e^-(2*(log(x-1)-log(x)))/((2*x-1)/(2*x^2-4*x+2)-1/(2*x^2-4*x+2)+%c)];
598 [method,ode_check(eqn,ans[1])];
599 [bernoulli,0];
601 /*  178  */ 
602 (pn_(178),ans:contrib_ode(eqn:2*x*(x^2-1)*'diff(y,x,1)+2*(x^2-1)*y^2+(5-3*x^2)*y+x^2-3,y,x));
603 [y = (%c*sqrt(x-1)*sqrt(x+1)*'integrate(1/(sqrt(x-1)*sqrt(x)*sqrt(x+1)),x)
604          +sqrt(x-1)*sqrt(x+1)+%c*sqrt(x))
605     /(%c*sqrt(x-1)*sqrt(x+1)*'integrate(1/(sqrt(x-1)*sqrt(x)*sqrt(x+1)),x)
606          +sqrt(x-1)*sqrt(x+1))];
607 [method,ode_check(eqn,ans[1])];
608 [riccati,0];
610 /*  179  */
611 (pn_(179),ans:contrib_ode(eqn:3*x*(x^2-1)*'diff(y,x,1)+x*y^2+(-x^2-1)*y-3*x,y,x));
612 [[y='diff(%u,x,1)*(3*x^2-3)/%u,-'diff(%u,x,1)*(6*x/(3*x^2-3)^2-(x^2/(3*x^3-3*x)+1/(3*x^3-3*x))/(3*x^2-3))-'diff(%u,x,2)/(3*x^2-3)+%u/((x^2-1)*(3*x^2-3)^2)=0]];
613 method;
614 riccati;
616 /*  180  */ 
617 assume(4*a*c>b^2);
618 [4*a*c>b^2];
619 (pn_(180),ans:contrib_ode(eqn:(a*x^2+b*x+c)*(x*'diff(y,x,1)-y)-y^2+x^2,y,x));
620 [y=-((%c*x*sinh(2*atan((2*a*x+b)/sqrt(4*a*c-b^2))/sqrt(4*a*c-b^2))+%i*x*cosh(2*atan((2*a*x+b)/sqrt(4*a*c-b^2))/sqrt(4*a*c-b^2)))/(%i*sinh(2*atan((2*a*x+b)/sqrt(4*a*c-b^2))/sqrt(4*a*c-b^2))+%c*cosh(2*atan((2*a*x+b)/sqrt(4*a*c-b^2))/sqrt(4*a*c-b^2))))];
621 [method,ode_check(eqn,ans[1])];
622 [riccati,0];
623 forget(4*a*c>b^2);
624 [4*a*c>b^2];
626 /*  181  */ 
627 assume(a>0);
628 [a>0];
629 (pn_(181),ans:contrib_ode(eqn:x^4*('diff(y,x,1)+y^2)+a,y,x));
630 [y=-((sqrt(a)-x*tan((sqrt(a)-%c*x)/x))/(x^2*tan((sqrt(a)-%c*x)/x)))];
631 [method,ode_check(eqn,ans[1])];   
632 [riccati,0];
633 forget(a>0);
634 [a>0];
636 /*  182  */ 
637 (pn_(182),ans:contrib_ode(eqn:x*(x^3-1)*'diff(y,x,1)-2*x*y^2+y+x^2,y,x));
638  [y = (2*%c*(x-1)*x^6+x*(3*%c*(x-1)*(x^2+x+1)-2*(x-1))
639                           +x^4*(2*(x-1)-3*%c*(x-1)*(x^2+x+1))
640                           +x^5*(%c*(x^2+x+1)+%c*(x-1))
641                           +x^2*(-%c*(x^2+x+1)-%c*(x-1))
642                           +x^3*(x^2+x+(1-2*%c)*(x-1)+1)-x^2-2*x)
643          /(3*%c*(x-1)*x^2*(x^2+x+1)+3*(x-1)*(x^2+x+1))];
644 [method,ode_check(eqn,ans[1])];
645 [riccati,0];
647 /*  183  */ 
648 (pn_(183),ans:contrib_ode(eqn:(2*x^4-x)*'diff(y,x,1)-2*(x^3-1)*y,y,x));
649 [y=%c*x^2*%e^-(log(2*x^3-1)/3)];
650 [method,ode_check(eqn,ans[1])];
651 [linear,0];
653 /*  184  - FIXME 2006-12-11 - Runs forever */ 
654 /* (pn_(184),ans:contrib_ode(eqn:(a*x^2+b*x+c)^2*('diff(y,x,1)+y^2)+A,y,x));
655 [[y='diff(%u,x,1)/%u,-%u*A/(a^2*x^4+2*a*b*x^3+2*a*c*x^2+b^2*x^2+2*b*c*x+c^2)-'diff(%u,x,2)=0]];
656 method;
657 riccati; */
659 /*  185  */
660 (pn_( 185 ),ans:contrib_ode(eqn: x^7*'diff(y,x,1)+2*(x^2+1)*y^3+5*x^3*y^2 ,y,x));
661 false;
663 /*  186  */ 
664 (pn_(186),ans:contrib_ode(eqn:x^n*'diff(y,x,1)+y^2+(1-n)*x^(n-1)*y+x^(2*n-2),y,x));
665 [x=%c*%e^-atan(x^(1-n)*y)];
666 method;
667 genhom;
669 /*  187  */ 
670 assume(n^2-2*n-4*a*b+1>0);
671 [n^2-2*n-4*a*b+1>0];
672 (pn_(187),ans:contrib_ode(eqn:x^n*'diff(y,x,1)-a*y^2-b*x^(2*n-2),y,x));
673 [x=%c*%e^(log(-((-2*a*x*y+sqrt(n^2-2*n-4*a*b+1)*x^n+(n-1)*x^n)/(2*a*x*y+sqrt(n^2-2*n-4*a*b+1)*x^n+(1-n)*x^n)))/sqrt(n^2-2*n-4*a*b+1))];
674 method;
675 genhom;
676 forget(n^2-2*n-4*a*b+1>0);
677 [n^2-2*n-4*a*b+1>0];
679 /* 188  Abel eqn
680   Some choices that are integrable include
681     (n:3, b:1, a:n+b);   => K = -27/4
682     (n:7, b:2, a:n+b);   => K = -343/36
684 (pn_(188),n:3,b:1,a:n+b,ans:contrib_ode(eqn:x^(2*n+1)*'diff(y,x)-a*y^3-b*x^(3*n),y,x));
685 [x=%c*%e^-(((2*y-x^3)*log((2*y-x^3)/x^3)+(x^3-2*y)*log((y+x^3)/x^3)+3*x^3)/(18*y-9*x^3))];
686 method;
687 genhom;
688 kill(a,b,n);
689 done;
691 /*  189  */
692 declare(n,integer);
693 done;
694 (pn_(189),ans:contrib_ode(eqn:x^(n+m*(n-1))*'diff(y,x,1)-a*y^n-b*x^((m+1)*n),y,x),done);
695 done;
696 method;
697 lie;
698 remove(n,integer);
699 done;
701 /*  190  */ 
702 (pn_(190),ans:contrib_ode(eqn:sqrt(x^2-1)*'diff(y,x,1)-sqrt(y^2-1),y,x));
703 [log(2*sqrt(y^2-1)+2*y)=log(2*sqrt(x^2-1)+2*x)+%c];
704 [method,ode_check(eqn,ans[1])];
705 [separable,0];
707 /*  191  */ 
708 (pn_(191),ans:contrib_ode(eqn:sqrt(1-x^2)*'diff(y,x,1)-y*sqrt(y^2-1),y,x));
709 [-asin(1/abs(y))=asin(x)+%c];
710 [method,ode_check(eqn,ans[1])];
711 [separable,0];
713 /*  192  */ 
714 (pn_(192),ans:contrib_ode(eqn:sqrt(x^2+a^2)*'diff(y,x,1)+y-sqrt(x^2+a^2)+x,y,x));
715 [y = %e^-asinh(x/abs(a))*(((a^2*log(sqrt(x^2/a^2+1)+x/abs(a)))/2
716                                +(x*sqrt(x^2+a^2))/2)
717                                /a
718                                -((x*sqrt(x^2+a^2))/2
719                                 -(a^2*log(sqrt(x^2/a^2+1)+x/abs(a)))/2)
720                                 /abs(a)+((a-abs(a))*x^2)/(2*a*abs(a))+%c)]$
721 assume(a>0);  /* Just check when a>0 */
722 [a>0];
723 logarc( expand(ans[1],0,0));
724 y = (((a^2*log(sqrt(x^2/a^2+1)+x/a))/2+(x*sqrt(x^2+a^2))/2)/a
725          -((x*sqrt(x^2+a^2))/2-(a^2*log(sqrt(x^2/a^2+1)+x/a))/2)/a+%c)
726          /(sqrt(x^2/a^2+1)+x/a)$
727 [method,ode_check(eqn,%)];
728 [linear,0];
729 forget(a>0);
730 [a>0];
732 /*  193  */ 
733 (pn_(193),ans:contrib_ode(eqn:x*log(x)*'diff(y,x,1)+y-a*x*(log(x)+1),y,x));
734 [y=(a*(x*log(x)-x)+a*x+%c)/log(x)];
735 [method,ode_check(eqn,ans[1])];
736 [linear,0];
738 /*  194  */ 
739 (pn_(194),ans:contrib_ode(eqn:x*log(x)*'diff(y,x,1)-log(x)*y^2+(-2*log(x)^2-1)*y-log(x)^3,y,x));
740 [y=-((%c*log(x)^3+(2*%c+2)*log(x))/(%c*log(x)^2+2))];
741 [method,ode_check(eqn,ans[1])];
742 [riccati,0];
744 /*  195  */ 
745 (pn_(195),ans:contrib_ode(eqn:sin(x)*'diff(y,x,1)-sin(x)^2*y^2+(cos(x)-3*sin(x))*y+4,y,x));
746 [y=-((4*%e^(5*x)-%c)/((%e^(5*x)+%c)*sin(x)))];
747 [method,ode_check(eqn,ans[1])];
748 [riccati,0];
750 /*  196  */ 
751 /* FIXME:  This test now prompts - 2006-10-02
752 (pn_(196),ans:contrib_ode(eqn:cos(x)*'diff(y,x,1)+y+cos(x)*(sin(x)+1),y,x));
753 [y = %e^(log(sin(x)-1)/2-log(sin(x)+1)/2)
754      *('integrate((-sin(x)-1)*%e^(log(sin(x)+1)/2-log(sin(x)-1)/2),x)+%c)];
755 ans:radcan(ans[1]);
756 y=-sqrt(sin(x)-1)*('integrate((sin(x)+1)^(3/2)/sqrt(sin(x)-1),x)-%c)
757   /sqrt(sin(x)+1);
758 [method,ode_check(eqn,ans)];
759 [linear,0];
761 /*  197  */ 
762 (pn_(197),ans:contrib_ode(eqn:cos(x)*'diff(y,x,1)-y^4-sin(x)*y,y,x));
763 [y=1/(cos(x)*(%c-3*(tan(x)^3/3+tan(x)))^(1/3))];
764 [method,ode_check(eqn,ans[1])];
765 [bernoulli,0];
767 /*  198  FIXME: This now fails.  May be a maxima bug.  Jan 2007 */
768 /* 
769 (pn_(198),ans:contrib_ode(eqn:cos(x)*sin(x)*'diff(y,x,1)-y-sin(x)^3,y,x));
770 [y=sin(x)*(%c-sqrt(sin(x)^2-1))*%e^-(log(sin(x)^2-1)/2)];
771 [method,ode_check(eqn,ans[1])];
772 [linear,0];
775 /*  199  - also Murphy 1.129 */ 
776 (pn_(199),ans:contrib_ode(eqn:sin(2*y)+sin(2*x)*'diff(y,x,1),y,x));
777 [(log(cos(2*y)+1)-log(cos(2*y)-1))/4=%c-(log(cos(2*x)+1)-log(cos(2*x)-1))/4];
778 trigsimp(map(exp,4*ans[1]));
779 (cos(2*y)+1)/(cos(2*y)-1) = (%e^(4*%c)*cos(2*x)-%e^(4*%c))/(cos(2*x)+1);
780 subst(%c,exp(4*%c),%);
781 (cos(2*y)+1)/(cos(2*y)-1)=(%c*cos(2*x)-%c)/(cos(2*x)+1);
782 solve(%,y);
783 [y = acos(%c*cos(2*x)/(%c*cos(2*x)-cos(2*x)-%c-1)
784     +cos(2*x)/(%c*cos(2*x)-cos(2*x)-%c-1)-%c/(%c*cos(2*x)-cos(2*x)-%c-1)
785     +1/(%c*cos(2*x)-cos(2*x)-%c-1))/2];
786 [method,ode_check(eqn,%[1])];
787 [separable,0];
789 /*  200  */ 
790 (pn_(200),ans:contrib_ode(eqn:(a*sin(x)^2+b)*'diff(y,x,1)+a*sin(2*x)*y+A*x*(a*sin(x)^2+c),y,x));
791 [y=((A*a*(2*x*sin(2*x)+cos(2*x)-2*x^2))/8-(A*c*x^2)/2+%c)/(a*sin(x)^2+b)];
792 [method,ode_check(eqn,ans[1])];
793 [linear,0];