letzte Aktualisierung: 21. März 2007
Symbolic Algebra
default ] [ fancy ]

symbolic algebra

Python classes that implement symbolic term evaluation and simplification as well as differentiation and matrix calculations.

Download

platform independent: symbalgebra.tgz

Examples

differentiation

input:
#!/usr/bin/python from derive import Function, Var x = Var('x') y = Var('y') f = Function('f', [x,y], [2*x*x+y+2]) print "f(2,3) = %s" % f(2,3) fdx = f.derive(x) fdy = f.derive(y) print "fdx=%s" % fdx print "fdy=%s" % fdy
output:
f(2,3) = 13 fdx=dxf(x, y) = { (4*x) } fdy=dyf(x, y) = { 1 }

Jacobi matrix

input:
#!/usr/bin/python from derive import Function, Var x = Var('x') y = Var('y') f = Function('f', [x,y], [x*x+2*y, y*y+4*x]) print "Jacobi-Matrix:" print f.derive() print "Determinant of Jacobi-Matrix:" print f.derive().det
output:
Jacobi-Matrix: [[(2*x) 2] [ 4 (2*y)]] Determinant of Jacobi-Matrix: (-8+(4*y*x))