Hi there
I'm a relative python/sympy newbie, and I need a little help on a problem. I'm writing a piece of code that translates a system of differential equations into either C, Python, or MATLAB/Octave code that can be interfaced to solvers in those languages. The models are specified using .ini files, and I'm using sympy's code generators to translate the model equations (which are in python syntax). So far so good.
What I want to be able to do, is take an expression like
prefix = 'foo'
str = 'x**2 - sin(x) + exp(xy)'
and turn it into C (or MATLAB) like
'pow(foo_x, 2) - sin(foo_x) + exp(foo_x * foo_y)'
I know this involves overriding the printing library somehow, but I'm getting confused with where to start. Should I be overriding the __str__ method of atom?
Any help would be gratefully accepted
Richard