This file is indexed.

/usr/share/maxima/5.41.0/tests/rtestode.mac is in maxima-test 5.41.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/* ODE tests */

kill(all);
done;

/* Bug #2796 ode2 with n declared constant
 *
 * Can't load ode2.mac if any formal function args are
 * declared constant
 */
(declare(n,constant), load(ode2), remove(n,constant));
done;

/* Trivial ode - bug 866510 */
ode2('diff(y,x),y,x);
y=%c;

/* Examples from "The Maxima Book" */

ode2(x^2*'diff(y,x)+3*x*y=sin(x)/x, y, x);
y = (%c-cos(x))/x^3;
ic1(%, x=1, y=1);
y = -((cos(x)-cos(1)-1)/x^3);
method;
linear;

soln:ode2('diff(y,x,2) + y = 4*x, y, x);
y = %k1*sin(x) + %k2*cos(x) + 4*x;
method;
variationofparameters;
ic2(soln, x=0, y=1, 'diff(y,x)=3);
y = -sin(x)+cos(x)+4*x;
bc2(soln, x=0, y=3, x=2, y=1);
y = -((3*cos(2)+7)*sin(x)/sin(2)) + 3*cos(x) + 4*x;

ode2((3*x^2+4*x+2)=(2*y-1)*'diff(y,x), y, x);
y^2-y = x^3+2*x^2+2*x+%c;
method;
separable;

ode2(x^2*cos(x*y)*'diff(y,x) + (sin(x*y)+x*y*(cos(x*y)))=0, y, x);
x*sin(x*y)=%c;
method;
exact;

ode2( (2*x*y-exp(-2*y))*'diff(y,x)+y=0, y, x);
x*exp(2*y) - log(y) = %c;
method;
exact; 
intfactor;
exp(2*y)/y;

ode2( 'diff(y,x)=(y/x)^2+2*(y/x), y, x);
-((x*y+x^2)/y) = %c;
method;
exact;

ode2( 'diff(y,x)+(2/x)*y=(1/x^2)*y^3, y, x);
y = 1/(sqrt( 2/(5*x^5) + %c)*x^2);
method;
bernoulli;
odeindex;
3;

ode2( 'diff(y,x,2)-3*'diff(y,x)+2*y=0, y, x);
y = %k1*exp(2*x) + %k2*exp(x);
method;
constcoeff;

ode2( 'diff(y,x,2)-4*'diff(y,x)+4*y=0, y, x);
y = (%k2*x + %k1)*exp(2*x);
method;
constcoeff;

ode2(x^2*'diff(y,x,2)+x*'diff(y,x)-y=0, y, x);
y=%k2*x-%k1/(2*x);
method;
exact;

ode2( x^2*'diff(y,x,2)+4*x*'diff(y,x)+2*y=0, y, x);
y=%k1/x+%k2/x^2;
method;
exact; /*euler*/

ode2( x^2*'diff(y,x,2)+5*x*'diff(y,x)+4*y=0, y, x);
y=(%k2*log(x)+%k1)/x^2;
method;
euler;

ode2( x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-1/4)*y=0, y, x);
y=(%k1*sin(x)+%k2*cos(x))/sqrt(x);
method;
bessel;

ode2( x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-4)*y=0, y, x);
y=%k1*bessel_j(2,x)+%k2*bessel_y(2,x);
method;
bessel;

ode2( (x-1)^2*'diff(y,x,2)+(x-1)*'diff(y,x)+((x-1)^2-4)*y=0, y, x);
y=%k1*bessel_j(2,x-1)+%k2*bessel_y(2,x-1);
method;
bessel;

ode2( x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-1/9)*y=0, y, x);
y=bessel_j(-1/3,x)*%k2+bessel_j(1/3,x)*%k1;
method;
bessel;

/* Bug report 2876387: asks if obvious non-integers are integers */ 
(declare(n,integer),ode2(x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-n^2)*y=0,y,x));
y = %k2*bessel_y(n,x)+%k1*bessel_j(n,x);
(remove(n,integer),method);
bessel;

(declare(v,noninteger),ode2(x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-v^2)*y=0,y,x));
y = %k1*bessel_j(v,x)+%k2*bessel_j(-v,x);
(remove(v,noninteger),method);
bessel;
 
ode2(x^2*'diff(y,x,2)+x*'diff(y,x)+(x^2-3)*y=0,y,x);
y = %k1*bessel_j(sqrt(3),x)+%k2*bessel_j(-sqrt(3),x);
method;
bessel;

ode2( 'diff(y,x,2)+2*'diff(y,x)+y=exp(x), y, x);
y=exp(x)/4+(%k2*x+%k1)*exp(-x);
method;
variationofparameters;
yp;
exp(x)/4;

ode2( x*'diff(y,x,2)+('diff(y,x))^2=0, y, x);
/* y='integrate(1/(log(x)+%k1),x)+%k2;
   Because of adding more integrals for the power function we get a result
   12/2008 */
y=%k2-expintegral_e(1,-log(x)-%k1)*%e^-%k1;
method;
freeofy;

ode2( y*'diff(y,x,2)+('diff(y,x))^2=0, y, x);
y^2/(2*%k1)=x+%k2;
method;
freeofx;

eq: 'diff(y,x,2)+x*'diff(y,x)+exp(-x^2)*y=0;
'diff(y,x,2)+x*'diff(y,x,1)+%e^-x^2*y = 0;
ans:ode2(eq,y,x);
y = %k1*sin((1/2) * sqrt(2)*sqrt(%pi)*erf(x/sqrt(2)))+%k2*cos((1/2) * sqrt(2)*sqrt(%pi)*erf(x/sqrt(2)));
is(ratsimp(ev(eq,ans,diff)));
true;
method;
xformtoconstcoeff;

eq:x*'diff(y,x,2)+(x^2-1)*'diff(y,x,1)+x^3*y=0;
x*'diff(y,x,2)+(x^2-1)*'diff(y,x,1)+x^3*y=0;
ans:ode2(eq,y,x);
y=%e^-(x^2/4)*(%k1*sin(sqrt(3)*x^2/4)+%k2*cos(sqrt(3)*x^2/4));
is(ratsimp(ev(eq,ans,diff)));
true;
method;
xformtoconstcoeff;

/* Tests of desolve */

eqn1:'diff(f(x),x) = sin(x)+'diff(g(x),x);
'diff(f(x),x,1) = 'diff(g(x),x,1)+sin(x);
eqn2:'diff(g(x),x,2) = 'diff(f(x),x)-cos(x);
'diff(g(x),x,2) = 'diff(f(x),x,1)-cos(x);
desolve([eqn1,eqn2],[f(x),g(x)]);
[f(x)=%e^x*(at('diff(g(x),x,1),x = 0))-at('diff(g(x),x,1),x = 0)+f(0),g(x)=%e^x*(at('diff(g(x),x,1),x=0))-at('diff(g(x),x,1),x = 0)+cos(x)+g(0)-1];
atvalue('diff(g(x),x),x = 0,a);
a;
atvalue(f(x),x = 0,1);
1;
desolve([eqn1,eqn2],[f(x),g(x)]);
[f(x) = a*%e^x-a+1,g(x) = cos(x)+a*%e^x-a+g(0)-1];
remove(f,atvalue,g,atvalue);
done;

atvalue('diff(g(x),x),x = 0,a);
a;
atvalue(f(x),x = 0,1);
1;
desolve([eqn1,eqn2],[f(x),g(x)]);
[f(x) = a*%e^x-a+1,g(x) = cos(x)+a*%e^x-a+g(0)-1];

eqn3: 'diff(f(x),x,2)+f(x)=2*x;
'diff(f(x),x,2)+f(x)=2*x;
desolve(eqn3,f(x));
''(f(x) = sin(x)*(at('diff(f(x),x,1),x = 0)-2)+f(0)*cos(x)+2*x);

/* Examples mentioned in bug report [ 1063454 ] bug in ode2
 * First one was reported to fail in CMUCL with "run out of heap" message.
 * Others were reported to be OK. Put them all here for good measure.
 */

(ode2 ('diff(y, t, 2) + 'diff(y, t) + y - sin(t), y, t),
 rhs(%%), ratsimp (diff(%%, t, 2) + diff(%%, t) + %% - sin(t)));
0;

(ode2 ('diff(y, t, 2) + 'diff(y, t) + 2*y - sin(t), y, t),
 rhs(%%), ratsimp (diff(%%, t, 2) + diff(%%, t) + 2*%% - sin(t)));
0;

(ode2 ('diff(y, t, 2) + 'diff(y, t) + y - exp(%i*t), y, t),
 rhs(%%), ratsimp (diff(%%, t, 2) + diff(%%, t) + %% - exp(%i*t)));
0;

/* bug report 1063454 claims "maxima gets stuck" on the following */
(integrate (my_integrand : exp(t/2) * sin(t) * sin(sqrt(3) * t/2), t),
 ratsimp (exponentialize (diff (%%, t) - my_integrand)));
0;

/* Examples to show that ic2 works as expected after revision 1.5 of ode.mac
 */

'diff(y,x,2)+y*('diff(y,x,1))^3 = 0;
'diff(y,x,2)+y*('diff(y,x,1))^3 = 0;

soln:ode2(%,y,x);
(y^3+6*%k1*y)/6 = x+%k2;

ratsimp(ic2(soln, x=0, y=0, 'diff(y,x,1)=2));
(y^3+3*y)/6=x;

ratsimp(ic2(soln, x=0, y=0, 'diff(y,x,1)=1));
(y^3+6*y)/6 = x$

/* This is the example of the bug report 
 * ID:2881021 - ic2 and bc2 may return incorrect results (solution suggeste)
 */

ratsimp(ic2(soln, x=0, y=1, 'diff(y,x,1)=2));
y^3/6 = (6*x+1)/6;

/* These examples show that ic2 works for a list of equation and nested
 * lists of equation.
 */

ratsimp(ic2([soln, soln, soln], x=0, y=0, 'diff(y,x,1)=2));
[(y^3+3*y)/6=x, (y^3+3*y)/6=x, (y^3+3*y)/6=x];

ratsimp(ic2([soln, [soln, soln]], x=0, y=0, 'diff(y,x,1)=2));
[(y^3+3*y)/6=x, [(y^3+3*y)/6=x, (y^3+3*y)/6=x]];

/* Bug report ID: 1839088 - ic2 fails with division by 0
 * Maxima no longer gives an error, but does not find the solution.
 */

ode2(y*'diff(y,x,2)=a, y, x);
[sqrt(%pi)*%i*%e^-%k1*erf(%i*sqrt(a*log(y)+%k1*a)/sqrt(a))/(sqrt(2)*sqrt(a))
   = x+%k2,
 -sqrt(%pi)*%i*%e^-%k1*erf(%i*sqrt(a*log(y)+%k1*a)/sqrt(a))/(sqrt(2)*sqrt(a))
   = x+%k2];

ic2(%,x=0,y=b,diff(y,x)=0);
[];

/* Bug report ID: 2997443 - ic2 fails
 * Maxima no longer gives an error, but does not find the solution.
 * The solution of ic2 could be: y=1/20*(sqrt(160*x+1)-1)
 */

ode2('diff(x,t,2)+5*'diff(x,t)^3, x, t);
[x = %k2-2*1/sqrt(1/(t+%k1))/sqrt(10),x = 2*1/sqrt(1/(t+%k1))/sqrt(10)+%k2];

ic2(%,t=0,x=0,'diff(x,t)=4);
[];

/* Bug report ID: 1789213 - ic1 for solution containing indefinite integral
 * More general implementation of ic1, which handles a noun form of an 
 * integral correctly. The result simplifies correctly, if we define
 * a function and reevaluate the result.
 */
sol: ode2(kappa(p) = -'diff(V, p) / V, V, p);
V = %c*%e^-'integrate(kappa(p),p);

ic1(sol, p = p0, V = V0);
V = V0*%e^('at('integrate(kappa(p),p),[p = p0,V = V0])
          -'integrate(kappa(p),p));

(kappa(x):=x, ev(%,nouns));
V = %e^(p0^2/2-p^2/2)*V0;

/* Bug report ID: 1621 Wrong solution to ode2
 *
 * 'diff(y,t,2)-a*'diff(y,t)=-t with a=0
 *
 * Test case is a 2nd order non-homogeneous linear ode with constant
 * coefficients.  When solving homogeneous ode, cc2 asked if a=0, then
 * returned a solution involving a.
 */
assume(equal(a,0));
[equal(a,0)];

ode2('diff(y,t,2)-a*'diff(y,t)=0,y,t);
y=%k2*t+%k1;

ode2('diff(y,t,2)-a*'diff(y,t)=-t,y,t);
y=(-t^3/6)+%k2*t+%k1;

forget(equal(a,0));
[equal(a,0)];