SymPy
SymPy
|
|
---|---|
Basic data
|
|
Maintainer | Community project initiated by Aaron Meurer |
developer | Aaron Meurer |
Publishing year | 2007 |
Current version |
1.6.2 ( August 9, 2020 ) |
operating system | Platform independence |
programming language | python |
category | Computer algebra system |
License | BSD license |
sympy.org |
SymPy is a Python - library for symbolic mathematical calculations. The computer algebra - functions are offered as
- stand-alone program
- Library for other applications
- SymPy Live or SymPy Gamma web service
SymPy enables calculations and representations in the context of simple symbolic arithmetic up to differential and integral calculus as well as algebra , discrete mathematics and quantum physics . If desired, the results can be output in the text typesetting system language TeX .
SymPy is free software and is under the new BSD license . The leading developers are Ondřej Čertík and Aaron Meurer .
The SymPy library consists of a basic system that can be expanded with optional modules. The basic system, also known as the core, comprises around 260,000 lines of code. Of these, more than 100,000 lines are intended for extensive self-tests.
Skills
SymPy includes numerous math functions. The following overview shows the basic capabilities of the basic system as well as the possibility of modular extensions.
Basic system
- Basic arithmetic operations : addition , subtraction , multiplication , division
- simplification
- extension
- Functions : including trigonometry , hyperbolic geometry , exponential function , root calculations , logarithms , absolute values, spherical surface functions , faculties and gamma functions , zeta functions , polynomials , hypergeometry
- substitution substitution
- whole , rational and decimal numbers
- Hypergeometry
- Pattern recognition
Polynomials
- Basic arithmetic
- Factorization
- Space-free factorization
- Groebner base
- Partial fraction decomposition
- Resultant
Analytics
- Limits
- Differential and integral calculus with integrated Risch algorithm
- Taylor series
Solving equations
- Polynomials
- Systems of equations
- Algebraic systems of equations
- Differential equation
- Difference equation
Discrete Math
- Binomial coefficient
- total
- Product (math)
- Number Theory: generating and testing of primes , prime factorization
- logical expressions
matrix
- Basic arithmetic such as B. Matrix multiplication
- Eigenvalue problem
- Determinant
- Inverse matrix
- Solve matrices
geometry
- Points, lines, rays, segments, ellipses, circles, polygons, ...
- Intersections
- Tangency
- similarity
Graphical representation (plotting)
The Matplotlib or Pyglet library is required to graphically display the curves and diagrams . Otherwise there is the visualization of text-based using the installed in the system fonts .
- Coordinate models
- Geometric entities
- two- and three-dimensional representation
- Interactive interface
- multicolored representations
physics
statistics
Combinatorics
- permutation
- Combination (combinatorics)
- Partition (set theory)
- Subset
- Permutation group : Polyhedral, Rubik, Symmetric, ...
- Verifier code and Gray code
Output formats
Performance improvement
- Gmpy uses the SymPy polynomial module for faster soil types, which lead to a significant increase in the performance of certain calculations.
Examples
These examples can be interactive e.g. B. be executed in IDLE .
PrettyPrint formatting
>>>from sympy import pprint, Symbol, sin, exp, sqrt, series
>>>x = Symbol("20")
>>>#PPrint benutzt standardmäßig Unicodezeichen
>>>pprint( 10**exp(x),use_unicode=True)
⎛ 20⎞
⎝ℯ ⎠
10
>>>#Gleiche Darstellung ohne Unicodes
>>>pprint( 10**exp(x),use_unicode=False)
/ 20\
\e /
10
>>>#Reihenentwicklung
>>>pprint((1/sin(x)).series(x, 0, 4))
3
1 20 7⋅20 ⎛ 4⎞
── + ── + ───── + O⎝20 ⎠
20 6 360
>>>#Wurzel
>>>pprint(sqrt((10**x)))
______
╱ 20
╲╱ 10
Plotting
>>> from sympy import symbols, cos,sin
>>> from sympy.plotting import plot3d
>>> x,y = symbols('x y')
>>> plot3d(sin(3*x)*cos(5*y)+y, (x, -2, 2), (y, -2, 2))
Multiplying out terms
from sympy import init_printing, Symbol, expand, pprint
init_printing()
a = Symbol('a')
b = Symbol('b')
e = (a + b)**5
pprint(e)
print("=")
pprint(e.expand())
Solving algebraic equations
from sympy.solvers import solve
from sympy import Symbol
x = Symbol('x')
print("Lösung von: x**2 - 1 = 0 ")
print(solve(x**2 - 1, x))
print("Lösung von: x**2 - 6*x + 9 = 0 ")
print(solve(x**2 - 6*x + 9, x))
Integrate
from sympy import *
init_printing()
x = Symbol('x')
pprint(integrate(x**2 + 7*x + 5, x))
Number theory
from sympy.ntheory import factorint
print("Primfaktorzerlegung der Zahl 2000 = (2**4) * (5**3) ")
print(factorint(2000))
print("65537 ist eine Primzahl")
print(factorint(65537))
print("Primzahlen im Bereich 60 bis 90 ausgeben")
from sympy import sieve
print([i for i in sieve.primerange(60, 90)])
Calculating with matrices
from sympy import *
M = Matrix(([1,2,3],[4,5,6],[7,8,10]))
print("Addition von Matrizen")
pprint(M+M)
print("Multiplikation von Matrizen")
pprint(M*M)
print("Determinante")
pprint(M.det())
print("inverse")
pprint(M.inv(method="LU"))
literature
- Ronan Lamy: Instant SymPy Starter . mitp, ISBN 978-1-78216-362-6 (English).
Web links
Individual evidence
- ↑ Release 1.6.2 . August 9, 2020 (accessed August 16, 2020).
- ^ SymPy Live
- ^ SymPy Gamma
- ↑ a b About Sympy. Retrieved August 1, 2018 .
- ^ The SymPy Open Source Project on Open Hub. Retrieved August 3, 2018 .