You are on page 1of 3

Root Finding:

xR = xU EMAX =

f ( xU )( xU xL ) f ( xU ) f ( xL ) N + 1 = log 2

xi +1 = xi

f ( xi )( xi 1 xi ) f ( xi 1 ) f ( xi )

xi +1 = xi

f ( xi ) f ( xi )

x 0 2 N +1

x 0 log(x 0 / EMAX ) = EMAX log 2

N = wall movements, N + 1 = guesses

Golden Section:
X 2 = XU d , X 1 = X L + d , d = ( 1)( X U X L )

x 0 ( 1) N 1+ 5 = 1.6180339887 EMAX = (assuming midpoint) 2 2

Simultaneous Equations:

Ax = b LUx = b Ld = b and Ux = d Ax = b P 1 LU = b LUx = Pb Ld = Pb and Ux = d


Iterative methods: xk +1 = Cxk + d
Lagrange Polynomial:

cii = 0 cij = aij / aii

d i = bi / aii

p( x) = L1 ( x) y1 + L2 ( x) y2 + L3 ( x) y3 + LN ( x) y N Lk ( x) = ( x x1 )( x x2 ) ( x xk 1 )( x xk +1 ) ( x xN ) ( xk x1 )( xk x2 ) ( xk xk 1 )( xk xk +1 ) ( xk x N )

Numerator of Lk(x) is product of all (x xi) except for (x xk) Denominator of Lk(x) is product of all (xk xi) except for (xk xk) Newton's Polynomial:

p ( x) = a1 + a2 ( x x1 ) + a3 ( x x1 )( x x2 ) + + a N ( x x1 ) ( x x N 1 ) a1 = y1 Dyi = a2 = Dy1 yi +1 yi xi +1 xi a3 = D 2 y1 a N = D N 1 y1 Dyi +1 Dyi xi + 2 xi D k yi = D k 1 yi +1 D k 1 yi xi + k xi

D 2 yi =

Regression: Straight line fit: y = mx + b

m=

n xi yi xi yi n xi ( xi )
2 2

b=

x y x x y n x ( x )
2 i i i i 2 2 i i

= y mx

r2 =

St S r St

S t = ( yi y ) 2

S r = ( yi f ( xi )) 2

For a straight line fit only: r =

n xi ( xi )
2

n xi yi xi yi
2 2

n yi ( yi )

For y = e x For y = x For y =

x = x

y = ln( y ) = e b , = m y = log( y ) = 10b , = m y = 1 = 1 / b, = m / b y

x = log( x) x = 1 x

x +x

General least squares : y = a0 g 0 ( x) + a1 g1 ( x) + a2 g 2 ( x) + an g n ( x) Basic solution : zij = g j ( xi ) Z T Za = Z T y QR decomposition : Z = QR Ra = Q T y


Integration:

I= I=

h ( f ( x 0 ) + f ( x1 ) ) 2

I=

h ( f ( x 0 ) + 2 f ( x1 ) + 2 f ( x 2 ) + 2 f ( x3 ) + + 2 f ( x N 1 ) + f ( x N ) ) 2

h ( f ( x 0 ) + 4 f ( x1 ) + f ( x 2 ) ) I = h ( f ( x 0 ) + 4 f ( x1 ) + 2 f ( x 2 ) + 4 f ( x3 ) + 2 f ( x 4 ) + + 4 f ( x N 1 ) + f ( x N ) ) 3 3 3h I = ( f ( x0 ) + 3 f ( x1 ) + 3 f ( x2 ) + f ( x3 ) ) 8

I j ,1 = estimate using h j

h h j = j1 1 2

I j ,k =

4 k 1 I j +1,k 1 I j ,k 1 4 k 1 1

I1,k I 2,k 1 I1,k

n
2 3 4

c0
1 5/9 0.347855

x0
-0.57735 -0.77459 -0.861136

c1
1 8/9 0.652145

x1
0.57735 0 -0.339981
b

c2

x2

c3

x3

5/9 0.652145

0.77459 0.339981 0.347855 0.861136

Directly usable only for -1 to 1. For a to b use Differentiation:


First Derivative Forward (2 point) Forward (3 point) Backwards (2 point) Backwards (3 point)

b a n 1 b + a b a + f ( x) dx xi ci f 2 2 i =0 2

Formula

Error O(h) O(h2) O(h) O(h2) O(h2) O(h4)

[ f ( xi +1 ) f ( xi )] / h [ f ( xi +2 ) + 4 f ( xi +1 ) 3 f ( xi )] / 2h [ f ( xi ) f ( xi 1 )]/ h [3 f ( xi ) 4 f ( xi 1 ) + f ( xi 2 )] / 2h [ f ( xi +1 ) f ( xi 1 )] / 2h [ f ( xi +2 ) + 8 f ( xi +1 ) 8 f ( xi 1 ) + f ( xi 2 )] / 12h
hj = h1 2 j 1 D j ,k = 4 k 1 D j +1,k 1 D j ,k 1 4
k 1

Central (2 point)

Central (4 point)

D j ,1 = estimate using h j
ODE's:

D1,k D2,k 1 D1,k

dy = f (t , y ) dt Heun : y
0 i +1

yi +1 = yi + h Euler : = f (ti , yi ) Midpoint : = f (ti +1/ 2 , yi +1/ 2 ) = yi + f (ti , yi )h


1 i +1

f (ti , yi ) + f (ti +1 , y j 1i +1 ) y i +1 = yi + h 2
j m i +1

no iteration yi +1 = y

with iteration yi +1 = y dy = y, dt

y m i +1 y m 1i +1 < y m i +1

dy d2y A 2 + B + Cy = D dt dt

dy D By Cy = dt A

You might also like