Fix typo in display-html-help
[maxima.git] / share / contrib / diffequations / tests / rtest_ode1_riccati.mac
blob69997206492929124570fb0c9ae3e9ecbde0c002
1 (load("contrib_ode"),0);
2 0$
4 /* Test cases for ode1_riccati.mac functions */
6 /* Test cases with n=2*a   ode1_riccati_special(a,b,c,n,y,x)*/
7 eq:x*'diff(y,x)-a*y+b*y^2=c*x^n;
8 x*'diff(y,x)-a*y+b*y^2=c*x^n;
10 /* Case a.i.1 n=2*a, b>0, c>0 */
11 (print("Special Riccati equation: Case a.i.1: n=2*a, b>0, c>0"),done);
12 done;
13 ans:ode1_riccati_special(a:1,b:1,c:1,n:2,y,x);
14 y=x*tanh(x+%c);
15 ode_check(eq,ans);
17 ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=x^2,y,x);
18 y=x*tanh(x+%c);
19 ode_check(eqn,ans);
21 ans:ode1_riccati_special(a:2,b:2,c:3,n:4,y,x);
22 y=sqrt(3)*x^2*tanh(sqrt(6)*x^2/2+%c)/sqrt(2);
23 radcan(ode_check(eq,ans));
25 ans:ode1_riccati_special(a:3,b:2,c:3,n:6,y,x);
26 y=sqrt(3)*x^3*tanh(sqrt(6)*x^3/3+%c)/sqrt(2);
27 radcan(ode_check(eq,ans));
29 ans:ode1_riccati_special(a:-1,b:2,c:3,n:-2,y,x);
30 y=-sqrt(3)*tanh(sqrt(6)/x-%c)/(sqrt(2)*x);
31 radcan(ode_check(eq,ans));
34 /* Case a.i.2 n=2*a, b<0, c<0 */
35 (print("Special Riccati equation: Case a.i.2: n=2*a, b<0, c<0"),done);
36 done;
37 ans:ode1_riccati_special(a:1,b:-1,c:-1,n:2,y,x);
38 y=-x*tanh(x-%c);
39 ode_check(eq,ans);
41 ans:ode1_riccati(eqn:x*'diff(y,x)-y-y^2=-x^2,y,x);
42 y=-x*tanh(x-%c);
43 ode_check(eqn,ans);
45 ans:ode1_riccati_special(a:2,b:-2,c:-3,n:4,y,x);
46 y=-sqrt(3)*x^2*tanh(sqrt(6)*x^2/2-%c)/sqrt(2);
47 radcan(ode_check(eq,ans));
49 ans:ode1_riccati_special(a:3,b:-2,c:-3,n:6,y,x);
50 y=-sqrt(3)*x^3*tanh(sqrt(6)*x^3/3-%c)/sqrt(2);
51 radcan(ode_check(eq,ans));
53 ans:ode1_riccati_special(a:-1,b:-2,c:-3,n:-2,y,x);
54 y=sqrt(3)*tanh(sqrt(6)/x+%c)/(sqrt(2)*x);
55 radcan(ode_check(eq,ans));
58 /* Case a.i.3 n=2*a, b>0, c<0 */
59 (print("Special Riccati equation: Case a.i.3: n=2*a, b>0, c<0"),done);
60 done;
61 ans:ode1_riccati_special(a:1,b:1,c:-1,n:2,y,x);
62 y=-x*tan(x-%c);
63 trigsimp(ode_check(eq,ans));
65 ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=-x^2,y,x);
66 y=-x*tan(x-%c);
67 trigsimp(ode_check(eqn,ans));
69 ans:ode1_riccati_special(a:2,b:2,c:-3,n:4,y,x);
70 y=-sqrt(3)*x^2*tan(sqrt(6)*x^2/2-%c)/sqrt(2);
71 radcan(trigsimp(ode_check(eq,ans)));
73 ans:ode1_riccati_special(a:3,b:2,c:-3,n:6,y,x);
74 y=-sqrt(3)*x^3*tan(sqrt(6)*x^3/3-%c)/sqrt(2);
75 radcan(ode_check(eq,ans));
77 ans:ode1_riccati_special(a:-1,b:2,c:-3,n:-2,y,x);
78 y=sqrt(3)*tan(sqrt(6)/x+%c)/(sqrt(2)*x);
79 radcan(ode_check(eq,ans));
82 /* Case a.i.4 n=2*a, b<0, c>0 */
83 (print("Special Riccati equation: Case a.i.4: n=2*a, b<0, c>0"),done);
84 done;
85 ans:ode1_riccati_special(a:1,b:-1,c:1,n:2,y,x);
86 y=x*tan(x+%c);
87 ode_check(eq,ans);
89 ans:ode1_riccati(eqn:x*'diff(y,x)-y-y^2=x^2,y,x);
90 y=x*tan(x+%c);
91 ode_check(eqn,ans);
93 ans:ode1_riccati_special(a:2,b:-2,c:3,n:4,y,x);
94 y=sqrt(3)*x^2*tan(sqrt(6)*x^2/2+%c)/sqrt(2);
95 radcan(ode_check(eq,ans));
97 ans:ode1_riccati_special(a:3,b:-2,c:3,n:6,y,x);
98 y=sqrt(3)*x^3*tan(sqrt(6)*x^3/3+%c)/sqrt(2);
99 radcan(ode_check(eq,ans));
101 ans:ode1_riccati_special(a:-1,b:-2,c:3,n:-2,y,x);
102 y=-sqrt(3)*tan(sqrt(6)/x-%c)/(sqrt(2)*x);
103 radcan(ode_check(eq,ans));
105 kill(a,b,c,n);
106 done;
108 /* Check that the sign of b and c is handled correctly */
109 assume(b>0,c>0);
110 [b>0,c>0];
111 ode1_riccati_special(2,b,c,4,y,x);
112 y=sqrt(c)*x^2*tanh(sqrt(b)*sqrt(c)*x^2/2+%c)/sqrt(b);
113 ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
114 y=sqrt(c)*x^2*tanh(sqrt(b)*sqrt(c)*x^2/2+%c)/sqrt(b);
115 ode_check(eqn,ans);
117 forget(b>0,c>0);
118 [b>0,c>0];
120 assume(b<0,c<0);
121 [b<0,c<0];
122 ans:ode1_riccati_special(2,b,c,4,y,x);
123 y=-sqrt(-c)*x^2*tanh(sqrt(-b)*sqrt(-c)*x^2/2-%c)/sqrt(-b);
124 ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
125 y=-sqrt(-c)*x^2*tanh(sqrt(-b)*sqrt(-c)*x^2/2-%c)/sqrt(-b);
126 ode_check(eqn,ans);
128 forget(b<0,c<0);
129 [b<0,c<0];
131 assume(b>0,c<0);
132 [b>0,c<0];
133 ode1_riccati_special(2,b,c,4,y,x);
134 y=-sqrt(-c)*x^2*tan(sqrt(b)*sqrt(-c)*x^2/2-%c)/sqrt(b);
135 ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
136 y=-sqrt(-c)*x^2*tan(sqrt(b)*sqrt(-c)*x^2/2-%c)/sqrt(b);
137 ode_check(eqn,ans);
139 forget(b>0,c<0);
140 [b>0,c<0];
142 assume(b<0,c>0);
143 [b<0,c>0];
144 ode1_riccati_special(2,b,c,4,y,x);
145 y=sqrt(c)*x^2*tan(sqrt(-b)*sqrt(c)*x^2/2+%c)/sqrt(-b);
146 ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
147 y=sqrt(c)*x^2*tan(sqrt(-b)*sqrt(c)*x^2/2+%c)/sqrt(-b);
148 ode_check(eqn,ans);
150 forget(b<0,c>0);
151 [b<0,c>0];
153 /* Tests for ode1_riccati_special - Case ii: (n-2*a)/2n=k , positive integer */
154 /* k=2 */
155 ans:ode1_riccati_special(a:1,b:1,c:1,n:-2/3,y,x);
156 y=1/((1/3-1/(tanh(3/x^(1/3)-%c)*x^(1/3)))*x^(2/3))+1;
157 ode_check(eq,ans);
159 ans:ode1_riccati_special(a:2,b:1,c:1,n:-4/3,y,x);
160 y=1/((2/3-1/(tanh(3/(2*x^(2/3))-%c)*x^(2/3)))*x^(4/3))+2;
161 ode_check(eq,ans);
163 ans:ode1_riccati_special(a:-3/2,b:1,c:1,n:1,y,x);
164 y=x/(sqrt(x)/tanh(2*sqrt(x)+%c)-1/2)-3/2;
165 ode_check(eq,ans);
167 ans:ode1_riccati_special(a:3/2,b:1,c:1,n:-1,y,x);
168 y=1/((1/2-1/(tanh(2/sqrt(x)-%c)*sqrt(x)))*x)+3/2;
169 ode_check(eq,ans);
171 ans:ode1_riccati_special(a:-3/2,b:4,c:9,n:1,y,x);
172 y=x/(2*sqrt(x)/(3*tanh(12*sqrt(x)+%c))-1/18)-3/8;
173 ode_check(eq,ans);
176 /* Tests for ode1_riccati_special - Case iii: (n+2*a)/2n=k , positive integer */
177 /* k=2 */
178 ans:ode1_riccati_special(a:1,b:1,c:1,n:2/3,y,x);
179 y=x^(2/3)/(x^(1/3)/tanh(3*x^(1/3)+%c)-1/3);
180 ode_check(eq,ans);
182 ans:ode1_riccati_special(a:2,b:1,c:1,n:4/3,y,x);
183 y=x^(4/3)/(x^(2/3)/tanh(3*x^(2/3)/2+%c)-2/3);
184 ode_check(eq,ans);
186 ans:ode1_riccati_special(a:3/2,b:1,c:1,n:1,y,x);
187 y = x/(sqrt(x)/tanh(2*sqrt(x)+%c)-1/2);
188 ode_check(eq,ans);
190 ans:ode1_riccati_special(a:3,b:1,c:1,n:2,y,x);
191 y = x^2/(x/tanh(x+%c)-1);
192 ode_check(eq,ans);
194 ans:ode1_riccati_special(a:3,b:-9,c:4,n:2,y,x);
195 y=x^2/(3*x/(2*tan(6*x+%c))-1/4);
196 ode_check(eq,ans);
199 /* Tests for ode1_riccati_special - Case c: not integrable  a#0 */
201 /* Bessel function of integer order - easy to check */
202 ans:ode1_riccati_special(a:1,b:-1,c:1,n:1,y,x);
203 y=(((bessel_y(2,2*sqrt(x))-bessel_y(0,2*sqrt(x)))*%c
204     +bessel_j(2,2*sqrt(x))-bessel_j(0,2*sqrt(x)))*sqrt(x)
205     -bessel_y(1,2*sqrt(x))*%c-bessel_j(1,2*sqrt(x)))
206  /(2*bessel_y(1,2*sqrt(x))*%c+2*bessel_j(1,2*sqrt(x)));
207 ode_check(eq,ans);
210 ans:ode1_riccati_special(a:1,b:-2,c:3,n:1,y,x);
211 y = (((sqrt(6)*bessel_y(2,2*sqrt(6)*sqrt(x))
212          -sqrt(6)*bessel_y(0,2*sqrt(6)*sqrt(x)))
213          *%c
214          +sqrt(6)*bessel_j(2,2*sqrt(6)*sqrt(x))
215          -sqrt(6)*bessel_j(0,2*sqrt(6)*sqrt(x)))
216          *sqrt(x)
217          -bessel_y(1,2*sqrt(6)*sqrt(x))*%c-bessel_j(1,2*sqrt(6)*sqrt(x)))
218          /(4*bessel_y(1,2*sqrt(6)*sqrt(x))*%c
219           +4*bessel_j(1,2*sqrt(6)*sqrt(x)));
220 ode_check(eq,ans);
223 assume(x>0);
224 [x>0];
225 ans:ode1_riccati_special(a:2,b:-2,c:3,n:2,y,x);
226 y = (((sqrt(2)*sqrt(3)*bessel_y(2,2*sqrt(3)*x/sqrt(2))
227       -sqrt(2)*sqrt(3)*bessel_y(0,2*sqrt(3)*x/sqrt(2)))*%c
228       +sqrt(2)*sqrt(3)*bessel_j(2,2*sqrt(3)*x/sqrt(2))
229       -sqrt(2)*sqrt(3)*bessel_j(0,2*sqrt(3)*x/sqrt(2)))*x
230       -2*bessel_y(1,2*sqrt(3)*x/sqrt(2))*%c
231       -2*bessel_j(1,2*sqrt(3)*x/sqrt(2)))
232  /(4*bessel_y(1,2*sqrt(3)*x/sqrt(2))*%c+4*bessel_j(1,2*sqrt(3)*x/sqrt(2)));
233 ode_check(eq,ans);
235 forget(x>0);
236 [x>0];
238 /* Cases that end up in ode1_riccati_original with m=-2 */
239 ans:ode1_riccati_special(a:1,b:-1,c:1,n:0,y,x);
240 y = -(((%c-sqrt(3))*sin(sqrt(3)*log(x)/2)+(sqrt(3)*%c+1)*cos(sqrt(3)*log(x)/2))
241 /(2*%c*sin(sqrt(3)*log(x)/2)+2*cos(sqrt(3)*log(x)/2)));
242 ode_check(eq,ans);
245 ans:ode1_riccati_special(a:1,b:1,c:1,n:0,y,x);
246 y=((sqrt(5)+1)*x^sqrt(5)+(1-sqrt(5))*%c)/(2*x^sqrt(5)+2*%c);
247 ode_check(eq,ans);
250 ans:ode1_riccati_special(a:1,b:-1/4,c:1,n:0,y,x);
251 y=-((2*%c*log(x)+4*%c+2)/(%c*log(x)+1));
252 ode_check(eq,ans);
255 /* Cases with a=0 and b*c<0 */
256 ans:ode1_riccati_special(a:0,b:-1,c:1,n:2,y,x);
257 y=(bessel_y(1,x)*%c+bessel_j(1,x))*x/(bessel_y(0,x)*%c+bessel_j(0,x));
258 ode_check(eq,ans);
261 ans:ode1_riccati_special(a:0,b:-1,c:1,n:1,y,x);
262 y=(bessel_y(1,2*sqrt(x))*%c+bessel_j(1,2*sqrt(x)))*sqrt(x)/(bessel_y(0,2*sqrt(x))*%c+bessel_j(0,2*sqrt(x)));
263 ode_check(eq,ans);
266 /* Cases with a=0 and b*c>0 */
267 ans:ode1_riccati_special(a:0,b:1,c:1,n:2,y,x);
268 y=-((bessel_k(1,x)*%c-bessel_i(1,x))*x/(bessel_k(0,x)*%c+bessel_i(0,x)));
269 ode_check(eq,ans);
272 ans:ode1_riccati_special(a:0,b:1,c:1,n:1,y,x);
273 y=-((bessel_k(1,2*sqrt(x))*%c-bessel_i(1,2*sqrt(x)))*sqrt(x)/(bessel_k(0,2*sqrt(x))*%c+bessel_i(0,2*sqrt(x))));
274 ode_check(eq,ans);
277 kill(a,b,c,n);
278 done;
280 /* some tests for ode1_riccati_original */
281 eqn:'diff(y,x)+b*y^2=c*x^m;
282 'diff(y,x)+b*y^2=c*x^m;
283 /* Case  m*(2*k+1)+4*k=0 and k=0 => m=0 
284    also  m*(2*k-1)+4*k=0 and k=0 => m=0 */
285 ans:ode1_riccati_original(b:4,c:1,m:0,y,x);
286 y=tanh(2*x+%c)/2;
287 ode_check(eqn,ans);
289 ans:ode1_riccati_original(b:-4,c:1,m:0,y,x);
290 y=tan(2*x+%c)/2;
291 ode_check(eqn,ans);
293 ans:ode1_riccati_original(b:4,c:-1,m:0,y,x);
294 y=-tan(2*x-%c)/2;
295 ode_check(eqn,ans);
297 ans:ode1_riccati_original(b:-4,c:-1,m:0,y,x);
298 y=-tanh(2*x-%c)/2;
299 ode_check(eqn,ans);
302 /* Case m*(2*k+1)+4*k=0, k positive integer */
303 /* m=-4/3  k=1 */
304 ans:ode1_riccati_original(b:1,c:1,m:-4/3,y,x);
305 y=3*tanh(3*x^(1/3)+%c)/(3*x^(2/3)-tanh(3*x^(1/3)+%c)*x^(1/3));
306 ode_check(eqn,ans);
308 /* m=-8/5  k=2 */
309 ans:ode1_riccati_original(b:-1,c:1,m:-8/5,y,x);
310 y=-((25*x^(1/5)-5*tan(5*x^(1/5)-%c))/(25*tan(5*x^(1/5)-%c)*x+15*x^(4/5)-3*tan(5*x^(1/5)-%c)*x^(3/5)));
311 /* This is correct - checking takes too long for testsuite */
312 /* m=-12/7  k=3 */
313 ans:ode1_riccati_original(b:1,c:1,m:-12/7,y,x);
314 y=(343*tanh(7*x^(1/7)+%c)*x^(2/7)-147*x^(1/7)+21*tanh(7*x^(1/7)+%c))/(343*x^(8/7)-294*tanh(7*x^(1/7)+%c)*x+105*x^(6/7)-15*tanh(7*x^(1/7)+%c)*x^(5/7));
315 /* This is correct - checking takes too long for testsuite */
317 /* Case m*(2*k-1)+4*k=0, k positive integer */
318 /* m=-4, k=1 */
319 ans:ode1_riccati_original(b:1,c:1,m:-4,y,x);
320 y=(x*tanh((%c*x-1)/x)+1)/(x^2*tanh((%c*x-1)/x));
321 ode_check(eqn,ans);
323 /* m=-8/3 k=2 */
324 ans:ode1_riccati_original(b:1,c:1,m:-8/3,y,x);
325 y=(tanh((%c*x^(1/3)-3)/x^(1/3))*x+3*x^(2/3)+3*tanh((%c*x^(1/3)-3)/x^(1/3))*x^(1/3))/(tanh((%c*x^(1/3)-3)/x^(1/3))*x^2+3*x^(5/3));
326 ode_check(eqn,ratsimp(exponentialize(ans)));
328 /* m=-12/5 k=3 */
329 ans:ode1_riccati_original(b:1,c:1,m:-12/5,y,x);
330 y=(3*tanh((%c*x^(1/5)-5)/x^(1/5))*x^(3/5)+15*x^(2/5)+30*tanh((%c*x^(1/5)-5)/x^(1/5))*x^(1/5)+25)/(3*tanh((%c*x^(1/5)-5)/x^(1/5))*x^(8/5)+15*x^(7/5)+25*tanh((%c*x^(1/5)-5)/x^(1/5))*x^(6/5));
331 /* ode_check(eqn,ratsimp(exponentialize(ans)));
332 0;  eventually */
333 /* m=-16/7 k=4 */
334 ans:ode1_riccati_original(b:1,c:1,m:-16/7,y,x);
335 y=(15*tanh((%c*x^(1/7)-7)/x^(1/7))*x^(4/7)+105*x^(3/7)+315*tanh((%c*x^(1/7)-7)/x^(1/7))*x^(2/7)+490*x^(1/7)+343*tanh((%c*x^(1/7)-7)/x^(1/7)))/(15*tanh((%c*x^(1/7)-7)/x^(1/7))*x^(11/7)+105*x^(10/7)+294*tanh((%c*x^(1/7)-7)/x^(1/7))*x^(9/7)+343*x^(8/7));
336 /* ode_check(eqn,ratsimp(exponentialize(ans)));
337 0;  eventually */
339 /* Bessel function solution - integer order with b*c<0 */
340 ans:ode1_riccati_original(b:3,c:-2,m:-1,y,x);
341 y = -((((sqrt(6)*bessel_y(2,2*sqrt(6)*sqrt(x))
342        -sqrt(6)*bessel_y(0,2*sqrt(6)*sqrt(x)))*%c
343        +sqrt(6)*bessel_j(2,2*sqrt(6)*sqrt(x))
344        -sqrt(6)*bessel_j(0,2*sqrt(6)*sqrt(x)))*sqrt(x)
345     -bessel_y(1,2*sqrt(6)*sqrt(x))*%c-bessel_j(1,2*sqrt(6)*sqrt(x)))
346   /((6*bessel_y(1,2*sqrt(6)*sqrt(x))*%c+6*bessel_j(1,2*sqrt(6)*sqrt(x)))*x));
347 ode_check(eqn,ans);
350 /* Bessel function solution - integer order with b*c>0 */
351 assume(x>0);
352 [x>0];
353 ans:ode1_riccati_original(b:3,c:2,m:-1,y,x);
354 y = -((((sqrt(6)*bessel_k(2,2*sqrt(6)*sqrt(x))
355         +sqrt(6)*bessel_k(0,2*sqrt(6)*sqrt(x)))*%c
356         -sqrt(6)*bessel_i(2,2*sqrt(6)*sqrt(x))
357         -sqrt(6)*bessel_i(0,2*sqrt(6)*sqrt(x)))*sqrt(x)
358         -bessel_k(1,2*sqrt(6)*sqrt(x))*%c-bessel_i(1,2*sqrt(6)*sqrt(x)))
359   /((6*bessel_k(1,2*sqrt(6)*sqrt(x))*%c
360     +6*bessel_i(1,2*sqrt(6)*sqrt(x)))*x));
361 ode_check(eqn,ans);
363 forget(x>0);
364 [x>0];
366 /* Bessel function solution - non-integer order b*c<0 */
367 ans:ode1_riccati_original(b:1,c:-1,m:2,y,x);
368 y = -((((bessel_j(3/4,x^2/2)-bessel_j(-5/4,x^2/2))*%c
369        +bessel_j(5/4,x^2/2)-bessel_j(-3/4,x^2/2))*x^2
370        -bessel_j(-1/4,x^2/2)*%c-bessel_j(1/4,x^2/2))
371     /((2*bessel_j(-1/4,x^2/2)*%c+2*bessel_j(1/4,x^2/2))*x));
372 ode_check(eqn,ans);
375 /* Bessel function solution - non-integer order b*c>0 */
376 assume(x>0);
377 [x>0];
378 ans:ode1_riccati_original(b:2,c:3,m:-5,y,x);
379 y = -(((-bessel_k(1/3,-(2*sqrt(6))/(3*x^(3/2)))*%c)
380           -bessel_i(-1/3,-(2*sqrt(6))/(3*x^(3/2))))
381           *x^2
382           +((sqrt(6)*bessel_k(4/3,-(2*sqrt(6))/(3*x^(3/2)))
383            +sqrt(6)*bessel_k(2/3,-(2*sqrt(6))/(3*x^(3/2))))
384            *%c
385            -sqrt(6)*bessel_i(2/3,-(2*sqrt(6))/(3*x^(3/2)))
386            -sqrt(6)*bessel_i(-4/3,-(2*sqrt(6))/(3*x^(3/2))))
387            *sqrt(x))
388           /((4*bessel_k(1/3,-(2*sqrt(6))/(3*x^(3/2)))*%c
389            +4*bessel_i(-1/3,-(2*sqrt(6))/(3*x^(3/2))))
390            *x^3);
391 ode_check(eqn,ans);
393 forget(x>0);
394 [x>0];
396 /* Original Riccati equation: m=-2 Case i */
397 ans:ode1_riccati_original(b:2,c:-3,m:-2,y,x);
398 y=((%c-sqrt(23))*sin(sqrt(23)*log(x)/2)+(sqrt(23)*%c+1)*cos(sqrt(23)*log(x)/2))
399   /(4*%c*x*sin(sqrt(23)*log(x)/2)+4*x*cos(sqrt(23)*log(x)/2));
400 ode_check(eqn,ans);
403 /* Original Riccati equation: m=-2 Case ii */
404 ans:ode1_riccati_original(b:2,c:3,m:-2,y,x);
405 y=(3*x^5-2*%c)/(2*x^6+2*%c*x);
406 ode_check(eqn,ans);
409 /* Original Riccati equation: m=-2 Case iii */
410 ans:ode1_riccati_original(b:1,c:-1/4,m:-2,y,x);
411 y=(%c*log(x)+2*%c+1)/(2*%c*x*log(x)+2*x);
412 ode_check(eqn,ans);
415 kill(b,c,m);
416 done;
418 /* Murphy 249 (3-3) */
419 ans:contrib_ode(eqn:3*x*'diff(y,x)=3*x^(2/3)+(1-3*y)*y,y,x);
420 [y=tanh(3*x^(1/3)+%c)*x^(1/3)];
421 ode_check(eqn,ans[1]);
424 /* murphy 373  (3-2) */
425 assume(a>0);
426 [a>0];
427 ans:ode1_riccati(eqn:x^4*'diff(y,x)+a^2+x^4*y^2=0,y,x);
428 y=(x*tan((%c*x-a)/x)+a)/(x^2*tan((%c*x-a)/x));
429 ode_check(eqn,ans);
431 forget(a>0);
432 [a>0];
434 /* Murphy 168 - Case (a.iii) with k = 2 */
435 ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=x^(2/3),y,x);
436 y=x^(2/3)/(x^(1/3)/tanh(3*x^(1/3)+%c)-1/3);
437 ode_check(eqn,ans);