[Maxima] Operator search and replace
ryanlists at gmail.com
Mon Jan 9 19:47:33 CST 2006
I am using the fortran function in some of my work. Fortran does not
allow complex sinh and cosh (as far as I can tell with g77). I am
defining zsinh and zcosh functions in my fortran file that get around
this (since fortran does allow complex exp).
So, I need to take the output of my maxima script and run a search and
replace on the expression to change all sinh to zsinh and cosh to
zcosh before I call the fortran function.
I need to do this in maxima before the fortran function is called
because the expression is long and the fortran line wrap is at a hard
72 characters or whatever, so parsing the fortran file to do the
replacement would be very painful (I would have to search for sinh,
s<newline><line continuation stuff>inh, ... and I would have to change
the names of zsinh and zcosh to have 4 letters so I don't have to
re-wrap the entire function each time I find one).
Can this kind of search and replace be done?
And I don't want to just use zsinh and zcosh from the beginning
because I want maxima to do any appropriate simplifications. I guess
another option would be to define my own maxima function zsinh that
acts just like sinh - but I don't know if that is possible and I don't
know how to do it?
More information about the Maxima