# minte9 learningjourney

S R Q

### Increments method

p21 Instant speed at time = 4 is the limit as dt approaches 0
$$s_4(t) = 16*t^2 \enspace then \enspace \lim_{\Delta t \to 0} \frac{\Delta s} {\Delta t} = 128$$
$$s_4'(t) = 128$$  """ Increments method

An average speed of 30 mi/hr does not necessary means an
exact speed for 3 hours. In the case of a ball droped near the
surface of the earth, the formula for distance traveled is:
s = 16t^2 ft/sec

The instant speed is not the quontient of distance and time,
it is the limit of average speeds at exactly t=4.
Using increments method, the numbers seem getting closer to:
s4 = 128 ft/sec
"""

# Average speed during the fifth second approximation
s = 16*5**2 - 16*4**2
print(s)
# 144

# Improve the approximation using interval from 4 to 4.1 seconds
s = (16*4.1**2 - 16*4**2) / 0.1
print(round(s, 1))
# 129.6

# The method of increments
def speed(t1, rate=1):
t2 = t1 + rate
s = 16 * (t2**2 - t1**2) / rate
s = round(s, 1)
print(f'{t1} to {t2} seconds: va = {s} ft/sec')

speed(4, 1)         # 144.0
speed(4, 0.1)       # 129.6
speed(4, 0.01)      # 128.2
speed(4, 0.001)     # 128.0
speed(4, 0.0001)    # 128.0
speed(4, 0.00001)   # 128.0


### Differentiation

p29 The process of using increment method to get the derivative is called differentiation.
$$f(x) = ax^2 \enspace then \enspace \lim_{\Delta x \to 0} \frac{\Delta y} {\Delta x} = 2ax$$
$$f'(x) = 2ax$$  """ Derived function for f(x) = ax^2
f'(x) is pronounced "f prime of x"

It means instantaneous rate of change of y
with respect to x at value x1.

Increment method
y + Dy = a(x + Dx)^2
y + Dy = ax^2 + 2axDx + a(Dx^2)
Dy = 2axDx + a(Dx^2)

As Dx approaches the limit Dx -> 0, the derived is:
f'(x) = 2ax
"""

from sympy import *

# Falling speed
t = Symbol('t')
s  = 16*t**2
d = s.diff(t)
print("s  =", s) # s  = 16t^2
print("s' =", d) # s' = 32*t

# Circle area
r = Symbol('r')
A  = pi*r**2
d = A.diff(r)
print("A  =", A) # A  = pi*r^2
print("A' =", d) # A' = 2*pi*r

# Function f(x)
x = Symbol('x')
f  = x**2
d = f.diff(x)
print("f  =", f) # f  = ax^2
print("f' =", d) # f' = 2*x


### Polynomials

p34 Functions that are a sum or difference of two or more monomials.
$$f(x) = ax^2 + bx + c \enspace then \enspace \lim_{\Delta x \to 0} \frac{\Delta y} {\Delta x} = 2ax + b$$
$$f'(x) = 2ax + b$$  """ Differentiation of Simple Polynomials
Contributions from each term
y   = ax^2 + bx + c
y'  = 2ax + b
y'' = 2a
"""

from sympy import *
x = Symbol('x')

a = 2
b = 3
c = 4

y = a*x**2 + b*x + c
d = y.diff(x)
print(y)            # function
print(y.diff(x))    # first derivative
print(d.diff(x))    # second derivative
# 2*x**2 + 3*x + 4
# 4*x + 3
# 4

The Slope

### The Slope

The slope or gradient of a function in (x,y) point is the derivative.  #
# Function:     f(b) = ax^2
# Derivative:   f'(x) = 2ax
# GradientLine: g(x) = mx + b
# Coeficient:   m (slope or gradient)
# Intercept:    b (where the line crosses y-axis)

# Falliing object s(t) = 16t^2
a = 16;

# Plot function line
X = -5:0.1:5;
Y = a*(X.^2);
plot(X, Y);
hold on;

# Instant speeds
for x=2:5;
y = a*(x.^2);   # 16t^2             = 64, 144, 256, 400
m = 2*a*x;      # 32t               = 64, 96, 128, 160
b = y - m*x;    # 16t^2 - (32t)t    = -64, -144, -256, -400
x, y, m, b
disp('')
end;

for x=2:5;
y = a*(x.^2);
plot(x, y, 'x', 'Color', 'red');

m = 2*a*x;      # slope coeficient (derivative)
b = y - m*x;    # intercept in y = mx + b
X = x:x+2;
t = num2str(x);
plot(X, m*X + b, 'DisplayName', ["s(" t ") = " num2str(m)])
end;

# Plot figure
title ("s(t) = 16t^2");
xlabel ("t (seconds)");
ylabel ("s(t)");
grid on;
legend('location', 'west');

uiwait(gcf); Questions
Last update: 1 days ago