[sympy] What can be used instaed of string to define dynamically formulas

2009-12-08 Thread Christophe BAL
Hello, I would like to use sympy in the following way : 1. The user types some formula like for example "2*x**3+5". 2. My little program named test.py must have to differentiate this formula. The problem is that the formula is known as a string. Is there a way to not used string so as to

Re: [sympy] What can be used instaed of string to define dynamically formulas

2009-12-08 Thread Aaron S. Meurer
The problem is using strings directly in functions. The proper way to do this is to convert the string to a SymPy object first with the sympify() function. So for example, this would be perfectly legitimate: from sympy import sympify, diff, S from sympy.core.sympify import SympifyError # Note

Re: [sympy] What can be used instaed of string to define dynamically formulas

2009-12-08 Thread Christophe BAL
That's sound great because that's the way I do. Best regards. Christophe. 2009/12/8 Aaron S. Meurer > The problem is using strings directly in functions. The proper way to do > this is to convert the string to a SymPy object first with the sympify() > function. So for example, this would be

Re: [sympy] What can be used instaed of string to define dynamically formulas

2009-12-08 Thread Ondrej Certik
On Tue, Dec 8, 2009 at 7:59 AM, Aaron S. Meurer wrote: > The problem is using strings directly in functions.  The proper way to do > this is to convert the string to a SymPy object first with the sympify() > function.  So for example, this would be perfectly legitimate: > from sympy import sympify