Hello,
I work in a unix environment (Fedora Core 12) and I want to make use
of an external program in conjunction with maxima.
The external program does not accept the character '^' for powers.
It has a function "pwr(x,n)" which outputs the same as maxima's
"x^n" It also uses " := " as the assignment operator
instead of maxima's " : ".
So, basically, I want to take some maxima input saved into a file
(e.g. with the stringout command) and import it to this external program.
Thus, suppose that I have the following maxima commands
(%i2) p: x^3*sin(x^4-1)^2 - x^2 + 1.2;
(%o2) x^3*sin(x^4-1)^2-x^2+1.2
(%i3) stringout("data_3", p);
(%o3) "/home/sen/Current_Work/VI_prac/data_3"
(%i4) system("cat data_3");
x^3*sin(x^4-1)^2-x^2+1.2;
(%o4) ?\#\<process\ 22543\ \:EXITED\>
Thus, we have the string
x^3*sin(x^4-1)^2-x^2+1.2;
in the file "data_3".
I want to change the output string to
pwr(x,3)*pwr(sin(pwr(x,4)-1),2 - pwr(x,2) + 1.2;
for input into the other program.
Of course, for a given expression as above, I could simply use a text
editor to modify it. But, I want a function which will transform any
maxima polynomial expression in the variable x and compositions of
intrinsic functions (sin, cos, exp, log, etc) with other polynomials
into another expression in which all powers are changed into the pwr
function.
Any ideas would be appreciated.
TIA,
-sen