how to parse standard algebraic notation

Marco Buttu marco.buttu at gmail.com
Wed Oct 1 14:22:59 CEST 2014


On 01/10/2014 09:01, math math wrote:
> What would be a good starting strategy for writing a program to take the derivative of a polynomial expression, such as this below?:
> "x**3 + x**2 + x + 1"

You can look at sympy:

 >>> from sympy import *
 >>> equation = simplify("x**3 + x**2 + x + 1")
 >>> equation
x**3 + x**2 + x + 1
 >>> diff(equation)
3*x**2 + 2*x + 1

-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbuttu at oa-cagliari.inaf.it




More information about the Python-list mailing list