Scott Steffan

advertisement
Scott Steffan
NAE – Hmwk#10
12/2/99
10.2.3b
Algorithm 10.1, Newton’s Method was used in Maple V to approximate solutions for x1
and x2 for the following nonlinear systems of equations within a 10-6 tolerance:
y1 := ln( x 1 2x 2 2 )sin( x 1 x 2 )ln2ln(  )0
y2 := e
( x 1x 2 )
cos( x 1 x 2 )0
Using an initial approximation of x(0)=(2,2)t the following was generated:
> alg101();
This is the Newton Method for Nonlinear Systems.
Input the number n of equations.
>2
> ln(x1^2+x2^2)-sin(x1*x2)-1.83787706641
> exp(x1-x2)+cos(x1*x2)
Input the Tolerance.
> .000001
Input the maximum number of iterations.
> 5000
Input initial approximation X(1).
>2
Input initial approximation X(2).
>2
Select output destination
1. Screen
2. Text file
Enter 1 or 2
>1
Select amount of output
1. Answer only
2. All intermediate approximations
Enter 1 or 2
>2
NEWTONS METHOD FOR NONLINEAR SYSTEMS
Iteration, Approximation,
Error
1
1.96868256
1.47890554
5.210945e-01
2
1.83008004
1.70902384
2.301183e-01
3
1.77555747
1.76841171
5.938786e-02
4
1.77246547
1.77243860
4.026893e-03
5
1.77245385
1.77245385
1.525135e-05
6
1.77245385
1.77245385
9.279643e-10
Iteration 6 gives solution:
x(6) = (1.77245385, 1.77245385)t
to within tolerance 1.0000000000e-06
After 6 iterations an approximation was within the specified accuracy.
10.3.2d
Algorithm 10.2, Broyden’s Method was used in Maple V to approximate solutions to the
nonlinear system shown below:
y1 := x 1 2x 2370
y2 := x 1x 2 250
y3 := x 1x 2x 330
The tolerance was set to 10-6 and an initial approximation of x(0)=(0,0,0)t was used to
generate the following:
> alg102();
This is the Broyden’s Method for Nonlinear Systems.
Input the number n of equations.
>3
> x1^2+x2-37
> x1-x2^2-5
> x1+x2+x3-3
Input tolerance
> 1e-6
Input the maximum number of iterations.
> 50
Input initial approximation X(1).
>0
Input initial approximation X(2).
>0
Input initial approximation X(3).
>0
Select output destination
1. Screen
2. Text file
Enter 1 or 2
>1
Select amount of output
1. Answer only
2. All intermediate approximations
Enter 1 or 2
>2
BROYDENS METHOD FOR NONLINEAR SYSTEMS
Iteration, Approximation,
1
5.00000000
37.00000000
-39.00000000
Error
5.399074e+01
.
.
.
Iteration number 38 gives solution:
x(38) = (6.00000000, 1.00000000, -4.00000000)t
to within tolerance 1.0000000000e-06
Process is complete!
After 38 iterations an approximation was within the specified accuracy.
10.4.4a
First, Algorithm 10.3, Steepest Descent was used to approximate solutions to the
following nonlinear system to within 0.05:
y1 := 15 x 1x 2 24 x 3130
y2 := x 1 210 x 2x 3110
y3 := x 2 325 x 3220
> alg103();
This is the Steepest Descent Method.
Input the number n of equations.
>3
Input the function CF[1](x1..x3).
> 15*x1+x2^2-4*x3-13
Input the function CF[2](x1..x3).
> x1^2+10*x2-x3-11
Input the function CF[3](x1..x3).
> x2^3-25*x3+22
Input tolerance
> .05
Input the maximum number of iterations.
> 1000
Input initial approximation X(1).
>0
Input initial approximation X(2).
>0
Input initial approximation X(3).
>0
Select output destination
1. Screen
2. Text file
Enter 1 or 2
>1
Select amount of output
1. Answer only
2. All intermeditate approximations
Enter 1 or 2
>2
STEEPEST DESCENT METHOD FOR NONLINEAR SYSTEMS
Iteration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
x1 approx
0.37709364
0.90159301
0.97977895
1.07563551
1.07603378
1.08541361
1.07236358
1.06980465
1.05955498
1.05702699
1.05049058
1.04888334
1.04488353
1.04393019
x2 approx
0.21271949
0.52037871
0.63117484
0.77475890
0.83410607
0.90767442
0.94041279
0.98077975
0.99960552
1.02296042
1.03412198
1.04794590
1.05467095
1.06292997
x3 approx
0.94176718
0.66238526
0.92257308
0.83161434
0.92559349
0.87925675
0.92827633
0.90072783
0.92925890
0.91288694
0.92986064
0.92014291
0.93033102
0.92450593
Iteration number 14 gives solution:
x(14) = (1.04393019 1.06292997 .92450593)t
to within 5.0000000000e-02
Once this was done, the results were used as initial approximations for a Newton’s
Method approximation of the same nonlinear system of equations with a tighter tolerance
of 10-6:
> alg101();
This is the Newton Method for Nonlinear Systems.
Input the number n of equations.
>3
> 15*x1+x2^2-4*x3-13
> x1^2+10*x2-x3-11
> x2^3-25*x3+22
Input the Tolerance.
> 1e-6
Input the maximum number of iterations.
> 1000
Input initial approximation X(1).
> 1.04393019
Input initial approximation X(2).
> 1.06292997
Input initial approximation X(3).
> .92450593
Select output destination
1. Screen
2. Text file
Enter 1 or 2
>1
Select amount of output
1. Answer only
2. All intermediate approximations
Enter 1 or 2
>2
NEWTONS METHOD FOR NONLINEAR SYSTEMS
Iteration, Approximation,
1
1.03641778
1.08570188
. 93112417
2
1.03640047
1.08570655
. 93119144
3
1.03640047
1.08570655
. 93119144
Error
2.277191e-02
6.727593e-05
4.026260e-10
Iteration number 3 gives solution:
x(3) = (1.03640047 1.08570655 .93119144)t
to within tolerance 1.0000000000e-06
Using this technique allows Newton’s Method to predict very good approximations in
much fewer iterations than choosing arbitrary initial approximations.
Download