## Basics of Calculus


Calculus is the study of how things change. It provides a framework to construct relatively simple quantitative models of change, and to deduce their consequences. If you graph a quadratic you will notice that you do not get a straight line. Think of this like you moving on earth. Though the earth is round, as we walk down the street it looks pretty flat to us. 

If you look at a quadratic function $f$ at some particular argument, call it $z$, and very close to $z$, then $f$ will look like a straight line.  This slope is often written as

$f'\left( x \right) = y' = \frac{{df}}{{dx}} = \frac{{dy}}{{dx}} = \frac{d}{{dx}}\left( {f\left( x \right)} \right) = \frac{d}{{dx}}\left( y \right)$


### What is the rate of change?

On if the important applications of derivatives is finding the rate of change. That is the fact that $f'\left( x \right)$ represents the rate of change of $f\left( x \right)$. 

We can think of it by using an example. Think of a car, in finding the velocity of the car, we are given the position of the car at time $t$. To compute the velocity of the car we just need find the rate at which the position is changing. This can be cacluated using the function below.

$\begin{align*}Velocity & = \frac{{{\mbox{change in position}}}}{{{\mbox{time traveled}}}}\end{align*}$

$\begin{align*}Rate  of  Change = \frac{{f\left( t \right) - f\left( a \right)}}{{t - a}}\end{align*}$



```python
from IPython.display import YouTubeVideo
YouTubeVideo('K2jQ0AGbYaA', width=860, height=460)
```











```python
import numpy as np
import matplotlib.pyplot as plt
from sympy import *

x = symbols('x')
expr = cos(x)

print("Expression : {}".format(expr))

limit_expr = limit(expr, x, 0)

print("Limit of expression tends to 0 : {}".format(limit_expr))

```

    Expression : cos(x)
    Limit of expression tends to 0 : 1


### Introduction to differentiation

So far we've learned how to evaluate limits for points on a line. Now we're going to build on that knowledge and look at a calculus technique called differentiation. In differentiation, we use our knowledge of limits to calculate the derivative of a function in order to determine the rate of change at an individual point on its line. The word differentiation is derived from the word difference (subtraction). The known difference of function $f(x)$ at a point $x$ given a chnage of $\Delta x$ is simply the difference between the values of the function at those points:


The derivative of $f\left( x \right)$ with respect to x is the function $f'\left( x \right)$  and is defined as, $\begin{equation}f'\left( x \right) = \mathop {\lim }\limits_{h \to 0} \frac{{f\left( {x + h} \right) - f\left( x \right)}}{h} \label{eq:eq2}\end{equation}$


```python
from IPython.display import YouTubeVideo
YouTubeVideo('a5WVw9vmGHU', width=860, height=460)
```











```python
import numpy as np
import matplotlib.pyplot as plt
from sympy import *

x = symbols('x')
expr = diff(x**2 +x , x)

print("Expression : {}".format(expr))
print(expr.subs(x,3))

expr = diff(cos(x) +x , x)
print("Expression : {}".format(expr))
print(expr.subs(x,0))
```

    Expression : 2*x + 1
    7
    Expression : 1 - sin(x)
    1


### Introduction to Integration


Lets say we want to find the area under a function between the function line and the X axis. This is called the integral of the function and it's expressed like this. $\int{{f\left( x \right)\,dx}}$ . To calculate the integral of $f(x)$ with respect to $x$, we need to find the anti-derivative of $f(x)$ , which means we needs a function whose derivative is $f(x)$ . By calculating the parallel in reverse, we can figure out that this is one half X squared. 

To do so there are many techniques and methods. Lets discuss them in the video in detail. 


```python
from IPython.display import YouTubeVideo
YouTubeVideo('5pwZchmmgF0', width=860, height=460)
```











```python
x_range = np.linspace(0,2,1000)
f = lambda x:np.exp(x)

plt.plot(x_range, f(x_range))
plt.fill_between(x_range, 0, f(x_range), alpha = 0.25)
plt.title("Area below the curve")
```


```python
import numpy as np
import matplotlib.pyplot as plt
from sympy import *

x = symbols('x')
expr = integrate(x**2 +x , x)

print("Expression : {}".format(expr))
print(expr.subs(x,3))

expr = integrate(cos(x) +x , x)
print("Expression : {}".format(expr))
print(expr.subs(x,3))
```

    Expression : x**3/3 + x**2/2
    27/2
    Expression : x**2/2 + sin(x)
    sin(3) + 9/2


### Exercises

1. Determine where the following function is increasing and decreasing : $ A\left( t \right) = 17{t^3} - 45{t^2} - 130{t} + 150$. Integration can be used to find areas, volumes, central points and many useful things.

2. Sketch the graph of $f\left( x \right) = 3 - {\frac{1}{2}}x $ and identify all the minima and maxima of the function on each of the following intervals.

a). $\left( { - \infty ,\infty } \right)$    

b). $\left[ { - 1,1} \right]$  

c).  $\left[ {1,4} \right]$


3. Evaluate the following indefinite integrals:  $\displaystyle \int{{7{x^6} - 12{x^3} - 5\,dx}}$

**Note** : The following tutorial is a brief introduction to Calculus. You Can dive more deeper using the various resources and books availabe [online](https://www.sydney.edu.au/stuserv/documents/maths_learning_centre/)

5ec3cf3ad04f959549c85936b68261330931eaad
ipynb
Jupyter Notebook
Basics_of_Calculus/Basics_of_Calculus.ipynb
yogeshmpandey/M4DT
efc1f22f6eaca92c4291a583d81d2d8a0717be95
Apache-2.0
2020-06-15T13:37:34.000Z
2020-06-15T13:37:34.000Z
Basics_of_Calculus/Basics_of_Calculus.ipynb
yogeshmpandey/M4DT
efc1f22f6eaca92c4291a583d81d2d8a0717be95
Apache-2.0
Basics_of_Calculus/Basics_of_Calculus.ipynb
yogeshmpandey/M4DT
efc1f22f6eaca92c4291a583d81d2d8a0717be95
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES