On Sunday 03 May 2009 18:25:42 Akshay Srinivasan wrote: > Is there anyway I can replace functions without bothering about the > functional arguments? I mean say I have an expression like: > > expr=tan(x) + tan(y) > > I want to be able to do something like : > > expr.subs(tan(),sin()/cos()) > > ,to get: > > sin(x)/cos(x) + sin(y)/cos(y) > > ,so that the respective functional arguments are substituted for > automatically. > > Akshay > >
Hello, you can try with a Lambda function: In [1]: expr=tan(x) + tan(y) In [2]: expr.subs(tan,Lambda(x,sin(x)/cos(x))) Out[2]: sin(x) sin(y) ────── + ────── cos(x) cos(y) Cheers, Riccardo > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
