SymPy Library in Python:
Python has a number of libraries, each of which contains functions and methods. You may quickly import these built-in processes into your programs to execute various functions.
SymPy is a Python library that includes symbolic mathematics methods. It is a fantastic tool for calculus that also includes computer algebra features and functionalities. It also includes tools for simplifying expressions, computing derivatives, performing integrations, and solving equations, among other things.
We must first install SymPy before we can begin studying and working with it. The SymPy library can be installed on any Python-enabled machine (version 2.6 and above).
Installation of SymPy Library in Anaconda
Anaconda is a free, open-source Python distribution that includes a Python interpreter as well as many tools and packages.
It is one of the most widely used Python programming platforms.
Anaconda will automatically install the SymPy library, as well as other major libraries and packages, on your machine.
If you don’t have the Anaconda Python distribution, you can install SymPy by running the following command in the Anaconda Prompt:
conda install sympy
Installing using the pip command:
pip install sympy
Checking if the sympy library is installed or Not:
import sympy sympy.__version__
Output:
'1.7.1'
Command for Updating:
If you already have the SymPy package installed but want to update it, run the below command in the Anaconda Prompt:
conda update sympy
Installation of SymPy Library Using Git
If you’re a GitHub contributor who wants to help develop the SymPy library or stay up to date on improvements/updates, you can use git to install SymPy.
Go to the command prompt (CMD) and run the following command:
git clone https://github.com/sympy/sympy.git
Command for Updating:
If you’ve already completed this installation and want to update your SymPy version, run the following command:
git pull origin master
Another command which allows us to install SymPy and yet use the git version:
python setupegg.py develop
Checking with some Examples If the SymPy library is installed or Not
Example1
# Import all functions from sympy module using the import keyword from sympy import * numb = 8 # Getting square root of the given number sqrt(numb)
Output:
2√2
Example2
# Import all functions from sympy module using the import keyword from sympy import * numb = 13 # Getting square root of the given number sqrt(numb)
Output:
√13
The mpmath library is normally installed in the background if you installed SymPy with Anaconda. This helps SymPy in a variety of numerical calculations.
If that is not the case, you can install mpmath using one of the following two commands:
conda install mpmath
pip install mpmath
You can also get SymPy straight from its source code by visiting https://github.com/sympy/sympy/releases