I want to differentiate an expression and generate Fortran for the result. The expression is similar to
at(diff(x^2*f(x,y)+y^2*g(x,y),y),y=x). The result contains terms such as
Before I generate Fortran I want to remove the at-functions (I have another script to convert the
diff(g(x,y),y) entities to subroutine calls). Hence I am trying to write a function that goes through the expression tree and does something special when the at-function is found. However, if I compare
piece='at, this always evaluates to
false whereas if I compare
piece='sin, the sin function is detected correctly. I am completely at a loss as to why the at-function is not detected.
The code I have so far is
( ops: op(expression),
for arg in args do (
If I run this as
(%o4) -- (f(x, y))!
!x = y
So even though piece is printed to be "at" the function processAt is never called. If I change the line "if piece='at" to "if piece='sin" and then evaluate
expression= -- (f(x, y))
(%o6) -- (f(x, y))
which clearly demonstrates that the sin-function is detected no problem. So what is special about the at-function and how can I detect when I have reached it in an expression?
Huub van Dam
EMSL: Environmental Molecular Science Laboratory
Pacific Northwest National Laboratory
902 Battelle Boulevard
P.O. Box 999, MSIN K8-91
Richland, WA 99352 USA
Hubertus.vanDam <at> pnnl.gov