...

/

Numerical Evaluation

Numerical Evaluation

This lesson discusses numeric types and evaluation in SymPy.

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 14\frac{1}{4} ...