Académique Documents
Professionnel Documents
Culture Documents
The Authors
CHAPTER
SOLUTIONS TO
LINEAR
EQUATIONS
A linear equation is an algebraic equation in which
each term is either a constant or the product of a constant
and (the first power of) a single variable.
Linear equations can have one or more variables.
Linear equations occur abundantly in most subareas
of mathematics and especially in applied mathematics.
While they arise quite naturally when modeling many
phenomena, they are particularly useful since many nonlinear equations may be reduced to linear equations by
assuming that quantities of interest vary to only a small
extent from some "background" state. Linear equations do
not include exponents.
A common form of a linear equation in the two
variables x and y is
General Form:
Standard Form:
Matrix form:
Using the order of the standard form
][ ]
[ ]
Becomes
[
][ ]
2.
A.
1.
Interchange
Example:
A=[
2.
Example:
A=[
3.
Addition of Rows
Example:
A=[
]
]
ss=s[
B.
Example:
a.
b.
C.
Example:
a.
Examples:
1.
A=[
adjoint ( A)
inv(A) = det( A )
T
adj(A)= [ cof ( A ) ]
adj(A) = [
inv(A) =
inv(A) = [
|]
R1 / 2
=[
|]
=[
|]
=[
=[
R2 - 4 R 1
R2 /-4
R1 2.5R2
|]
|]
Therefore,
inv(A) = [
2.
B =[
inv(B) =
adjoint (B)
det(B)
8
4
adj(B) =
8
4
7
2 6
0
0
5 0
3 0
0
0
5 0
3 0
2 6
5 8
3 4
5 8
3 4
2 7
48 (30) 19
0
(4)
= 0
24 (18) 13
0
24
48
30
0
18
adj(B) =
19 4 13
det(B) = [(-3)(7)(0) + (4)(6)(5) + (0)(-2)(8)] [(0)(7)(5) + (-3)(6)(8) + (4)(-2)(0)]
det(B) = -24
0
24
48
30
0
18
19 4 13
inv(B) =
24
0
1
2
0
.75
inv(B) = 1.25
B =[
R1 /-3
|
|
[
R2 x 3/13
]
R3 + 4/3R2
|
|
[
R2 + 2R1
R3 - 5R1
|
|
[
]
|
|
R2 18/13R3
R1 + 4/3R2
|
|
[
[
R3 x 13/24
]
|
Therefore,
0
1
2
0
.75
inv(B) = 1.25
Solved Examples
INVERSE MATRIX METHOD
inv (A) Ax = inv (A) C
1.
Solution:
[
][ ]
A x =
For inv(A)
|]
|
|]
[
[
X=[
|]
|]
|] (inverse of A)
][
X= [ ]
2.
Solution:
[
] [ ]
[ ]
A
x = C
Using the elementary row operations to get
the inverse of A, we will arrive at:
Inv(A) = [
x=
inv(A)
x=[
x=[
II.
1.
C
] [ ]
Exercises
Solve for the inverse of the following matrices:
C=
3
9
5 2 1
8 5 2
6 3 5
1 3 4
2.
D=
3.
E=
5
8
9 7 2
5 2 4
7 3 8
2 1 5
4
8
7 9 2
5 2 3
7 8 2
4 7 9
5.
6
Introduction
II.
Solved Examples
1.
x3 = 2
Add 1 times Row 3 to Row2.
Add 3 times Row 3 to Row 1.
x1 2x2 = 6
x 2= 5
x3 = -2
3.
x1+ x2 + 2x3 + x4 + x5 = 24
x1 + x2 + x3 + 2x4 + x5 = 48
x1 + x2 + x3 + x4 + 2x5 = 96
Solution:
R1 * 1/2
|
|
[
]
|
|
R2 R1
R3 R1
]
|
R4 R1
R5 R1
R2 * 2/3
|
|
[
]
|
|
R3 1/2R2
|
[
R4 1/2R2
R5 1/2R2
|
|
R3 * 3/4
|
[
]
|
|
|
R4 1/3R3
R5 1/3R3
|
|
|
[
R4 * 4/5
]
|
|
|
R5 1/4R4
|
|
|
[
]
|
R5 * 5/6
|
[
x1 + x2 + x 3 + x 4 + x 5 = 3
x2 + 1/3 x3 + 1/3x4 + 1/3x5 =
x3 + 1/4x4 + 1/4x5 =
27
/2
x4 + /5x5 = 30
x5 = 65
Therefore,
x5 = 65
x4 = 30 - 1/5(65) ; x4 = 17
x3 = 27/2 - 1/4(17) - 1/4(65); x3 = -7
x2 = 6 - 1/3 (-7) - 1/3(17) - 1/3(65) ;
x2 = -19
x1 = 3 - (-19) - (-7) - (17) -
(65) ; x1 = -25
x1 = -25
x2= -19
x3 = -7
x4= 17
x5 = 65
III.
Exercises
x1 + 3x2 + 4x3 = 3
2x1 + 7x2 + 3x3 = 7
2x1 + 8x2 + 6x3 = 4
2.
3.
2x2 + 6x3 = 2
3x1 + 9x2 + 4x3 = 7
x1 + 3x2 + 5x3 = 6
4.
x1 2x2 6x3 = 12
2x1 + 4x2 + 12x3 = 17
x1 4x2 12x3 = 22
5.
Introduction
Gauss Jordan Elimination is a method of solving
linear equations. This method is done by transforming the
systems augmented matrix to reduced-row echelon form
by means of row operations.
Reduced row-echelon form:
(1) each row starts with an initial 1 (0s to the left of it)
(2) each initial 1 is to the right of the one in the row above
(3) there are 0s below and above each initial 1
(4) rows of all zeroes will be at the bottom
II.
Solved Examples
1. Solve the following system of linear equation using Gauss
Jordan Method.
x+y=7
2x + 3y =18
Solution:
[
]
[
)
] )
] )
Hence,
x = 3 and y = 4
2.
[
Hence,
x = 1, y = 4, z = -2
3.
Componen
t
Solution:
15x1 + 17x2 + 19x3 = 2120
0.25x1 + 0.33x2 + 0.42x3 = 43.4
x1 + 1.2x2 + 1.6x3 = 164
R1 * 1/15
R2 0.25R1
R3 R1
|
|
R2 * 150/7
]
R1 17/15R2
|
|
[
R3 1/15R2
]
|
|
[
[
R3 * 70/13
R1 + 87/70R3
R2 - 31/14R3
X1 = 20
X2 = 40
X3 = 60
Hence, the number of components that can be
produced per day is 120 components
III. Exercises
Solve the following linear equations using Gauss Jordan Method.
1. x1 + 5x2 = 7
2x1 7x2 = 5.
2. 2x +4 y = 10
4x + y =6
3.
4.
5.
2x2 + x3 = 8
x1 2x2 3x3 = 0
x1 + x2 + 2x3 = 3
x + 3y + 5z = 22
2x + 4y +6z = 28
x + 2y + 4z = 17
x1 2x2 6x3 = 12
2x1 + 4x2 + 12x3 = 17
x1 4x2 12x3 = 22
Introduction
An iterative technique named after Carl Gustav
Jacob``Jacobi(1804- 1851). In numerical linear algebra,
the Jacobi method (or Jacobi iterative method) is an
algorithm for determining the solutions of a diagonally
dominant system of linear equations.
Two assumptions made on Jacobi Method
1.
2.
Diagonally Dominant
The coefficient on the diagonal must be atleast
equal to the sum of the coefficient in that row and atleast
one row with a diagonal coefficient greater than the sum of
the other coefficient in that row.
Diagonally Dominant means:
| | | | (I = 1, 2, ,n)
Where k = 0, 1, 2 . . .
1.
X1
0
0.666667
0.6
1.044445
1.024445
1.011852
0.997704
0.998790
0.999691
1.000117
1.000051
X2
0
3
2.1333333
2.033333
1.962221
1.994444
2.000148
2.001445
2.00080
1.999947
1.999946
Solve for
| | | |
] | | | |
| | | |
| |
| |
| |
X3
0
28
3.266667
3.106667
2.997778
2.987555
2.996518
3.000489
3.000531
3.000100
2.999966
2.
| | | |
] | | | |
| | | |
|
|
|
|
|
|
Solve for
n
0
1
2
3
4
5
6
7
8
9
10
X1
0
3.148150
2.156930
2.491670
2.400930
2.431550
2.423230
2.426030
2.425270
2.425520
2.425460
X2
0
4.8
3.269130
3.685250
3.545130
3.583270
3.570460
3.573950
3.572780
3.573100
3.573000
X3
0
2.037040
1.889850
1.936550
1.922650
1.926920
1.925650
1.926040
1.925930
1.925960
1.925950
3.
n
0
1
2
3
4
5
6
7
X1
0
-0.2
0.146031
0.191745
0.180881
0.185358
0.186325
0.186053
III.
Exercises
1.
X2
0
0.222222
0.203174
0.328394
0.332345
0.329260
0.331160
0.331294
| |
| |
|
X3
0
-0.428571
-0.517460
-0.415873
-0.420700
-0.424369
-0.422649
-0.422641
2.
3.
4.
5.
Friedrich Gauss and Philipp Ludwig von Seidel, and is similar to the
Jacobi method. Though it can be applied to any matrix with nonzero elements on the diagonals, convergence is only guaranteed if
the matrix is either diagonally dominant, or symmetric and positive
definite. The Gauss-Seidel method is a technique for solving the n
equations of the linear system of equations Ax=b one at a time in
sequence, and uses previously computed results as soon as they are
available,
II. EXAMPLES
n
0
1
2
3
X1
0
0.75
0.911458
1.001007
X2
0
2.5
2.004464
1.998498
X3
0
3.145833
3.008494
2.999540
4
5
1.000260
0.999996
1.999991
2.000004
2.999976
3.000001
X1
0
0.75
0.9375
0.993303
0.999495
0.999973
X2
0
1.75
1.979166
1.998759
1.999961
2.000002
X3
0
-1
-1.005952
-1.000779
-1.000066
-1.000004
1.
Solve for
2.
n
0
1
2
3
4
5
Solve for
3.
n
0
1
2
3
4
Solve for
X1
0
1.3
0.9984
0.998691
0.999917
X2
0
1.04
1.00672
1.000297
0.999993
X3
0
0.936
0.939648
1.000232
1.000017
III. EXERCISES
1.
2.
3.
4.
5.
1-6 LU DECOMPOSITION
I.
Introduction
LU(Lower Upper) Decomposition or LU factorization
was introduced by Alan Turing in 1948.
LU decomposition is a way to break or factor a matrix A
A=[
L =[
U=[
A = LU
[
]=[
]x[
Z = C
][ ] = [ ]
UX=Z
[
][ ]= [ ]
II.
Solved Examples
Example 1
Solve the following Linear Equation.
A=[
+3
=1
=3
C=[ ]
Step 1
[
] x
l21 =
[
] 2nd row
Step 2
[
] x [
Step 3
[
][ ] = [ ]
=3
=
z=[ ]
][ ]=[ ]
=
= -2
x=[
Example 2
Solve the following equation.
9
+3
= 18
+2
= 11
16
A=[
+4
] C=[
= 27
]
Solution:
Step 1
[
l21 =
] x
[
[
]
]
] x
2nd row
Step 2
[
l31 =
3rd row
Step 3
] x (-2) =
] l32 = -2
]
[
3rd row
Step 4
x [
] = [
LZ=C
A=[
] C=[
]x[
][ ]=[
= 18
= 11 - (18) = 3
= 27 [
(18) + 2(3) = 1
]
UX=Z
]x[ ]=[
=1
] =2
= [3 =3
x=[ ]
X=[
Example 3
Solve the following Linear Equation.
0.1
+7
0.3
0.2
-0.2
0.3
+ 10
= 7.85
= -19.3
= 71.4
L=[
U=[
LZ=C
][ ] = [
z=[
UX=Z
[
][ ]=[
= 6.993
x=[
III. Exercises
1. Solve the following linear equation
+2
+5
2.
=6
= 10
+3
=5
-4 +6
= 18
=6
-3
3.
4.
5.
= -2
=4
=3
= -5
=1
I.
Introduction
Where:
II.
Examples
1.
Determine the L and U resulting from a Cholesky
Method Decomposition.
[
] [
Solution:
Hence,
2.
(a)Suppose that Cholesky Method Decomposition is
required to decompose the coefficient matrix derived from the
system of linear equation shown below. (b) Solve the system of
linear equation using LU Decomposition method.
] [
Hence,
Hence,
[
3.
(a) Suppose that Cholesky Method Decompositionis
required to decompose the coefficient matrix derived from the
system of linear equation shown below.(b) Solve the system of
linear equation using LU Decomposition method.
Hence,
] [
] [
Hence,
III. Exercises
1. Determine the L and Uresulting from the Cholesky
Method.
2.
3.
4.
5.
CHAPTER
2
SOLUTIONS TO
NON-LINEAR
EQUATIONS
A nonlinear system of equations is a set of simultaneous equations in
which the unknowns appear as variables of a polynomial of degree higher than
one or in the argument of a function which is not a polynomial of degree one. In
other words, in a nonlinear system of equations, the equation(s) to be solved
cannot be written as a linear combination of the unknown variables or functions
that appear in it (them). It does not matter if nonlinear known functions appear
in the equations.
Nonlinear algebraic equations, which are also called polynomial
equations, are defined by equating polynomials to zero. For example,
Now, consider the interval [a,b] around the zero of the function f(x)
such that f(a)<0 and f(b)>0. With the given interval [a,b], we can compute for
the midpoint c which is closer to the zero of the function f(x). The interval
would then be reduced by replacing a or b with c depending on the value of f(c)
which would satisfy the condition f(a)<0 and f(b)>0. By doing this repeatedly,
the interval [a,b] will converge to the zero of the function.
Note: for convention, truncate your answer to 6 decimal places. The
iterations will stop when the preceding value and the present value of a, b and c
are equal to 3 decimal places.
Examples
1.
Solution,
iterations
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
0
1.25
1.25
1.5625
1.71875
1.71875
1.71875
1.71875
1.728516
1.728516
1.730957
1.730957
1.731567
1.731873
1.732025
1.732
5
2.5
2.5
1.875
1.875
1.875
1.796875
1.757813
1.738281
1.738281
1.733398
1.733398
1.732178
1.732178
1.732178
1.732178
1.732
2.5
1.25
1.875
1.5625
1.71875
1.796875
1.757813
1.738281
1.728516
1.733398
1.730957
1.732178
1.731567
1.731873
1.732025
1.732101
1.732
3.25
-1.4375
0.515625
-0.55859
-0.0459
0.22876
0.089905
0.021622
-0.01223
0.00467
-0.00379
0.00044
-0.00167
-0.00062
-8.9E-05
0.000175
Solution,
iterations
0
1
2
3
4
5
2
2
2.75
3.125
3.3125
3.40625
5
3.5
3.5
3.5
3.5
3.5
3.5
2.75
3.125
3.3125
3.40625
3.453125
0.013753
-0.26675
-0.13175
-0.06036
-0.02365
-0.00504
6
7
8
9
10
11
12
13
3.453125
3.453125
3.464844
3.464844
3.464844
3.464844
3.465576
3.465576
3.466
3.5
3.476563
3.476563
3.470703
3.467773
3.466309
3.466309
3.465942
3.466
3.476563
3.464844
3.470703
3.467773
3.466309
3.465576
3.465942
3.465759
3.466
0.004335
-0.00036
0.001988
0.000815
0.000229
-6.4E-05
8.26E-05
9.35E-06
Solution,
iterations
0
1
2
3
4
5
6
7
8
9
10
11
12
0.5
0.5
0.75
0.875
0.9375
0.9375
0.9375
0.9375
0.941406
0.941406
0.942383
0.942383
0.942383
0.942
1.5
1
1
1
1
0.96875
0.953125
0.945313
0.945313
0.943359
0.943359
0.942871
0.942627
0.943
1
0.75
0.875
0.9375
0.96875
0.953125
0.945313
0.941406
0.943359
0.942383
0.942871
0.942627
0.942505
0.943
0.283662
-0.82056
-0.33102
-0.02489
0.130984
0.053211
0.014173
-0.00536
0.004408
-0.00047
0.001966
0.000746
0.000135
Exercises
Find the root of the following functions using bisection method.
1.
2.
3.
4.
5.
Examples
Find the value of x using Newton-Rhapson method.
1.
Given:
N
0
1
2
3
5
4.571429
4.497098
4.494941
x = 4.4949
15
1.941702
0.053255
0.000032
35
26.122457
24.694887
24.653955
4.571429
4.497098
4.494941
4.494939
No. of iterations: 3
2.
Given:
n
0
1
2
3
x = 0.6269
3.
Given:
0
0.666666
0.627304
0.626926
2
-0.142739
-0.001342
0.000002
-3
-3.626358
-3.558592
-3.557956
No. of iterations: 3
0.666666
0.627304
0.626926
0.626926
n
0
1
2
3
4
5
6
7
8
9
10
11
12
13
2
2.083333
2.136110
2.170208
2.192493
2.207161
2.216855
2.223284
2.227551
2.230346
2.232176
2.233410
2.233938
2.234596
x = 2.234
-1
-0.287134
-0.083472
-0.024438
-0.007186
-0.002118
-0.000626
-0.000185
-0.000054
-0.000016
-0.000005
-0.000001
-0.0000008
-0.0000002
12
5.440439
2.447966
1.096577
0.489879
0.218468
0.097357
0.043353
0.019316
0.008740
0.004050
0.001891
0.001215
0.000580
2.083333
2.136110
2.170208
2.192493
2.207161
2.216855
2.223284
2.227551
2.230346
2.232176
2.233410
2.233938
2.234596
2.234940
No. of iterations: 13
Exercises
Find the root of the following functions. Use Newton-Raphson Method.
Compare it using Bisection Method and Analytical Method.
1.
2.
3.
4.
5.
Examples
1.
Assume
and
n
1
2
3
4
5
5
10
7.4
7.903225
8.005635
Iteration = 4
2.
using Secant
10
7.4
7.903225
8.005635
7.999950
-24
26
-6.24
-1.055159
0.062016
7.4
7.903225
8.005635
7.999950
7.999999
answer=8
Assume
26
-6.24
-1.055159
0.062016
-0.000549
and
n
1
2
3
4
5
6.
3
4
3. 511704
3.680658
3.745598
3.732460
Iteration = 5
4
3. 511704
3.680658
3.745598
3.732460
3.733071
-6.914463
6.598150
-3.490882
-0.969239
0.245802
-0.012007
answer = 3.733
6.598150
-3.490882
-0.969239
0.245802
-0.012007
-0.000155
3. 511704
3.680658
3.745598
3.732460
3.733071
3.733078
3.
Assume
and
n
1
2
3
4
0
1
0.390662
0.441257
Iteration = 3
1
0.390662
0.441257
0.448770
-1
1.559752
-0.141240
-0.018263
1.559752
-0.141240
-0.018263
0.000242
0.390662
0.441257
0.448770
0.448671
answer = 0.449
Exercises
1.
2.
3.
4.
5.
Find a root of
x 10; Assume
and
Find a root of
- = 1; Assume
and
Find a root of ln(x) 2 = 0; Assume
and
Find a root of x-sin[x]-(1/2) = 0; Assume
and
Find a root of
+
1 ; Assume
and
So the general formula in solving roots for the Regula-Falsi method is,
Examples
1.
Given the function f(x) = x2 5x 24 , find the root using Regula Falsi
Method.
f(x) = x2 5x 24 , [ 5 , 10 ]
Solution:
when n=1
a=5
b=10
f(a) =
f(5)
f(b) = f(10)
= 52 5(5) 24
= -24
= 102 5(10) 24
= 26
f(c ) = f(7.4)
= 7.42 5(7.4) 24
= -6.24
f(a)*f(c)
=(-,-)
=+
And so on when n = 2
n
f(a)
f(b)
f(c)
f(a)*f(c)
10
-24
26
7.4
-6.24
7.4
10
-6.24
26
7.903225
-1.055159
7.903225
10
-1.055159
26
7.984999
-0.164785
7.984999
10
-0.164785
26
7.997689
-0.025415
7.997689
10
-0.025415
26
7.999644
-0.003915
7.999644
10
-0.003915
26
7.999945
-0.000604
x=8
Given the function f(x) = x3 + 3x 5 find the root using Regula Falsi
Method.
2.
f(x) = x3 + 3x 5 , [ 1 ,2 ]
n
f(a)
f(b)
f(c)
f(a)*f(c)
-1
1.1
-0.369
1.1
-0.369
1.135446 -0.129802
3 1.135446 2 -0.129802
1.147737
-0.044874
4 1.147737
1.151965
-0.015420
2 -0.044874
5 1.151965
2 -0.015420
1.153415
-0.005290
6 1.153415
2 -0.005290
1.153912
-0.001815
7 1.153912
2 -0.001815
1.154082 -0.000626
x = 1.154
Given the function f(x) = ex 3x2 find the root using Regula Falsi
Method.
3.
f(x) = ex 3x2 , [ 3 , 4 ]
n
f(a)
f(b)
f(c)
f(a)*f(c)
-6.914463
6.598150
3.511704
-3.490882
3.511704
-3.490882
6.598150
3.680658
-0.969239
3.680658
-0.969239
6.598150
3.721559
-0.221228
3.721559
-0.221228
6.598150
3.730591
-0.048179
3.730591
-0.048179
6.598150
3.732543
-0.010398
3.732543
-0.010398
6.598150
3.732963
-0.002251
3.732963
-0.002251
6.598150
3.733054
-0.000485
x = 3.733
Exercises
1. Find a root of x * cos[(x)/ (x-2)]=0 using Regula Falsi Method
2. Find a root of x2 = (exp(-2x) - 1) / x using Regula Falsi Method
3. Find a root of exp(x2-1)+10sin(2x)-5 = 0 using Regula Falsi Method
4. Find a root of exp(x)-3x2=0 using Regula Falsi Method
5. Find a root of tan(x)-x-1 = 0 using Regula Falsi Method
CHAPTER
3
NUMERICAL
DIFFERENTIATION & INTEGRATION
Introduction
Let f be a given function that is only known at a number of
isolated points. The problem of numerical differentiation is to compute
an approximation to the derivative f 0 off by suitable combinations of
the known values off.
Recall that:
II.
Solved Examples
1. Determine the derivatives of
Use analytical and numerical method.
Solution: Analytical Method
when x is equal to
-23.141
Solution: Numerical Method
-23.141
2.
when x = 5. Use
2.609
3.
-0.6536
if
III.
Exercises
1.
2.
3.
4.
5.
when x = 0.8.
when x = 8.
I.
INTRODUCTION
x1 = a + x,
x2 = a + 2x, . . . , xn = a + nx = b.
y1 = f(x1),
Where:
(Also known as h)
n= no. of segments
II.
SOLVED EXAMPLES
I= [
]-[
I= -7.33
Using Trapezoidal Method:
f(2)= -4 ; f(4)= -2
I
I
I -6
[-4+ 2(-4.25-4-3.25)-2]
I -7.25
Check (Using Calculator)
Set calculator to MODE 7, input equation and steps to acquire the table.
X
2
2.5
3
3.5
4
f(x)
-4
-4.25
-4
-3.25
-2
four subintervals.
SOLUTION:
First, solve for h:
n= 4
h=
h=
= 0.25
I -3.80437
x
1
1.25
1.5
1.75
2
III.
F(x)
-5.281
-4.759
-4.018
-2.995
-1.61
EXAMPLES
1.
Using
2.
3.
4.
5.
2.1
3.2
2.4
2.7
2.7
2.9
3.0
3.5
3.3
4.1
by
3.6
5.2
f (x)
f 2 ( x ) where
f 2 ( x) a0 a1 x a2 x .
2
~
f ( x) Cubic function.
Simpson 3/8 rule for integration can be derived by approximating the
given function
f (x)
f 3 ( x ) a0 a1 x a 2 x 2 a3 x 3
a0
1
2
3
1, x, x , x
a 2
3
The unknown coefficients a0 , a1 , a2 and a3 can be obtained by
substituting 4 known coordinate data points
f ( x0 ) a0 a1 x0 a 2 x02 a3 x02
f ( x1 ) a0 a1 x1 a 2 x12 a3 x12
f ( x 2 ) a0 a1 x 2 a 2 x 22 a3 x 22
f ( x3 ) a0 a1 x3 a 2 x32 a3 x32
where:
I f x dx
a
b
f 3 x dx`
a
b a
f x0 3 f x1 3 f x2 f x3
8
Since
ba
,
3
then b a 3h
3h
f x0 3 f x1 3 f x2 f x3
8
ba
n
I f x dx
a
b
f 3 x dx
a
x3
xn b
x6
f x dx f x dx ........ f x dx
x0 a
x3
xn 3
3h f x0 3 f x1 3 f x2 f x3 f x3 3 f x4 3 f x5 f x6
n 2
n 1
n 3
3h
f x0 3 f xi 3 f xi 2 f xi f xn
8
i 1, 4, 7 ,..
i 2 ,5,8,..
i 3, 6, 9 ,..
]
Where:
Interval gap ( ) =
EXAMPLES
1.
Approximate I=
Solution :
0
1
2
3
4
5
6
7
8
9
1
1.111111
1.222222
1.333333
1.444444
1.555555
1.666666
1.777777
1.888888
2
0.5
0.447513
0.40099
0.36
0.324
0.292418
0.264705
0.240356
0.218918
0.2
( )
( )
[
]
I
I
0.3217497917
2.
Approximate I=
with h=0.2
Solution :
0
1
2
3
4
5
6
0
0.2
0.4
0.6
0.8
1
1.2
1
0.818730
0.670320
0.548811
0.449328
0.367879
0.301194
( )
[
]
I
0.698819025
I
3.
Approximate l=
Solution:
0
1
2
3
4
5
6
7
8
9
0
0.342020
0.642787
0.866025
0.984807
0.984807
0.866025
0.642787
0.342020
0
/9
( )
( )
[
]
2.000380848
I
EXERCISES
1.
2.
by
by Simpsons 3/8
3.
x 8 to x 30
140000
s 2000 ln
9.8 x dx
140000 2100t
8
30
Use Simpson 3/8 rule to find the approximate value of the integral.
4.
5.
Find
method.
CHAPTER
4
CURVE FITTING
Curve fitting is the process of constructing a curve, or mathematical
function that has the best fit to a series of data points, possibly subject to
constraints.
Curve fitting can involve either interpolation, where an exact fit to the
data is required, or smoothing, in which a "smooth" function is constructed that
approximately fits the data.
A related topic is regression analysis, which focuses more on questions
of statistical inference such as how much uncertainty is present in a curve that is
fit to data observed with random errors. Fitted curves can be used as an aid for
data visualization, to infer values of a function where no data are available, and
to summarize the relationships among two or more variables.
Extrapolation refers to the use of a fitted curve beyond the range of
the observed data, and is subject to a degree of uncertainty since it may reflect
the method used to construct the curve as much as it reflects the observed
data.
Starting with a first degree polynomial equation:
This is a line with slope a. A line will connect any two points, so a first
degree polynomial equation is an exact fit through any two points with distinct
x coordinates.
Mean:
Standard Deviation:
Correlation Coefficient:
Coefficients:
Examples
1.
a.
b.
a.
y
1
2
1.3
3.75
2.25
[
[
] [
][
b.
y is 4.185 when x is 8
2.
a.
b.
10
a.
The 8th term is 22
b.
3.
] [
][
Exercises
1.
2.
3.
Given the
regression.
12
19
29
37
45
-2
-1
Given the following data, find the value of x that will make y equal to
200.
x
32
68
20
86
30
122
50
4.
5.
158
70
194
90
212
100
-1
0.7
0.19
0.96
0.21
1.13
0.23
1.57
0.25
1.92
0.31
(1)
The general expression for any error using the least squares approach is
err = (di)2 = ( y1 f(x1))2 + (y2 f(x2))2 + ( y3 f(x3))2 + (y4 f(x4))2
(2)
where we want to minimize this error. Now substitute the form of our
eq. (1) into the general least squares error eq. (2)
err =
(3)
(y1 (a0 +
))2
(4)
To minimize eq. (4), take the derivative with respect to each coefficient
set each to zero
)]
)]
)]
)]
:
:
[
=
] [ ] [
A=
[
, B=
, X=
]
[ ]
Note: No matter what the order, we always get equations LINEAR with
respect to the coefficients. This means we can use the following solution
method
AX = B
X= A-1*B
Examples
1.
1
0
0
2
0.5
.25
3
1.0
1.0
4
1.5
2.25
5
2.0
4.0
n=6
xi = 7.5
x2i = 13.75
x3i = 28.125
x4i = 61.1875
[
] [ ]=[
yi = 13.75
xi yi = 28.125
x2i yi = 61.1875
][ ]=[
Note: we are using x2i, NOT (xi )2. Theres a big difference
Using the inversion method
[ ]= inv [
]x[
6
2.5
6.25
2.
i
x
y
xi = 15
n=6
x = 2.5
y = 25.433
1
0
2.1
2
1
7.7
3
2
13.6
x4i = 979
yi = 152.6
x2i = 55
x3i = 225
4
3
27.2
5
4
40.9
xi yi = 585.6
x2i yi = 2488.8
][
3.
x= [
y= [
0
2.1
1
7.7
2
13.6
3
27.2
4
40.9
6
80.3
];
];
The result is
]=[
] f(x) =
f(x) =
x+
*x +
*x2
x2
Exercises
1.
1
1.6253
1.5
3.0377
6
5
61.1
2
2.5]
3.3535 7.9409]
2.
I
T (F)
(in/in/F)
1
80
6.47
2
40
6.24
3
-40
5.72
4
-120
5.09
5
-200
4.30
3.
4.
I
Time (s)
Height(ft)
1
0
0
2
0.5
20.5
3
1
31.36
4
1.5
36.25
6
-280
3.33
5
2
30.41
6
2.5
28.23
Healthcare costs have been increasing over the years. The following
data shows the average cost of healthcare per person from 1976 to
1998:
i
1
Year
1976
Cost
618
(per person)
Hint: x0=1970.
2
7980
860
3
1987
1324
4
1993
1865
5
1998
2256
Examples
1.
12
16
2.
25
10
35
15
45
20
25
65
3.
Suppose that you are to find the specific weight (y) for water at
temperature T = 62.5 F. Given the following data:
T(F)
y(
60.0
62.37
62.5
70.0
62.30
Solution:
)
Exercises
1.
2.
Using the linear interpolation formula, find the equation for the given
coordinates (6, 8) and (10, 16).
3.
Find the value of y at x = 0 given some set of values (-2, 5), (1, 7), (3, 11),
(7, 34).
4.
(a)
(b)
Find values of at
T = 210
T = 225
T
200
100
220
140
240
190
5.
Find the values of , and u at
(a) T = 330 K
(b) T = 335 K
Properties of Superheated Steam at P = 0.006 MPa
T (K)
(kg/m3 )
(m3/kg)
u (kJ/kg)
320
0.040708
24.565
2439.7
340
0.038291
26.116
2468.4
360
0.036151
27.662
2497.0
value of
There are no restrictions for the values of y0, y1, and y2. To find out the
to an arbitrary point , use the formula:
Examples
1.
10
15
20
22.5
30
f(x)
227.04
362.78
517.35
602.97
901.67
Solution:
Use the formula
(a)
From the given table, 16 is closest to 10, 15 and 20.
Substitute to (a)
For 10,
For 15,
For 20,
From the obtained formula:
2.
Find
5.15
8.39
10.32
14.1
f(x)
2.75
9.451
16.31
34.78
45.3
Solution:
Use the formula
(a)
From the given table, 3.02 is closest 0, 5.15, and 8.39.
Substitute to (a)
For 0,
For 5.15,
For 8.39
Therefore,
Substitute to (a)
3.
0.5
0.6
0.7
f(x)
0.47943
0.56464
0.64421
Solution:
Use the formula
Substitute 0.5 and 0.6 to (a)
For 0.5,
For 0.6,
(a)
For 0.7,
Therefore,
By calculator
Exercises
1.
2.
Find
4.5
14.87
5.3
16.12
7.65
20.76
0.045
0.581
0.098
0.862
0.15
0.367
0.29
0.738
0.32
0.912
4.
2.9
7
3.
0.564
4.573
-4.17
-15.28
-3.49
-9.72
-1.52
-4.89
-0.98
-1.60
1.23
2.69
2.75
5.43
5.
10
15
20
f(x)
14
26.5
32.8
52
13.46
23.79
32.94
40.12
f(x)
18.90
31.2
49.32
60.31
Since the ratio is independent of xa and xb we can write f(x0, x) = f(x0, x1)
[
[x0, x1]
By this formula, (x) can be approximated at any point x.
Xa
Xb
Xc
; f[xb, xc] =
(x) = [x0] + (x - x0) [x0, x1] + (x - x0) (x - x1) [x0, x1, x2]
The kth degree polynomial approximation to f(x) can be written as
(x) = [x0] + (x - x0) [x0, x1] + (x - x0) (x - x1) [x0, x1, x2]
+ . . . + (x - x0) (x - x1) . . . (x - xk-1) [x0, x1, . . . , xk]
This formula is called Newton's Divided Difference Formula.
Once we have the divided differences of the function relative to the tabular
points then we can use the above formula to compute (x) at any non-tabular
point.
Examples
1.
0
1
3
4
7
1
3
49
129
813
using NDDM.
Solution:
First divided difference
f[0, 1] =
f[1, 3] =
f[3, 4] =
f[4,7] =
Second divided difference
f[0, 1, 3] =
f[1, 3, 4] =
f[3, 4, 7] =
Third divided difference
f[0, 1, 3, 4] =
f[1, 3, 4, 7] =
Fourth divided difference
f[0, 1, 3, 4, 7] =
f(x) = f(0) + (x - 0)( f[0, 1]) + (x - 0)(x - 1) (f[0, 1, 3]) +(x - 0)(x - 1)(x - 3)( f[0, 1, 3, 4])
+ (x - 0)(x - 1)(x - 3)(x - 4)(f[0, 1, 3, 4, 7])
2.
Determine
0
0.5
1
2
1
1.8987
3.7183
11.3891
Solution:
First divided difference
f[0, 0.5] =
f[0.5, 1] =
f[1, 2] =
Second divided difference
f[0, 0.5, 1] =
f[0.5, 1, 2] =
Third divided difference
f[0, 0.5, 1, 2] =
f(x) = f(0) + (x - 0)( f[0, 0.5]) + (x - 0)(x 0.5) (f[0, 0.5, 1]) +(x - 0)(x 0.5)(x - 1)(
f[0, 0.5, 1, 2])
3.
0
1
3
5
7
10
Solution:
First divided difference
f[0, 1] =
f[1, 3] =
f[3, 5] =
f[5, 7] =
f[7, 10] =
Second divided difference
f [0, 1, 3] =
f[1, 3, 5] =
f[3, 5, 7] =
f[5, 7, 10] =
Third divided difference
f[0, 1, 3, 5] =
f[1, 3, 5, 7] =
f[3, 5, 7, 10] =
Fourth divided difference
f[0, 1, 3, 5, 7] =
f[1, 3, 5, 7, 10] =
using NDDM.
0
1.18
10.7
25.8
63.2
159.1
f(x) = f(0) + (x - 0)( f[0, 1]) + (x - 0)(x - 1) (f[0, 1, 3]) +(x - 0)(x - 1)(x - 3)( f[0, 1, 3, 5])
+ (x - 0)(x - 1)(x - 3)(x - 5)(f[0, 1, 3, 5, 7]) + (x - 0)(x - 1)(x - 3)(x - 5)(x - 7)(f[0, 1, 3, 5,
7,10])
Exercises
1.
0
2
4
6
1.5
2.5
7
11
using NDDM.
2.
0
2
4
6
3.
Determine
Determine
Determine
4.5
9
11.75
19.55
5.
1.5
2.5
7
11
0
5
7
10
4.
using NDDM.
4.5
9
11.75
19.55
0.5
2.5
5
7.75
11.5
1.125
2.554
7.215
8.0125
13.450
CHAPTER
5
SOLUTIONS TO
ORDINARY DIFFERENTIAL EQUATIONS
An ordinary differential equation or ODE is an equation containing a
function of one independent variable and its derivatives. The term "ordinary" is
used in contrast with the term partial differential equation which may be with
respect to more than one independent variable.
Linear differential equations, which have solutions that can be added
and multiplied by coefficients, are well-defined and understood, and exact
closed-form solutions are obtained. By contrast, ODEs that lack additive
solutions are nonlinear, and solving them is far more intricate, as one can rarely
represent them by elementary functions in closed form: Instead, exact and
analytic solutions of ODEs are in series or integral form.
Numerical methods for ordinary differential equations are methods
used to find numerical approximations to the solutions of ordinary differential
equations (ODEs). Their use is also known as "numerical integration", although
this term is sometimes taken to mean the computation of integrals.
Many differential equations cannot be solved using symbolic
computation ("analysis"). For practical purposes, however such as in
engineering a numeric approximation to the solution is often sufficient. The
algorithms studied here can be used to compute such an approximation. An
alternative method is to use techniques from calculus to obtain a series
expansion of the solution.
A first-order differential equation is an Initial value problem (IVP) of the
form,
(
)
Examples
1.
0
0.25
0.50
0.75
1.00
1.25
1.50
1.75
2.00
5
14
32
68
140
284
572
1148
2300
x
0.25
0.25
0.25
0.25
0.25
0.25
0.25
0.25
0.25
y
9
18
36
72
144
288
576
1152
-
14
32
68
140
284
572
1148
2300
-
y(2) = 2300
2.
0
0.15
0.30
0.45
0.60
0.75
0.90
1.05
1.20
1
3.1
3.205
3.26275
3.294512
3.311981
3.321589
3.326873
3.329780
x
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
y
2.1
0.105
0.05775
0.031762
0.017469
0.009608
0.005284
0.002907
0.001599
3.1
3.205
3.26275
3.294512
3.311981
3.321589
3.326873
3.329780
3.331379
9
10
1.35
1.50
3.331379
3.332258
0.15
0.15
0.000879
-
3.332258
-
y(1.5) = 3.332258
3.
0
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
3
2.925
2.859375
2.801954
2.751710
2.707747
2.669279
2.635620
2.606168
x
0.05
0.05
0.05
0.05
0.05
0.05
0.05
0.05
0.05
y
-0.075
-0.065625
-0.057421
-0.050244
-0.043963
-0.038468
-0.033659
-0.029452
-
2.925
2.859375
2.801954
2.751710
2.707747
2.669279
2.635620
2.606168
-
y(0.4) = 2.606168
Exercises
1.
2.
3.
4.
5.
Examples
1.
y(0.5)=3.25
= (8 2y)
= 1.5
=0.75
= 1.125
= 0.375
=
= 0.468750
Find y(1) .
n
1
2
0.5
1
3.25
3.71875
0.468750
3.71875
y(1) = 3.718
2.
= (2x
y(o) = 1
h = 0.2
=0
= -0.2
= -0.19208
= .369857
=
= -.038467
= (2x
)
= -0.369818
= -0.512876
= -0.497128
= -0.594583
= -0.099480
= (2x
)
= -0.594508
= -0.644170
= -0.636223
= -0.647932
=
= -0.126774
= (2x
)
= -0.648762
= -0.629215
= -0.632890
= -0.592827
= -0.125526
= (2x
)
= -0.594526
= -0.544738
= -0.554643
= -0.497292
= -0.109686
n
1
2
3
4
0
0.2
0.4
0.6
1
0.961533
0.862053
0.735279
-.038467
-0.099480
-0.126774
-0.125526
0.961533
0.862053
0.735279
0.609573
5
6
0.8
1
0.609573
0.499887
-0.109686
0.499887
y(1) = 0.499
3.
h = 0.1
y =
y(1) = 2.3
y(1.3) = ?
n
1
2
3
4
1
1.1
1.2
1.3
2.3
3.13287
4.761419
9.384592
0.83287
1.628549
4.623173
3.13287
4.761419
9.384592
y(1.3) = 9.384
Exercises
Solve the following using Runge-Kutta Method.
1.
y =
y(0) = 1
h = 0.5 y(3) = ?
2.
y(0.3) = 2
h = 0.05. Find y(0.45).
3.
, y(0) = 2
4.
Find y(0.5) = ?
Find
of
5.
Find
of
if
if
and
and
is .
.