Rational Number

Representing the rational numbers using the Rational() method.

Python3




from sympy import Rational
  
r_number = Rational(2, 5)
r_number


Output

Output

Explanation: Rational method accepts two numbers which are the numerator and denominator of rational numbers and represents them in rational form as a/b.

What is Symbolic Computation in SymPy?

In this article, we are going to see how to perform symbolic computation in Sympy in Python.

Symbolic Computation in Sympy is used to solve mathematical expressions by integrating mathematics with computer science using mathematical symbols. It manipulates mathematical objects and expressions. Sympy evaluates algebraic expressions exactly using traditional mathematical symbols but not approximately.

Let’s look into an example to differentiate Sympy mathematical operation and normal mathematical operation.

Similar Reads

Basic Operations

Using the math module the square root value for 5 is calculated approximately. But using Sympy module the square root of 5 is left unevaluated because it is not a perfect square....

Rational Number

...

Square root representation

...

Equations

Representing the rational numbers using the Rational() method....

Trigonometry

...

Derivative, Integration and Limits

Here will we represent the square root symbols....

Special Functions

...

Latex

In this section, the equations are expanded and also can be factorized and even equations can be simplified using expand, factor and simplify methods respectively. In addition to the specified operations, we can also solve equations and perform substitution in the equations. All these topics are explained below with examples....