Print a warning when translating subscripted functions
[maxima.git] / share / contrib / rand / transfor.mac
blob2217bef1181a054159b907fc62b7d6006493fb19
1 /* Filename transfor.mac
3    ***************************************************************
4    *                                                             *
5    *                     <package name>                          *
6    *                <functionality description>                  *
7    *                                                             *
8    *          from: Perturbation Methods, Bifurcation            *
9    *                Theory and Computer Algebra.                 *
10    *           by Rand & Armbruster (Springer 1987)              *
11    *                Programmed by Richard Rand                   *
12    *      These files are released to the public domain          *
13    *                                                             *
14    ***************************************************************
15 */ 
16 /*PROGRAM NUMBER 4: TRANSFORM(), THIS PROGRAM ALLOWS TO PERFORM ARBITRARY
17   COORDINATE TRANSFORMATIONS. SEE PAGE 44 IN "PERTURBATION METHODS,
18   BIFURCATION THEORY AND COMPUTER ALGEBRA". */
21 transform():=(
23 /* INPUT DATA */
24 n:read("enter number of equations"),
25 for i:1 thru n do
26    x[i]:read("enter symbol for original variable",i),
27 for i:1 thru n do
28    y[i]:read("enter symbol for transformed variable",i),
29 print("the rhs's of the d.e.'s are functions of the original variables:"),
30 for i:1 thru n do (
31    print("enter rhs of",x[i],"d.e."),
32    print("d",x[i],"/dt ="),
33    f[i]:read(),
34    print("d",x[i],"/dt =",f[i])),
35 print("the transformation is entered next:"),
36 for i:1 thru n do (
37    print("enter",x[i],"as a function of the new variables"),
38    print(x[i],"="),
39    g[i]:read(),
40    print(x[i],"=",g[i])),
42 /* DO IT */
43 for i:1 thru n do depends([x[i],y[i]],t),
44 for i:1 thru n do eq[i]:diff(x[i],t)=f[i],
45 trans:makelist(x[i]=g[i],i,1,n),
46 for i:1 thru n do treq[i]:ev(eq[i],trans,diff),
47 treqs:makelist(treq[i],i,1,n),
48 derivs:makelist(diff(y[i],t),i,1,n),
49 neweqs:solve(treqs,derivs))$