Numerical Evaluation
This lesson discusses numeric types and evaluation in SymPy.
We'll cover the following
Numeric types
While SymPy primarily focuses on symbols, it is impossible to have a completely symbolic system without the ability to numerically evaluate expressions. Many operations will directly use numerical evaluation, such as plotting a function or solving an equation numerically.
SymPy has 3 numeric types: rational, real, and integers. Since rational is the new one, let’s discuss it here:
Rational
The rational class represents a rational number as a pair of two integers: the numerator and the denominator.
Rational(1, 4)
represents
Rational(5, 3)
represents
All the arithmetic operations can be performed on these rational numbers. Let’s see an implementation of this below:
Get hands-on with 1400+ tech skills courses.