Consider the following system of equations: 100x−200y=100 −200x+401y=100 Determine, whether given system is ill-conditioned or not... The process of finding the equation of the curve of
Trang 1386 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
2
2 Solve the following system of equations using Gauss-Elimination method:
(a) x y z− + =1 (b) x+3y+6z=2
3x 2y 3z 6
2x−5y+4z=5 [Ans −2, 3, 6] 3x y− +4z=9 [Ans 2, –1, 1
2]
(c) 5x y z u+ + + =4
z+ y+ + =z u
x y+ + z u+ = −
x y z u+ + + = −6 [Ans 1, 2, –1, –2] 3
3 What do you understand by ill-conditioned equations? Consider the following system of equations:
100x−200y=100 −200x+401y=100 Determine, whether given system is ill-conditioned or not
4
4 Solve the following system of equations by Jacobi’s iterations method:
(a) 2x y+ −2z=17 (b) 5x+2y z+ =12
3x+20y z− = −18 x+4y+2z=15
2x−3y+20z=25 [Ans 1, –1, 1] x+2y+5z=20 [Ans 1.08, 1.95, 3.16] 5
5 Using Gauss-Seidel method, solve the following system of equations:
(a) 10x y z+ + =12 (b) 2x y z− + =5
2x+10y z+ =13 2 3+ y−2z=7
2x+2y+10z=14 [Ans 1, 1, 1] x+2y+3z=10 [Ans 3, 2, 1]
(c) 20x y+ − = −2z 17
3x+20y z− = −18
GGG
Trang 2CHAPTER 9 Curve Fitting
In many branches of applied mathematics and engineering sciences we come across experiments
and problems, which involve two variables For example, it is known that the speed v of a ship
varies with the horsepower p of an engine according to the formula p = a + bv3 Here a and b are
the constants to be determined For this purpose we take several sets of readings of speeds and the corresponding horsepowers The problem is to find the best values for a and b using the observed
values of v and p Thus the general problem is to find a suitable relation or law that may exist between the variables x and y from a given set of observed values (x i , y i ), i = 1, 2, , n Such
a relation connecting x and y is known as empirical law.
The process of finding the equation of the curve of best fit, which may be most suitable for predicting the unknown values, is known as curve fitting Therefore, curve fitting means an exact relationship between two variables by algebraic equations There are following methods for fitting
a curve:
I Graphic method
II Method of group averages
III Method of moments
IV Principle of least square
Out of above four methods, we will only discuss and study here principle of least square
The method of least square is probably the most systematic procedure to fit a unique curve through the given data points
Y
P (x ,y )1 1 1
P (x ,y )i i i
P (x ,y )n n n
L2
e1
L1 e2
P2
Li
Ln
M1 M2 Mi Mn X O
FIG 9.1
387
Trang 3388 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES Let the curve
y= + +a bx cx2+ kx m−1 (1)
be fitted to the set of n data points (x y1, 1) (, x y2, 2) (, x y3, 3), , (x y n, n). At (x = x i) the observed (or experimental) value of the ordinate is y i=p m i i and the corresponding value on the fitting curve
( )i is a bx+ i+cx i2+ kx m i =L M i i which is the expected or calculated value The difference of the observed and the expected value is P i M i− L i M i = e i (say) this difference is called error at (x = x i) clearly some of the error e e e1, 2, 3, , e i ,e n will be positive and other negative To make all errors positive we square each of the errors i.e., = 2+ + + + + +2 2 2 2
1 2 3 i n
S e e e e e the curve of best fit
is that for which e s′ are as small as possible i.e S, the sum of the square of the errors is a minimum
this is known as the principle of least square
9.2.1 Fitting of Straight Line
Which is fitted to the given date points (x y1, 1) (, x y2, 2) (, x y3, 3), ,(x y n, n)
Let yλ be the theoretical value for x1 then e1=y1−yλ
⇒ e1=y1− +(a bx1)
e = y − −a bx
Now we have 2 2 2 2
1 2 3 n
S e= + + +e e +e
1
1
n i i
=
1
n
i
=
By the principle of least squares, the value of S is minimum therefore
∂ =S a 0
b
∂ =
On solving equations ( )2 and ( )3 , and dropping the suffix, we have
2
xy=a x b+ x
The equation ( )3 and ( )4 are known as normal equations
On solving equations ( )3 and ( )4 , we get the value of a and b Putting the value of a and
b in equation ( )1 , we get the equation of the line of best fit
9.2.2 Fitting of Parabola
which is fitted to a given date (x y1, 1), (x y2, 2), (x y3, 3), ,(x y n, n)
Let yλ be the theoretical value for x1 then e1=y1−yλ
Trang 4⇒ = − +( + 2)
e = y − −a bx −cx
Now we have 2
1
n i i
=
( 2)2
1
n
i i
=
By the principle of least squares, the value of S is minimum therefore,
S 0
a
∂ =
S b
∂ =
S c
∂ =
Solving equation (2) and dropping suffix, we have
∑y=na b+ ∑ ∑x c+ x2 (3) ∑xy=a∑ ∑x b+ x2+c∑x3 (4)
x y=a x +b x +c x
The equation, (3), (4) and (5) are known as normal equations
On solving equations (3), (4) and (5), we get the value of a, b and c Putting the value of a,
b and c in equation (1), we get the equation of the parabola of best fit.
9.2.3 Change of Scale
When the magnitude of the variable in the given data is large number then calculation becomes very much tedious then problem is further simplified by taking suitable scale when the value of
x are given at equally spaced intervals
Let h be the width of the interval at which the values of x are given and let the origin of
x and y be taken at the point x y0, 0 respectively, then putting
(x x0)
u h
−
If m is odd then, ( )
( )
middle term interval
x u
h
−
=
But if m is even then, u = x – mean of two middle term
1
2 interval
Example 1 Find the best-fit values of a and b so that y= +a bx fits the data given in the table.
Trang 5390 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
2
2
Normal equations are: ∑y=na b+ ∑x (2)
2
xy=a x b+ x
Here n=5, ∑x=10, ∑y=16.9, ∑xy=47.1 ∑x2=30
Putting these values in normal equations we get,
16.9=5a+10b
47.1 10= a+30b
On solving these two equations we get, a=0.72, b=1.33
So required line y=0.72 1.33+ x Ans
Example 2 Fit a straight line to the given data regarding x as the independent variable.
Sol Let the straight line obtained from the given data by y= +a bx (1) Then the normal equations are ∑y=na b+ ∑x (2)
xy
2
2
Trang 6Putting all values in the equations ( )2 and (3), we get
3060= a+ b
6450=21a+91b
Solving these equations, we get
a=1361.97 and b= −243.42
hence the fitted equation is
y = 1361.97 – 243.42x. Ans
Example 3 Find the least square polynomial approximation of degree two to the data.
also compute the least error.
Sol Let the equation of the polynomial be y= + +a bx cx2 (1)
−
The normal equations are :
∑y=na b+ ∑ ∑x+c x2 (2) ∑xy=a∑ ∑x b+ x2+c∑x3 (3) ∑x y2 =a∑x2+b∑x3+c∑x4 (4) Here n=5, ∑x=10, ∑y=30, ∑xy=120, ∑x2 =30, ∑x y2 =434, ∑x3=100,
4 354
x =
∑
Putting all these values in ( )2 , ( )3 and ( )4 , we get
30=5a+10b+30c (5)
120 10= a+30b+100c (6)
On solving these equations, we get a= −4, b = 2, c=1. Therefore required polynomial is
2
4 2
y= − + x x+ , errors = 0 Ans
Trang 7392 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
Example 4 Fit a second-degree parabola to the following data taking x as the indenpendent variable.
Sol The equation of second-degree parabola is given by y= + +a bx cx2 and the normal equations are :
∑y=na b+ ∑ ∑x c+ x2
xy=a x b+ x +c x
x y=a x +b x +c x
Here n=9 The various sums are appearing in the table as follows:
Putting these values of ∑x, ∑y, ∑x2, ∑xy, ∑x y2 , ∑x3, and ∑x4, in equation
( )1 and solving the equations for a b, and c; we get
a= −0.923; b=3.520; c= −0.267
Hence the fitted equation is
y= −0.923 3.53+ x−0.267x2 Ans
Example 5 Show that the line of fit to the following data is given by y=0.7x+11.28.
Sol Here m=6(even)
Let x0=12.5, h=5, y0 =20 (say)
Trang 8Then, 12.5
2.5
x
u= −
and v= −y 20, we get
0
u=
∑ ∑v=0 ∑uv=122 ∑u2=70
The normal equations are :
0=6a+ ×0 b ⇒ =a 0
122= × +0 a 70b⇒ =b 1.743
Thus line of fit is v=1.743 u
or ( ) 12.50
20 1.743 7 8.175
2.5
x
or y=0.7x+11.285 Ans
Example 6 Fit a second-degree parabola to the following data by least square method.
Sol Taking x0=1933, y0=357 then (x x0)
u h
−
=
Total ∑u=0 ∑v=11 ∑uv=51 ∑u2 =60 ∑u v2 =–9 ∑u3 =0 ∑u4 =708 Here h=1
Taking u= −x x0 and v= −y y0, therefore u= −x 1933 and v= −y 357
Then the equation y= + +a bx cx2 is transformed to v= +A Bu Cu+ 2 (1)
Trang 9394 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES Normal equations are:
∑v=9A B+ ∑ ∑u C+ u2 ⇒ 11 9= A+60C
uv=A u B+ u +C u
∑ ∑ ∑ ∑ ⇒ B=17/20
∑ ∑ ∑ ∑ ⇒ − =9 60A+708C
On solving these equations, we get 694,
231
20
B= and 247
924
C= −
∴ 694 17 247 2
231 20 924
1933
⇒ y= −3 1643.05 998823.36 357 0.85− + + x+1033.44x−0.267x2
⇒ y= −1000106.41 1034.29+ x−0.267x2 Ans
Example 7 Fit second degree parabola to the following
Sol Here m=5 (odd) therefore x0 =2
Now let u= −x 2, v=y and the curve of fit be v= +a bu cu+ 2
Hence the normal equations are:
∑v=5a b+ ∑ ∑u c+ u2
∑uv=a∑ ∑u b+ u2+c∑u3
u v=a u +b u +c u
Trang 10On putting the values of ∑u, ∑v etc from the table in these, we get
12.9=5a+10 ,c 11.3 10 ,= b 33.5 10= a+34 c
On solving these equations, we get
a=1.48, b=1.13 and c=0.55
Therefore the required equation is v=1.48 1.13+ u+0.55u2
Again substituting u= −x 2 and v=y, we get
y=1.48 1.13(+ x− +2) 0.55(x−2)2
or y=1.42 1.07− x+0.55x2 Ans
9.2.4 Fitting of an Exponential Curve
Suppose an exponential curve of the form
y=ae bx
Taking logarithm on both the sides, we get
log10y=log10a bx+ log10e
where Y=log10 y A, log= 10a and B b= log10e
The normal equations for ( )1 are,
∑Y=nA B+ ∑x
∑xY=A∑ ∑x B+ x2
On solving above two equations, we get A and B.
then a=antilogA,
10 log
B b
e
=
9.2.5 Fitting of the Curve y = ax + bx2
Error of estimate for i th point (x y i, i) is
e = y −ax −bx
We have, 2
1
n i i
=
( 2)2
1
n
i
=
By the principle of least square, the value of S is minimum
a
∂ =
S b
∂ =
∂