How do I exec a function of N variables.
The python code: f(x,y)=sin(x) + cos(y) Can be both differentiated and evaluated.
like this: dfx=diff(f,x); dfy=diff(f,y) then evaluated like this: f(pi/6,pi/9) -> cos(1/9pi) + 1/2 dfx(pi/6,pi/9) -> 1/2sqrt(3)
I'm wanting to do something like: exec("f(t1,t2)=cos(t1)+sin(t2)") so that I can write an @interact function to define the equations of N variables interactively. When I try the above exec I receive the error: "SyntaxError: can't assign to function call"
I can almost do it, but I'm getting into a horrible inelegant tangle of of eval statements in the process!
Is there a clean way to do it with sage?