Comment #2 on issue 2414 by [email protected]: [Feature request] Deferred expressions
http://code.google.com/p/sympy/issues/detail?id=2414

Unfortunately Derivative can't be used with ccode/fcode and it only works for derivatives, not other kinds of intermediate expressions. What I envision could be used to tag any intermediate quantity that is better not to expand inline.

In many ways, my problem would be better handled with AD instead of symbolic differentiation. Unfortunately, the build complexity and ability to nicely express the problem in Python while running pure C code are much nicer if I work symbolically. Reverse-mode AD systems allow tagging of intermediate quantities to be stored instead of recomputed each time they are needed. If there was something similar in SymPy, it would make the system quite a bit more capable.

Note: My use case is manufacturing solutions to nonlinear systems of PDE. The PDE and a chosen solution are written using SymPy, then C code to evaluate the forcing term that makes the chosen solution solve the PDE is written to a C file. The usefulness is highly dependent on the ability of the system to scale to larger systems. I'm currently writing the same "physics" twice, once in Python and once in C, but the C code could be generated pretty easily from the symbolic representation (similar to the Fenics project), especially if I have a way to get access to the intermediate quantities. This would be far more cumbersome to do with AD, and there may be no way to avoid some duplication.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to