Professional Documents
Culture Documents
Linear and Nonlinear
Linear and Nonlinear
i)
ij = aij ik ukj ,
k =1
j i,
i = 1,2,..., n
illustration: n=4 (order of matrix), i=2, j=3 L23 = a23 (L21U13 + L22U23)
ii)
uij =
aij ik ukj
k =1
i 1
ii
1
i j,
j = 2,3,..., n
u23 =
a23 2 k uk 2
k =1
ii
i j,
j = 2,3,..., n
U23 = (a23 L21U13)/L22 iii) For j=1 n=4, i1 = a i1 . Illustration: i=1, L11=a11, L21=a21, L31 = a31, L41 = a41. a1 j a1 j u1 j = = iv) For i=1, 11 a11 illustration: n=4, U11 = a11/a11 , U12 = a12/a11, U13=a13/a11, U14=a14/a11.
v) For solving Ax = b, convert to [A:b] to [U:b] then solve for the unknown by back-substitution, where
b1 ' =
b1 11
bi ' =
bi ik bk '
k =1
i 1
ii
i j,
j = 2,3,..., n
5. Iterative Methods solving each equation for one of the variables, choosing, when possible, to solve for the variable with the largest coefficient. Start with an initial vector of (0,0,0). 5.1 Jacobi method the method of simultaneous displacements where each of the equations is simultaneously changed by using the most recent set of x-values. 5.2 Gauss-Seidel Method Similar to Jacobi method but each value of x is improved by using the most recent approximations of the other variables. II. SOLVING NONLINEAR EQUATIONS 1. Bisection Method (Interval Halving) This is an old method but an effective way for finding a zero of f(x). The technique is to begin with two initial values of x=a and x=b that enclose a root of f(x) = 0 satisfying that f(a)*f(b) < 0. Algorithm: Set x3 = (x1+x2)/2, If f(x3)*f(x1) < 0 then x2 = x3. Otherwise, x1 = x3. y y=f(x) f(a) x1 (root) x
x=a
x=b f(b)
Example 1.1: Find a root of f(x) = x3 + x2 3x 3 = 0 starting with a =1 and b = 2 by the bisection method with a tolerance of 1x10-5.
2. Newtons Method This method which is based on a linear approximation of the function is very useful for solving non polynomial functions. Algorithm: To determine a root of f(x)=0, given a value x0 reasonably closer to the root, compute for f(x0) and f(x0). Set x1 = x0. IF (f(x0) is not zero) AND (f(x0) is not zero) REPEAT Set x0 = x1, f ( x0 ) Set x1 = x0 . f ' ( x0 ) General Formula:
xn+1 = xn
f ( xn ) , f ' ( xn )
n = 0,1,2,... `
x1
xo
xo x1 Example 2.1: By Newtons method approximate the solution to f(x) = 3x + sinx ex with a tolerance of 1 x 10-5. III. INTERPOLATION AND CURVE FITTING Interpolation is the method of finding the values for a tabulated function at points not in the table. Divided Difference Method is an efficient method for constructing the interpolating polynomials and getting interpolated values. Steps: a) Assume f(x) is known at several values of x. x0 f0 x1 f1 x2 f2 x3 f3
4 b) Use the following general formulas for the first divided difference between xs and xt.
f [ x s , xt ] =
f [ x0 , x1 ,.., xn ] =
For, zero-order difference: f[xs] = fs = fs . c) The interpolating polynomial that fits a divided difference table at x0, x1, ,xn is then
[ 0]
[1]
[2]
[n]
f [ x0 , x1 ] = f [ x1 , x2 ] =
f1 f 0 [1] = f0 x1 x0
f 2 f1 [1] = f1 x2 x1
Second-order difference:
f [ x0 , x1 , x2 ] =
f [ x1 , x2 ] f [ x0 , x1 ] [ 2] = f0 x2 x0
Example 3.1: Construct the divided difference table for the values shown in the table. Obtain the interpolating polynomial of degree 4 that fits the table from x0 = 3.2 to x5 = 5.6.
xi 3.2 2.7
fi[1]
fi[2]
fi[3]
fi[4]
Least-Squares Approximations are used to fit a curve to an approximate set of linear data by determining the constants a and b in the equation involving the variables x and y (a linear relationship): y = ax + b. Let Yi represent an experimental value, and let yi be a value from the equation yi = axi + b, where xi is a particular value of the variable assumed to be free of error. Normal Equations: a xi + b xi = xi Yi ,
2
a xi + bN = Yi . Example: In a Physics Laboratory, students would want to determine the effects of temperature on a resistance. They have recorded the temperature and resistance measurements as shown in the table where the graph suggests a linear relationship. Find the linear equation that would fit the data. What is the approximate resistance when the temperature is 1000C?
Resistance, ohms
Temperature, 0C