Upload
sergiu-corlat
View
880
Download
2
Embed Size (px)
DESCRIPTION
mixed method for ecuations solving. algorrithm description and implementation in Pascal
Citation preview
MIXED METHOD FOR EQUATIONS SOLVING
SERGIU CORLAT, “ORIZONT” LYCEUM
Algebraic equations
Necessary conditions
Let the equation f (x)=0 is givenTo solve the equation on [a,b] the following conditions are necessary:
1. f(x) – continious on [a,b]2. f(a) f(b) < 03. f ’(x), f ”(x) on [a,b]4. The sign of f ’(x), f ”(x) on [a,b] is constant.
Used methods
Chords Method Finding fixed extreme
point Finding solutions using
chords proprieties and the formula:
1
( )( )
( ) ( )i
i i ii
f xx x e x
f e f x
Newton’s Method
Finding initial approximation
Finding solutions using tangent’s proprieties and the formula:
1
( )
( )i
i ii
f zz z
f z
x0 x1 x2
… … z2 z1
z0
Uuupppsss….
1 11
1i i
M mx x
m
221 1
1
( )2i i i
Mx x x
m
Error approximation in Chord’s Method
Error approximation in Newton’s Method
Error approximation in mixed Method i ix z
Method description
Find first approximation x1, using chords method
Find first approximation z1, using Newton’s method
The exact solution is placed between x1 and z1
Repeat previous steps until | xi – zi | becomes less then given precision , or a given number of times.
Illustration
x0 x1 x2
z0 z1z2
…
Algorithm
1. Finding starting point z0 for Newton’s method: c a - (f(a))/(f(b) - f(a))(b - a); If f(c)f(a)>0 then z0 b; x0 a; else z0 a; x0 b;
2. i 0
3. Calculating
4. Calculating
5. i i + 1
6. If |zi – xi| > Then go to step 3, else – to step 7.
7. The final solution s will be . END.
1
( )
( )i
i ii
f zz z
f z
1 11
( )( );
( ) ( )i
i i i ii i
f xx x z x
f z f x
2i ix z
s
Example:
Let we have the equation
Find the approximate solution of equation on [2; 6] with precision = 0.00001, using mixed method.
2( ) 1 7.f x x x
Solving. 1. Math processing:
1 1 1 1 1 22 2 2 2 2 22 2 2 2 2
2
2 1( ) ( 1) ( 1) ( 1) ( 1) ( 1)
1
xf x x x x x x x x x
x
Solving
2. Program
program cn011;var a,b,c,x,z,e : real; function f(x:real):real;begin f:=x*sqrt(1+x*x) -7 ;end; function fd1(x:real):real;begin fd1:=(2*x*x+1)/ sqrt(1+x*x) ;end;
Variables
f(x) description
f ’ (x) description
Solving
begin a:=2; b:=6; e:=0.0001;c:=a-(f(a))/(f(b)-f(a))*(b-a); if f(c)*f(a)>0 then begin z:=b; x:=a; end else begin z:=a; x:=b; end;while abs(z-x)>e do begin z:=z-f(z)/fd1(z); x:= x-(f(x))/(f(z)-f(x))*(z-x); writeln (’z=’,z:9:5,’ f(z)=’,f(z):9:5, ’ x=’, x:9:5, ’ f(x)=’, f(x):9:5); end; writeln((z+x)/2:9:5);end.
{z},{ x}
initializa
tion
zi,xi calculus
and printing
Results
z= 3.54218 f(z)= 6.03747 x= 2.45514 f(x)= -0.49146z= 2.69058 f(z)= 0.72307 x= 2.55041 f(x)= -0.01326z= 2.55649 f(z)= 0.01787 x= 2.55300 f(x)= -0.00001z= 2.55301 f(z)= 0.00001 x= 2.55300 f(x)= -0.000002.55301