~ubuntu-branches/ubuntu/karmic/maxima/karmic

« back to all changes in this revision

Viewing changes to share/contrib/diffequations/tests/rtest_ode1_riccati.mac

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-11-13 18:39:14 UTC
  • mto: (2.1.2 hoary) (3.2.1 sid) (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041113183914-ttig0evwuatnqosl
Tags: upstream-5.9.1
ImportĀ upstreamĀ versionĀ 5.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Test cases for ode1_riccati.mac functions
 
2
 
 
3
   Do not kill(all); It messes up trigsimp */
 
4
 
 
5
/* Need these indentities to check solutions */
 
6
besjident(n,x):=bessel_j(n,x)=2*(n-1)*bessel_j(n-1,x)/x-bessel_j(n-2,x);
 
7
besjident(n,x):=bessel_j(n,x)=2*(n-1)*bessel_j(n-1,x)/x-bessel_j(n-2,x);
 
8
besiident(n,x):=bessel_i(n,x)=-2*(n-1)*bessel_i(n-1,x)/x+bessel_i(n-2,x);
 
9
besiident(n,x):=bessel_i(n,x)=-2*(n-1)*bessel_i(n-1,x)/x+bessel_i(n-2,x);
 
10
beskident(n,x):=bessel_k(n,x)=2*(n-1)*bessel_k(n-1,x)/x+bessel_k(n-2,x);
 
11
beskident(n,x):=bessel_k(n,x)=2*(n-1)*bessel_k(n-1,x)/x+bessel_k(n-2,x);
 
12
 
 
13
/* Test cases with n=2*a   ode1_riccati_special(a,b,c,n,y,x)*/
 
14
eq:x*'diff(y,x)-a*y+b*y^2=c*x^n;
 
15
x*'diff(y,x)-a*y+b*y^2=c*x^n;
 
16
 
 
17
/* Case a.i.1 n=2*a, b>0, c>0 */
 
18
(print("Special Riccati equation: Case a.i.1: n=2*a, b>0, c>0"),done);
 
19
done;
 
20
ans:ode1_riccati_special(a:1,b:1,c:1,n:2,y,x);
 
21
y=x*tanh(x+%c);
 
22
trigsimp(ode_check(eq,ans));
 
23
0;
 
24
ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=x^2,y,x);
 
25
y=x*tanh(x+%c);
 
26
trigsimp(ode_check(eqn,ans));
 
27
0;
 
28
ans:ode1_riccati_special(a:2,b:2,c:3,n:4,y,x);
 
29
y=sqrt(3)*x^2*tanh(sqrt(6)*x^2/2+%c)/sqrt(2);
 
30
trigsimp(ode_check(eq,ans));
 
31
0;
 
32
ans:ode1_riccati_special(a:3,b:2,c:3,n:6,y,x);
 
33
y=sqrt(3)*x^3*tanh(sqrt(6)*x^3/3+%c)/sqrt(2);
 
34
trigsimp(ode_check(eq,ans));
 
35
0;
 
36
ans:ode1_riccati_special(a:-1,b:2,c:3,n:-2,y,x);
 
37
y=-sqrt(3)*tanh(sqrt(6)/x-%c)/(sqrt(2)*x);
 
38
trigsimp(ode_check(eq,ans));
 
39
0;
 
40
 
 
41
/* Case a.i.2 n=2*a, b<0, c<0 */
 
42
(print("Special Riccati equation: Case a.i.2: n=2*a, b<0, c<0"),done);
 
43
done;
 
44
ans:ode1_riccati_special(a:1,b:-1,c:-1,n:2,y,x);
 
45
y=-x*tanh(x-%c);
 
46
trigsimp(ode_check(eq,ans));
 
47
0;
 
48
ans:ode1_riccati(eqn:x*'diff(y,x)-y-y^2=-x^2,y,x);
 
49
y=-x*tanh(x-%c);
 
50
trigsimp(ode_check(eqn,ans));
 
51
0;
 
52
ans:ode1_riccati_special(a:2,b:-2,c:-3,n:4,y,x);
 
53
y=-sqrt(3)*x^2*tanh(sqrt(6)*x^2/2-%c)/sqrt(2);
 
54
trigsimp(ode_check(eq,ans));
 
55
0;
 
56
ans:ode1_riccati_special(a:3,b:-2,c:-3,n:6,y,x);
 
57
y=-sqrt(3)*x^3*tanh(sqrt(6)*x^3/3-%c)/sqrt(2);
 
58
trigsimp(ode_check(eq,ans));
 
59
0;
 
60
ans:ode1_riccati_special(a:-1,b:-2,c:-3,n:-2,y,x);
 
61
y=sqrt(3)*tanh(sqrt(6)/x+%c)/(sqrt(2)*x);
 
62
trigsimp(ode_check(eq,ans));
 
63
0;
 
64
 
 
65
/* Case a.i.3 n=2*a, b>0, c<0 */
 
66
(print("Special Riccati equation: Case a.i.3: n=2*a, b>0, c<0"),done);
 
67
done;
 
68
ans:ode1_riccati_special(a:1,b:1,c:-1,n:2,y,x);
 
69
y=-x*tan(x-%c);
 
70
trigsimp(ode_check(eq,ans));
 
71
0;
 
72
ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=-x^2,y,x);
 
73
y=-x*tan(x-%c);
 
74
trigsimp(ode_check(eqn,ans));
 
75
0;
 
76
ans:ode1_riccati_special(a:2,b:2,c:-3,n:4,y,x);
 
77
y=-sqrt(3)*x^2*tan(sqrt(6)*x^2/2-%c)/sqrt(2);
 
78
trigsimp(ode_check(eq,ans));
 
79
0;
 
80
ans:ode1_riccati_special(a:3,b:2,c:-3,n:6,y,x);
 
81
y=-sqrt(3)*x^3*tan(sqrt(6)*x^3/3-%c)/sqrt(2);
 
82
trigsimp(ode_check(eq,ans));
 
83
0;
 
84
ans:ode1_riccati_special(a:-1,b:2,c:-3,n:-2,y,x);
 
85
y=sqrt(3)*tan(sqrt(6)/x+%c)/(sqrt(2)*x);
 
86
trigsimp(ode_check(eq,ans));
 
87
0;
 
88
 
 
89
/* Case a.i.4 n=2*a, b<0, c>0 */
 
90
(print("Special Riccati equation: Case a.i.4: n=2*a, b<0, c>0"),done);
 
91
done;
 
92
ans:ode1_riccati_special(a:1,b:-1,c:1,n:2,y,x);
 
93
y=x*tan(x+%c);
 
94
trigsimp(ode_check(eq,ans));
 
95
0;
 
96
ans:ode1_riccati(eqn:x*'diff(y,x)-y-y^2=x^2,y,x);
 
97
y=x*tan(x+%c);
 
98
trigsimp(ode_check(eqn,ans));
 
99
0;
 
100
ans:ode1_riccati_special(a:2,b:-2,c:3,n:4,y,x);
 
101
y=sqrt(3)*x^2*tan(sqrt(6)*x^2/2+%c)/sqrt(2);
 
102
trigsimp(ode_check(eq,ans));
 
103
0;
 
104
ans:ode1_riccati_special(a:3,b:-2,c:3,n:6,y,x);
 
105
y=sqrt(3)*x^3*tan(sqrt(6)*x^3/3+%c)/sqrt(2);
 
106
trigsimp(ode_check(eq,ans));
 
107
0;
 
108
ans:ode1_riccati_special(a:-1,b:-2,c:3,n:-2,y,x);
 
109
y=-sqrt(3)*tan(sqrt(6)/x-%c)/(sqrt(2)*x);
 
110
trigsimp(ode_check(eq,ans));
 
111
0;
 
112
kill(a,b,c,n);
 
113
done;
 
114
 
 
115
/* Check that the sign of b and c is handled correctly */
 
116
assume(b>0,c>0);
 
117
[b>0,c>0];
 
118
ode1_riccati_special(2,b,c,4,y,x);
 
119
y=sqrt(c)*x^2*tanh(sqrt(b)*sqrt(c)*x^2/2+%c)/sqrt(b);
 
120
ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
 
121
y=sqrt(c)*x^2*tanh(sqrt(b)*sqrt(c)*x^2/2+%c)/sqrt(b);
 
122
trigsimp(ode_check(eqn,ans));
 
123
0;
 
124
forget(b>0,c>0);
 
125
[b>0,c>0];
 
126
 
 
127
assume(b<0,c<0);
 
128
[b<0,c<0];
 
129
ans:ode1_riccati_special(2,b,c,4,y,x);
 
130
y=-sqrt(-c)*x^2*tanh(sqrt(-b)*sqrt(-c)*x^2/2-%c)/sqrt(-b);
 
131
ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
 
132
y=-sqrt(-c)*x^2*tanh(sqrt(-b)*sqrt(-c)*x^2/2-%c)/sqrt(-b);
 
133
trigsimp(ode_check(eqn,ans));
 
134
0;
 
135
forget(b<0,c<0);
 
136
[b<0,c<0];
 
137
 
 
138
assume(b>0,c<0);
 
139
[b>0,c<0];
 
140
ode1_riccati_special(2,b,c,4,y,x);
 
141
y=-sqrt(-c)*x^2*tan(sqrt(b)*sqrt(-c)*x^2/2-%c)/sqrt(b);
 
142
ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
 
143
y=-sqrt(-c)*x^2*tan(sqrt(b)*sqrt(-c)*x^2/2-%c)/sqrt(b);
 
144
trigsimp(ode_check(eqn,ans));
 
145
0;
 
146
forget(b>0,c<0);
 
147
[b>0,c<0];
 
148
 
 
149
assume(b<0,c>0);
 
150
[b<0,c>0];
 
151
ode1_riccati_special(2,b,c,4,y,x);
 
152
y=sqrt(c)*x^2*tan(sqrt(-b)*sqrt(c)*x^2/2+%c)/sqrt(-b);
 
153
ans:ode1_riccati(eqn:x*'diff(y,x)-2*y+b*y^2=c*x^4,y,x);
 
154
y=sqrt(c)*x^2*tan(sqrt(-b)*sqrt(c)*x^2/2+%c)/sqrt(-b);
 
155
trigsimp(ode_check(eqn,ans));
 
156
0;
 
157
forget(b<0,c>0);
 
158
[b<0,c>0];
 
159
 
 
160
/* Tests for ode1_riccati_special - Case ii: (n-2*a)/2n=k , positive integer */
 
161
/* k=2 */
 
162
ans:ode1_riccati_special(a:1,b:1,c:1,n:-2/3,y,x);
 
163
y=1/((1/3-1/(tanh(3/x^(1/3)-%c)*x^(1/3)))*x^(2/3))+1;
 
164
trigsimp(ode_check(eq,ans));
 
165
0;
 
166
ans:ode1_riccati_special(a:2,b:1,c:1,n:-4/3,y,x);
 
167
y=1/((2/3-1/(tanh(3/(2*x^(2/3))-%c)*x^(2/3)))*x^(4/3))+2;
 
168
trigsimp(ode_check(eq,ans));
 
169
0;
 
170
ans:ode1_riccati_special(a:-3/2,b:1,c:1,n:1,y,x);
 
171
y=x/(sqrt(x)/tanh(2*sqrt(x)+%c)-1/2)-3/2;
 
172
trigsimp(ode_check(eq,ans));
 
173
0;
 
174
ans:ode1_riccati_special(a:3/2,b:1,c:1,n:-1,y,x);
 
175
y=1/((1/2-1/(tanh(2/sqrt(x)-%c)*sqrt(x)))*x)+3/2;
 
176
trigsimp(ode_check(eq,ans));
 
177
0;
 
178
ans:ode1_riccati_special(a:-3/2,b:4,c:9,n:1,y,x);
 
179
y=x/(2*sqrt(x)/(3*tanh(12*sqrt(x)+%c))-1/18)-3/8;
 
180
trigsimp(ode_check(eq,ans));
 
181
0;
 
182
 
 
183
/* Tests for ode1_riccati_special - Case iii: (n+2*a)/2n=k , positive integer */
 
184
/* k=2 */
 
185
ans:ode1_riccati_special(a:1,b:1,c:1,n:2/3,y,x);
 
186
y=x^(2/3)/(x^(1/3)/tanh(3*x^(1/3)+%c)-1/3);
 
187
trigsimp(ode_check(eq,ans));
 
188
0;
 
189
ans:ode1_riccati_special(a:2,b:1,c:1,n:4/3,y,x);
 
190
y=x^(4/3)/(x^(2/3)/tanh(3*x^(2/3)/2+%c)-2/3);
 
191
trigsimp(ode_check(eq,ans));
 
192
0;
 
193
ans:ode1_riccati_special(a:3/2,b:1,c:1,n:1,y,x);
 
194
y = x/(sqrt(x)/tanh(2*sqrt(x)+%c)-1/2);
 
195
trigsimp(ode_check(eq,ans));
 
196
0;
 
197
ans:ode1_riccati_special(a:3,b:1,c:1,n:2,y,x);
 
198
y = x^2/(x/tanh(x+%c)-1);
 
199
trigsimp(ode_check(eq,ans));
 
200
0;
 
201
ans:ode1_riccati_special(a:3,b:-9,c:4,n:2,y,x);
 
202
y=x^2/(3*x/(2*tan(6*x+%c))-1/4);
 
203
trigsimp(ode_check(eq,ans));
 
204
0;
 
205
 
 
206
/* Tests for ode1_riccati_special - Case c: not integrable  a#0 */
 
207
 
 
208
/* Bessel function of integer order - easy to check */
 
209
ans:ode1_riccati_special(a:1,b:-1,c:1,n:1,y,x);
 
210
y=-(bessel_y(0,2*sqrt(x))*%c+bessel_j(0,2*sqrt(x)))*sqrt(x)/(bessel_y(1,2*sqrt(x))*%c+bessel_j(1,2*sqrt(x)));
 
211
ode_check(eq,ans);
 
212
0;
 
213
 
 
214
ans:ode1_riccati_special(a:1,b:-2,c:3,n:1,y,x);
 
215
y=-(sqrt(6)*bessel_y(0,2*sqrt(6)*sqrt(x))*%c+sqrt(6)*bessel_j(0,2*sqrt(6)*sqrt(x)))*sqrt(x)/(2*bessel_y(1,2*sqrt(6)*sqrt(x))*%c+2*bessel_j(1,2*sqrt(6)*sqrt(x)));
 
216
ode_check(eq,ans);
 
217
0;
 
218
 
 
219
assume(x>0);
 
220
[x>0];
 
221
ans:ode1_riccati_special(a:2,b:-2,c:3,n:2,y,x);
 
222
y=-(sqrt(2)*sqrt(3)*bessel_y(0,2*sqrt(3)*x/sqrt(2))*%c+sqrt(2)*sqrt(3)*bessel_j(0,2*sqrt(3)*x/sqrt(2)))*x/(2*bessel_y(1,2*sqrt(3)*x/sqrt(2))*%c+2*bessel_j(1,2*sqrt(3)*x/sqrt(2)));
 
223
ode_check(eq,ans);
 
224
0;
 
225
forget(x>0);
 
226
[x>0];
 
227
 
 
228
/* Cases that end up in ode1_riccati_original with m=-2 */
 
229
ans:ode1_riccati_special(a:1,b:-1,c:1,n:0,y,x);
 
230
y=-sqrt(x)*(sqrt(x)*(sqrt(3)*%c*cos(sqrt(3)*log(x)/2)/(2*x)-sqrt(3)*sin(sqrt(3)*log(x)/2)/(2*x))+(%c*sin(sqrt(3)*log(x)/2)+cos(sqrt(3)*log(x)/2))/(2*sqrt(x)))/(%c*sin(sqrt(3)*log(x)/2)+cos(sqrt(3)*log(x)/2));
 
231
ode_check(eq,ans);
 
232
0;
 
233
 
 
234
ans:ode1_riccati_special(a:1,b:1,c:1,n:0,y,x);
 
235
y=sqrt(x)*((x^(sqrt(5)/2)+%c/x^(sqrt(5)/2))/(2*sqrt(x))+sqrt(x)*(sqrt(5)*x^(sqrt(5)/2-1)/2-sqrt(5)*%c*x^(-sqrt(5)/2-1)/2))/(x^(sqrt(5)/2)+%c/x^(sqrt(5)/2));
 
236
ode_check(eq,ans);
 
237
0;
 
238
 
 
239
ans:ode1_riccati_special(a:1,b:-1/4,c:1,n:0,y,x);
 
240
y=-4*sqrt(x)*((%c*log(x)+1)/(2*sqrt(x))+%c/sqrt(x))/(%c*log(x)+1);
 
241
ode_check(eq,ans);
 
242
0;
 
243
 
 
244
/* Cases with a=0 and b*c<0 */
 
245
ans:ode1_riccati_special(a:0,b:-1,c:1,n:2,y,x);
 
246
y=(bessel_y(1,x)*%c+bessel_j(1,x))*x/(bessel_y(0,x)*%c+bessel_j(0,x));
 
247
ode_check(eq,ans);
 
248
0;
 
249
 
 
250
ans:ode1_riccati_special(a:0,b:-1,c:1,n:1,y,x);
 
251
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)));
 
252
ode_check(eq,ans);
 
253
0;
 
254
 
 
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_k(1,x)*%c-bessel_i(1,x))*x/(bessel_k(0,x)*%c+bessel_i(0,x));
 
258
ode_check(eq,ans);
 
259
0;
 
260
 
 
261
ans:ode1_riccati_special(a:0,b:1,c:1,n:1,y,x);
 
262
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)));
 
263
ode_check(eq,ans);
 
264
0;
 
265
 
 
266
kill(a,b,c,n);
 
267
done;
 
268
 
 
269
/* some tests for ode1_riccati_original */
 
270
eqn:'diff(y,x)+b*y^2=c*x^m;
 
271
'diff(y,x)+b*y^2=c*x^m;
 
272
/* Case  m*(2*k+1)+4*k=0 and k=0 => m=0 
 
273
   also  m*(2*k-1)+4*k=0 and k=0 => m=0 */
 
274
ans:ode1_riccati_original(b:4,c:1,m:0,y,x);
 
275
y=tanh(2*x+%c)/2;
 
276
trigsimp(ode_check(eqn,ans));
 
277
0;
 
278
ans:ode1_riccati_original(b:-4,c:1,m:0,y,x);
 
279
y=tan(2*x+%c)/2;
 
280
trigsimp(ode_check(eqn,ans));
 
281
0;
 
282
ans:ode1_riccati_original(b:4,c:-1,m:0,y,x);
 
283
y=-tan(2*x-%c)/2;
 
284
trigsimp(ode_check(eqn,ans));
 
285
0;
 
286
ans:ode1_riccati_original(b:-4,c:-1,m:0,y,x);
 
287
y=-tanh(2*x-%c)/2;
 
288
trigsimp(ode_check(eqn,ans));
 
289
0;
 
290
 
 
291
/* Case m*(2*k+1)+4*k=0, k positive integer */
 
292
/* m=-4/3  k=1 */
 
293
ans:ode1_riccati_original(b:1,c:1,m:-4/3,y,x);
 
294
y=3*tanh(3*x^(1/3)+%c)/(3*x^(2/3)-tanh(3*x^(1/3)+%c)*x^(1/3));
 
295
trigsimp(ode_check(eqn,ans));
 
296
0;
 
297
/* m=-8/5  k=2 */
 
298
ans:ode1_riccati_original(b:-1,c:1,m:-8/5,y,x);
 
299
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));
 
300
/* This is correct - checking takes too long for testsuite */
 
301
/* m=-12/7  k=3 */
 
302
ans:ode1_riccati_original(b:1,c:1,m:-12/7,y,x);
 
303
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));
 
304
/* This is correct - checking takes too long for testsuite */
 
305
 
 
306
/* Case m*(2*k-1)+4*k=0, k positive integer */
 
307
/* m=-4, k=1 */
 
308
ans:ode1_riccati_original(b:1,c:1,m:-4,y,x);
 
309
y=(x*tanh((%c*x-1)/x)+1)/(x^2*tanh((%c*x-1)/x));
 
310
trigsimp(ode_check(eqn,ans));
 
311
0;
 
312
/* m=-8/3 k=2 */
 
313
ans:ode1_riccati_original(b:1,c:1,m:-8/3,y,x);
 
314
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));
 
315
ode_check(eqn,ratsimp(exponentialize(ans)));
 
316
0;
 
317
/* m=-12/5 k=3 */
 
318
ans:ode1_riccati_original(b:1,c:1,m:-12/5,y,x);
 
319
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));
 
320
/* ode_check(eqn,ratsimp(exponentialize(ans)));
 
321
0;  eventually */
 
322
/* m=-16/7 k=4 */
 
323
ans:ode1_riccati_original(b:1,c:1,m:-16/7,y,x);
 
324
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));
 
325
/* ode_check(eqn,ratsimp(exponentialize(ans)));
 
326
0;  eventually */
 
327
 
 
328
/* Bessel function solution - integer order with b*c<0 */
 
329
ans:ode1_riccati_original(b:3,c:-2,m:-1,y,x);
 
330
y=(sqrt(6)*bessel_y(0,2*sqrt(6)*sqrt(x))*%c+sqrt(6)*bessel_j(0,2*sqrt(6)*sqrt(x)))/((3*bessel_y(1,2*sqrt(6)*sqrt(x))*%c+3*bessel_j(1,2*sqrt(6)*sqrt(x)))*sqrt(x));
 
331
ode_check(eqn,ans);
 
332
0;
 
333
 
 
334
/* Bessel function solution - integer order with b*c>0 */
 
335
assume(x>0);
 
336
[x>0];
 
337
ans:ode1_riccati_original(b:3,c:2,m:-1,y,x);
 
338
y=-(sqrt(6)*bessel_k(0,2*sqrt(6)*sqrt(x))*%c-sqrt(6)*bessel_i(0,2*sqrt(6)*sqrt(x)))/((3*bessel_k(1,2*sqrt(6)*sqrt(x))*%c+3*bessel_i(1,2*sqrt(6)*sqrt(x)))*sqrt(x));
 
339
ode_check(eqn,ans);
 
340
0;
 
341
forget(x>0);
 
342
[x>0];
 
343
 
 
344
/* Bessel function solution - non-integer order b*c<0 */
 
345
ans:ode1_riccati_original(b:1,c:-1,m:2,y,x);
 
346
y=((bessel_j(-5/4,x^2/2)*%c+bessel_j(-3/4,x^2/2))*x^2+bessel_j(-1/4,x^2/2)*%c)/((bessel_j(-1/4,x^2/2)*%c+bessel_j(1/4,x^2/2))*x);
 
347
ode_check(eqn,ans);
 
348
(((bessel_j(-1/4,x^2/2)+bessel_j(-9/4,x^2/2))*%c+bessel_j(1/4,x^2/2)+bessel_j(-7/4,x^2/2))*x^2+5*bessel_j(-5/4,x^2/2)*%c+3*bessel_j(-3/4,x^2/2))/(bessel_j(-1/4,x^2/2)*%c+bessel_j(1/4,x^2/2));
 
349
expand(ev(%,besjident(1/4,x^2/2),besjident(-1/4,x^2/2)));
 
350
0;
 
351
 
 
352
/* Bessel function solution - non-integer order b*c>0 */
 
353
assume(x>0);
 
354
[x>0];
 
355
ans:ode1_riccati_original(b:2,c:3,m:-5,y,x);
 
356
y=-((sqrt(6)*bessel_k(-2/3,-2*sqrt(6)/(3*x^(3/2)))*%c-sqrt(6)*bessel_i(-4/3,-2*sqrt(6)/(3*x^(3/2))))*sqrt(x)-bessel_k(1/3,-2*sqrt(6)/(3*x^(3/2)))*%c*x^2)/((2*bessel_k(1/3,-2*sqrt(6)/(3*x^(3/2)))*%c+2*bessel_i(-1/3,-2*sqrt(6)/(3*x^(3/2))))*x^3);
 
357
ode_check(eqn,ans);
 
358
((6*bessel_k(-2/3,-2*sqrt(6)/(3*x^(3/2)))*%c-12*bessel_i(-4/3,-2*sqrt(6)/(3*x^(3/2))))*x^(3/2)+(3*sqrt(6)*bessel_k(-5/3,-2*sqrt(6)/(3*x^(3/2)))-3*sqrt(6)*bessel_k(1/3,-2*sqrt(6)/(3*x^(3/2))))*%c-3*sqrt(6)*bessel_i(-1/3,-2*sqrt(6)/(3*x^(3/2)))+3*sqrt(6)*bessel_i(-7/3,-2*sqrt(6)/(3*x^(3/2))))/((sqrt(6)*bessel_k(1/3,-2*sqrt(6)/(3*x^(3/2)))*%c+sqrt(6)*bessel_i(-1/3,-2*sqrt(6)/(3*x^(3/2))))*x^5);
 
359
expand(ev(%,besiident(-1/3,-2*sqrt(6)/(3*x^(3/2))),beskident(1/3,-2*sqrt(6)/(3*x^(3/2)))));
 
360
0;
 
361
forget(x>0);
 
362
[x>0];
 
363
 
 
364
/* Original Riccati equation: m=-2 Case i */
 
365
ans:ode1_riccati_original(b:2,c:-3,m:-2,y,x);
 
366
y=(sqrt(x)*(sqrt(23)*%c*cos(sqrt(23)*log(x)/2)/(2*x)-sqrt(23)*sin(sqrt(23)*log(x)/2)/(2*x))+(%c*sin(sqrt(23)*log(x)/2)+cos(sqrt(23)*log(x)/2))/(2*sqrt(x)))/(2*sqrt(x)*(%c*sin(sqrt(23)*log(x)/2)+cos(sqrt(23)*log(x)/2)));
 
367
ode_check(eqn,ans);
 
368
0;
 
369
 
 
370
/* Original Riccati equation: m=-2 Case ii */
 
371
ans:ode1_riccati_original(b:2,c:3,m:-2,y,x);
 
372
y=((x^(5/2)+%c/x^(5/2))/(2*sqrt(x))+sqrt(x)*(5*x^(3/2)/2-5*%c/(2*x^(7/2))))/(2*sqrt(x)*(x^(5/2)+%c/x^(5/2)));
 
373
ode_check(eqn,ans);
 
374
0;
 
375
 
 
376
/* Original Riccati equation: m=-2 Case iii */
 
377
ans:ode1_riccati_original(b:1,c:-1/4,m:-2,y,x);
 
378
y=((%c*log(x)+1)/(2*sqrt(x))+%c/sqrt(x))/(sqrt(x)*(%c*log(x)+1));
 
379
ode_check(eqn,ans);
 
380
0;
 
381
 
 
382
kill(b,c,m);
 
383
done;
 
384
 
 
385
/* Murphy 249 (3-3) */
 
386
ans:contrib_ode(eqn:3*x*'diff(y,x)=3*x^(2/3)+(1-3*y)*y,y,x);
 
387
[y=tanh(3*x^(1/3)+%c)*x^(1/3)];
 
388
trigsimp(ode_check(eqn,ans[1]));
 
389
0;
 
390
 
 
391
/* murphy 373  (3-2) */
 
392
assume(a>0);
 
393
[a>0];
 
394
ans:ode1_riccati(eqn:x^4*'diff(y,x)+a^2+x^4*y^2=0,y,x);
 
395
y=(x*TAN((%C*x-a)/x)+a)/(x^2*TAN((%C*x-a)/x));
 
396
trigsimp(ode_check(eqn,ans));
 
397
0;
 
398
forget(a>0);
 
399
[a>0];
 
400
 
 
401
/* Murphy 168 - Case (a.iii) with k = 2 */
 
402
ans:ode1_riccati(eqn:x*'diff(y,x)-y+y^2=x^(2/3),y,x);
 
403
y=x^(2/3)/(x^(1/3)/tanh(3*x^(1/3)+%c)-1/3);
 
404
trigsimp(ode_check(eqn,ans));
 
405
0;