Print a warning when translating subscripted functions
[maxima.git] / share / contrib / rand / Oden.bk1
blob178604f4e5bc9b53d21c6dd2fd3c54e1d1b39ea2
1 /* Filename <name>.mac
3    ***************************************************************
4    *                                                             *
5    *                     <package name>                          *
6    *                <functionality description>                  *
7    *                                                             *
8    *          from: Computer Algebra in Applied Math.            *
9    *                   by Rand (Pitman,1984)                     *
10    *                Programmed by Richard Rand                   *
11    *      These files are released to the public domain          *
12    *                                                             *
13    ***************************************************************
14 (d4) This program generates the Taylor series solution
17 to the Nth order ODE:
20             (N)                             (N-1)
23            Y    =  F ( X, Y, Y', Y'', ..., Y      )
26 for arbitrary initial conditions at X = 0.
29 To call it, type:
32                    SOLUTION()
36 \rsolution():=(input(),step1(),step2(),v:f,
37          for i from n thru m do (u:u+evaluate(v)*x^i/i!,v:deriv(v)),output())$
38 input():=(n:read("ENTER ORDER OF D.E."),m:read("ENTER DEGREE OF TRUNCATION"),
39       f:read("ENTER RIGHT HAND SIDE OF ODE.\
40 REPRESENT Y BY Y[0], Y' BY Y[1], ETC."),
41       print(" "),print(f),print(" "),
42       for i from 0 thru n-1 do z[i]:read("ENTER INITIAL VALUE OF Y[",i,"]"))$
43 step1():=u:sum(z[i]*x^i/i!,i,0,n-1)$
44 step2():=initial:makelist([y[i] = z[i]],i,0,n-1)$
45 deriv(g):=diff(g,x)+sum(diff(g,y[i])*y[i+1],i,0,n-2)+diff(g,y[n-1])*f$
46 evaluate(g):=ev(g,x:0,initial)$
47 output():=print("Y =",u)$