Differential Calculus¶
What is Calculus?
Why we need to so solve it? How does it help our daily lifes? Where we need to use it?
These the common questions that every student must know because looking for our EX (ehemm.. I mean the unknown X value) can be so frustrating and it need excitement!
There are 3 main idea in Calculus which are:
- Limits
- Defferentiation
- Integrations
Calculus can help us in many ways like:
- Analysing the motion of an object and make prediction.
- Analyze money coming in and out in a bussiness to maximize profits.
- Determined the area of random shape for analysis
- and many more…
Note:
This lesson covers the theory about Limits.
Limits¶
Limits is where we find the value of x as its goes to a certain point (for example: going to zero) In the above image. Lets find the Intantaenous speed of X at point C.
We get 100cm/sec in our stop watch, but that not the intantaneous speed at point C. This is the average speed from A-C.
In getting the instantaenous speed at point C, We need to get the average speed of a point closer to C.
Example: Average speed from B to C and C to D.
Lets get the avg speed of these point A-B, B-C, C-D and D,E.
Formula:¶
Avg for AB: (Initialy Distance and Time for A is 0)
$\Large\frac{distance B – distance A}{time B – time A}$
Avg for BC:
$\Large\frac{distance C – distance B}{time C – time B}$
AB = (25-0)/(0.5 -0)
BC = (100-25)/(1-0.5)
# CD has this annoying decimals, so I rounded the value
CD = round((150-100)/(1.25-1),2)
DE = (200-150)/(2-1.20)
position_name = ['AB','BC','CD','DE']
name_value = [AB,BC,CD,DE]
position = list(zip(position_name,name_value))
print('Average Speed')
for i in position:
txt1 = "Between Position {}: {}cm per second".format(i[0:1],i[-1])
print(txt1)
We can see that the Instantaenous speed of point C is in between BC and CD (150cm/s and 250cm/s)
.
Lets gets another closer mesurement. The closer the better!
# Variables
B99 = 99
B99time = 0.98
C = 100
Ctime = 1
C1 = 101
C1time = 1.02
Lets say Point B99 is 99cm and has time of 0.98second (I did 0.98 on purpose instead of 0.99 because we are measuring human (Above example) speed which is not constant, it can accelerate fast and slow down from any change of time)
B99_to_C = (C-B99)/(Ctime-B99time)
C_to_C1 = (C1-C)/(C1time-Ctime)
print('Average Speed')
print('Between Position B99_to_C: ' + str((round(B99_to_C))) + 'cm/sec')
print('Between Position C_to_C1: ' + str((round(C_to_C1))) + 'cm/sec')
The Instantaenous speed of the runner at Point C is 50cm/sec¶
Code sample¶
import numpy as np
import sympy as smp
x = smp.symbols('x', real=True)
Limit¶
Example 1:
Lim x -> 2 $\Large\frac{x^2-4}{x-2}$
Limit of $x$ going to 2 of the function $\Large\frac{x^2-4}{x-2}$
I will use f(2.1) and f(1.99) as these two are closes to value 2.¶
f(2.1)
$\Large\frac{2.1^2-4}{2.1-2}$ = 4.1
f(1.99)
$\Large\frac{1.99^2-4}{1.99-2}$ = 3.98
- 4 is Limit of the function
Using Sympy¶
smp.limit((x**2-4)/(x-2),x,2.1)
smp.limit((x**2-4)/(x-2),x,1.99)