SymPy may be able to help by counting operations in a given expression. I don't think you want it controlling the optimization search though.
I'm not very familiar with the relevant modules but I don't think it will be easy to perform this optimization within SymPy. To the best of my knowledge It is not easy to separate out the simplification rules and choose whether or not to apply each of them. If you haven't already I recommend asking a non-sympy-specific version of this question on scicomp.stackexchange.com On Thu, Jul 26, 2012 at 5:43 PM, Matthew Emmett <[email protected]> wrote: > Hi everyone, > > I have some sympy code that generates Fortran code, and was wondering > if there a good way of simplifying the sympy expressions in order to > minimize the number of floating point operations that are required to > evaluate them numerically. Any suggestions? > > Thanks, > Matt > > -- > You received this message because you are subscribed to the Google Groups > "sympy" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" 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?hl=en.
