# How To Make Python Derivative Calculator

How Cool it could be if we can create a cool scientific calculator using python. Isn’t it? Well We Can

Hey Python Developers!!. So today, we are going to learn how you can solve derivative using python. Sounds Cool?

What Should be needed to make this program? Just Basics Of Python and Basic Understanding Of Derivatives. So Now if you are ready. Should we dive into it? ## Get Your WorkSpace Ready For The Program

So, before we dive in. Make sure that we are working on python three here. And we will be using a very famous mathematical python library called Sympy.

Maybe You have already heard about it. Anyways, we will use Python3 + Sympy = For Derivative Calculator.

## Enough Of Theory… Let’s Make Python Derivative Calculator

Ohh did I took so long? If so sorry, Now let’s look into the coding.

First of all, you have to install the sympy library on your system. So just open your terminal and install sympy library using PIP.

`pip install sympy` After pressing enter, sympy will be installed on our computer. Now let’s Create a new file derivative.py and enter the following python code into it.

```from sympy import Symbol, Derivative
equation = str(input('Enter Equation: '))
x = Symbol('x')
derivative= Derivative(equation, x)
result = derivative.doit()
```

You Can Also Go To our Github Repository Of the same, and download/clone the repository to your computer.

Now Just go to Terminal and run your python file derivative.py.  It will ask you to enter the equation. Now you have to enter the equation, but the way of writing equation is different.

• x³ = x**3
• 4x = 4*x
• sinx = sin(x)
• and so on… if you have any doubt comment below : ) After entering your required equation, and press enter. You will get the result for the derivative.

## What’s Happening Inside The Code? Let’s Break It Down …

So at the beginning of the script, first of all, we are importing a very famous maths python library called sympy. Then using the sympy module, we are calling the derivative function.

After that, we are entering our desired equation. And then the entered equation is passed to the derivative function.

And finally, the derivative of the equation is calculated. So that was a little description of the script for beginners to the python.

Loved This one? I have Also written a step by step tutorial guide on how to make a definite and indefinite integral calculator On python. Be sure to check out also that.