12/14/2011 Sym Py a math Library for Python

There are a some good libs in python but today we're going to speak about Sym Py a new library for make a usefuls test,reading it in google open source blog i found this excelent lib.

SymPy
 is a computer algebra system (CAS) written in pure Python. The core allows basic manipulation of expressions (like differentiation or expansion) and it contains many modules for common tasks (limits, integrals, differential equations, series, matrices, quantum physics, geometry, plotting, and code generation).

Features

SymPy core capabilities include:
  • basic arithmetics *,/,+,-,**
  • basic simplification (like a*b*b + 2*b*a*b -> 3*a*b**2)
  • expansion (like (a+b)**2 -> a**2 + 2*a*b + b**2)
  • functions (exp, ln, ...)
  • complex numbers (like exp(I*x).expand(complex=True) -> cos(x)+I*sin(x))
  • differentiation
  • taylor (laurent) series
  • substitution (like x -> ln(x), or sin -> cos)
  • arbitrary precision integers, rationals and floats
  • noncommutative symbols
  • pattern matching
Then there are SymPy modules for these tasks:
  • more functions (sin, cos, tan, atan, asin, acos, factorial, zeta, legendre)
  • limits (like limit(x*log(x), x, 0) -> 0)
  • integration using extended Risch-Norman heuristic
  • polynomials (division, gcd, square free decomposition, groebner bases, factorization)
  • solvers (algebraic, difference and differential equations, and systems of equations)
  • symbolic matrices (determinants, LU decomposition...)
  • mpmath (multiprecision floating-point arithmetic)
  • geometric algebra (GA)
  • Pauli and Dirac algebra
  • quantum physics
  • geometry module
  • plotting (2D and 3D)
  • code generation (C, Fortran, LaTeX)
  • Es :

Python Session

>>> from sympy import Symbol, cos
>>> x = Symbol('x')
>>> e = 1/cos(x)
>>> print e.series(x, 0, 10)
1 + (1/2)*x**2 + (5/24)*x**4 + (61/720)*x**6 + (277/8064)*x**8 + O(x**10)

ISymPy Session

In [1]: (1/cos(x)).series(x, 0, 10)
Out[1]: 
     2      4       6        8           
    x    5*x    61*x    277*x            
1 + ── + ──── + ───── + ────── + O(x**10)
    2     24     720     8064            
Digg it StumbleUpon del.icio.us

0 comentarios:

Post a Comment