Slope • Slope = rise/run • = Dy/Dx • = (y 2 – y 1)/(x 2 – x 1) • Order of points 1 and 2 not critical • Points may lie in any quadrant: slope will work out • Leibniz notation for derivative based on Dy/Dx; the derivative is written dy/dx
Exponents • x 0 = 1
Derivative of a line • • • y = mx + b slope m and y axis intercept b derivative of y = axn + b with respect to x: dy/dx = a n x(n-1) Because b is a constant -- think of it as bx 0 -- its derivative is 0 b-1 = 0 • For a straight line, a = m and n = 1 so • dy/dx = m 1 x(0), or because x 0 = 1, • dy/dx = m
Derivative of a polynomial • In differential Calculus, we consider the slopes of curves rather than straight lines • For polynomial y = axn + bxp + cxq + … • derivative with respect to x is • dy/dx = a n x(n-1) + b p x(p-1) + c q x(q-1) + …
Example y = axn + bxp + cxq + … dy/dx = a n x(n-1) + b p x(p-1) + c q x(q-1) + …
Numerical Derivatives • slope between points
Derivative of Sine and Cosine • • sin(0) = 0 period of both sine and cosine is 2 p d(sin(x))/dx = cos(x) d(cos(x))/dx = -sin(x)
Partial Derivatives • Functions of more than one variable • Example: h(x, y) = x 4 + y 3 + xy
Partial Derivatives • Partial derivative of h with respect to x at a y location y 0 • Notation dh/dx|y=y 0 • Treat ys as constants • If these constants stand alone, they drop out of the result • If they are in multiplicative terms involving x, they are retained as constants
Partial Derivatives • Example: • h(x, y) = x 4 + y 3 + xy • dh/dx|y=y 0 = 4 x 3 + y 0
WHY?
Gradients • del C (or grad C) • Diffusion (Fick’s 1 st Law):
Numerical Derivatives • slope between points • MATLAB – c=[]; – [dcdx, dcdy]=gradient(c) – contour([1: 20], c) – hold – quiver([1: 20], -dcdx, -dcdy)