Vous êtes sur la page 1sur 21

2019

Tarea #1 Métodos
Numéricos
VALENTINA MARULANDA GÓMEZ
Bisección: La suma de dos números es 20. Si cada uno se agrega a su raíz cuadrada, el
producto de las dos sumas es 155,55. Determine los dos números con una exactitud de
10−4.
𝑥 + 𝑦 = 20
(𝑥 + √𝑥)(𝑦 + √𝑦) = 155.55
𝑦 = 20 − 𝑥
(𝑥 + √𝑥)(20 − 𝑥 + √20 − 𝑥) − 155.55 = 0

This is the Bisection Method.


Input the function F(x) in terms of x
For example: cos(x)
(x+x^(1/2))*(20-x+ (20-x)^(1/2))-155.55
Input endpoints A < B on separate lines
0
10
Input tolerance
10^-4
Input maximum number of iterations - no decimal point
30
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
Bisection Method
I P F(P)
1 5.00000000e+00 -1.8983810e+01
2 7.50000000e+00 8.6316225e+00
3 6.25000000e+00 -2.7916316e+00
4 6.87500000e+00 3.5046467e+00
5 6.56250000e+00 5.0384069e-01
6 6.40625000e+00 -1.1068959e+00
7 6.48437500e+00 -2.9229948e-01
8 6.52343750e+00 1.0807501e-01
9 6.50390625e+00 -9.1535809e-02
10 6.51367188e+00 8.4136649e-03
11 6.50878906e+00 -4.1525051e-02
12 6.51123047e+00 -1.6546688e-02
13 6.51245117e+00 -4.0642605e-03
14 6.51306152e+00 2.1752649e-03
15 6.51275635e+00 -9.4435710e-04
16 6.51290894e+00 6.1548909e-04
17 6.51283264e+00 -1.6442521e-04

Approximate solution P = 6.51283264


with F(P) = -0.00016443
Number of iterations = 17 Tolerance = 1.00000000e-04

This is the Bisection Method.


Input the function F(x) in terms of x
For example: cos(x)
(x+x^(1/2))*(20-x+(20-x)^(1/2))-155.55
Input endpoints A < B on separate lines
10
14
Input tolerance
10^-4
Input maximum number of iterations - no decimal point
20
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
Bisection Method
I P F(P)
1 1.20000000e+01 1.1901897e+01
2 1.30000000e+01 4.6230180e+00
3 1.35000000e+01 -1.3159629e-01
4 1.32500000e+01 2.3395208e+00
5 1.33750000e+01 1.1274923e+00
6 1.34375000e+01 5.0384069e-01
7 1.34687500e+01 1.8759668e-01
8 1.34843750e+01 2.8368981e-02
9 1.34921875e+01 -5.1521439e-02
10 1.34882813e+01 -1.1553177e-02
11 1.34863281e+01 8.4136649e-03
12 1.34873047e+01 -1.5683153e-03
13 1.34868164e+01 3.4230350e-03
14 1.34870605e+01 9.2744989e-04
15 1.34871826e+01 -3.2041019e-04
16 1.34871216e+01 3.0352548e-04

Approximate solution P = 13.48712158


with F(P) = 0.00030353
Number of iterations = 16 Tolerance = 1.00000000e-04
RESPUESTA: Los dos números son 𝑥 =6.51283264, 𝑦 =13.48712158
Punto fijo: Un objeto que cae verticalmente en el aire está sujeto a una resistencia viscosa
y también a la fuerza de gravedad. Suponga que dejamos caer un objeto de masa m desde
una altura s0 y que la altura del objeto después de t segundos es

Donde g = 32,17 pies/s2 y k representa el coeficiente de resistencia del aire en lbs/pies.


Suponga que s0 = 300 pies, m = 0,25 lbs y que k = 0,1 lb-s/pies. Calcule con una exactitud
de 0,01 s, el tiempo que tarda este peso de cuarto de libra en caer al suelo.
2
3217 3217
𝑠(𝑡) = 300 − 𝑡+ (1 − 𝑒 −5𝑡 )
40 16

2
300 − 80.425𝑡 + 201.0625 (1 − 𝑒 −5𝑡 ) = 0

2
300 + 201.0625 (1 − 𝑒 −5𝑡 )
𝑔(𝑡) =
80.425

This is the Fixed-Point Method.


Input the function G(x) in terms of x
For example: cos(x)
(300+201.0625*(1-exp(-0.4*x)))/80.425
Input initial approximation
1
Input tolerance
0.01
Input maximum number of iterations - no decimal point
150
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
FIXED-POINT METHOD
I P
1 4.55438329e+00
2 5.82582861e+00
3 5.98702464e+00
4 6.00220836e+00
5 6.00358877e+00

Approximate solution P = 6.00358877


Number of iterations = 5 Tolerance = 1.00000000e-02

RESPUESTA: el tiempo que tarda en caer al suelo es de 6.00358877

Newton y Extensiones: Una partícula parte del reposo sobre un plano inclinado
uniforme, cuyo ángulo θ cambia con una tasa constante de

Al final de t segundos, la posición del objeto está dada por

Suponga que la partícula se desplaza 1,7 pies en 1 s. Encuentre, con una exactitud
de 10−5, la tasa ω a la que θ cambia. Suponga que g = 32,17 pies/s2.

16.085 𝑒 𝜔 − 𝑒 −𝜔
1.7 = − ( − 𝑠𝑖𝑛𝜔)
𝜔2 2
16.085 𝑒 𝜔 − 𝑒 −𝜔
− ( − 𝑠𝑖𝑛𝜔) − 1.7 = 0
𝜔2 2
This is the Secant Method
Input the function F(x) in terms of x
For example: cos(x)
(-16.085/x^2)*(((exp(x)-exp(-x))/2)-sin(x))-1.7
Input initial approximations P0 and P1 on separate lines.
-1
1
Input tolerance
10^-5
Input maximum number of iterations - no decimal point
100
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
Secant Method
I P F(P)
2 -3.16688531e-01 -2.00132590e-03
3 -3.17061459e-01 -1.69383771e-06
4 -3.17061775e-01 2.42250664e-13

Approximate solution P = -0.31706177


with F(P) = 0.00000000
Number of iterations = 4
Tolerance = 1.00000000e-05

RESPUESTA: La tasa a la que cambia es -0.31706177.


Müller: Dos escaleras se cruzan en un pasillo de ancho W. Cada una llega de la base de
un muro a un punto en el muro de enfrente. Las escaleras se cruzan a una altura H arriba
del pavimento. Dado que las longitudes de las escaleras son x1 = 20 pies y x2 = 30 pies
y que H = 8 pies, calcule W.
This is Mullers Method.

Input the Polynomial P(x)

For example: to input x^3-2*x+4 enter

[ 1 0 -2 4 ]

[1 -16 -500 8000 -32000]

Input tolerance
0.0001

Input maximum number of iterations - no decimal point

50

Input the first of three starting values

16

Input the second of three starting values

18

Input the third starting value

20

Select output destination

1. Screen

2. Text file

Enter 1 or 2

MULLERS METHOD

The output is i, approximation x(i), f(x(i))

The real and imaginary parts of x(i) are

followed by real and imaginary parts of f(x(i)).

3 27.993386 0.000000 63224.534703 0.000000

4 24.740018 0.000000 -7767.637704 0.000000

5 25.208302 0.000000 -556.607682 0.000000

6 25.241921 0.000000 -4.047697 0.000000


7 25.242167 0.000000 0.000352 0.000000

8 25.242167 0.000000 0.000000 0.000000

Method Succeeds

Approximation is within 1.0000000000e-04

in 8 iterations

RESPUESTA: W es igual a 16,21289905


3
Neville: Use la función f(x) = e x para aproximar a √𝑒 usando los puntos 0,1, 0.2, 0.3, 0.4,
6
0.5, 0.6, 0.7 y 0.8. Aproxime el mismo número usando la función √𝑥, escoja los nodos
apropiados para la aproximación y n = 6.

This is Nevilles Method.


Choice of input method:
1. Input entry by entry from keyboard
2. Input data from a text file
3. Generate data using a function F
Choose 1, 2, or 3 please
3
Input the function F(x) in terms of x
For example: cos(x)
exp(x)
Input n
7
Input X(0)
0.1
Input X(1)
0.2
Input X(2)
0.3
Input X(3)
0.4
Input X(4)
0.5
Input X(5)
0.6
Input X(6)
0.7
Input X(7)
0.8
Input point at which the polynomial is to be evaluated
1/3
Select output destination
1. Screen
2. Text file
Enter 1 or 2
1
NEVILLES METHOD
Table for P evaluated at X = 0.33333333 , follows:
Entries are XX(I), Q(I,0), ..., Q(I,I) for each I = 0, ..., N where N = 7

0.10000000 1.10517092
0.20000000 1.22140276 1.37637854
0.30000000 1.34985881 1.39267749 1.39539398
0.40000000 1.49182470 1.39718077 1.39567968 1.39561619
0.50000000 1.64872127 1.38722698 1.39552181 1.39560951 1.39561229
0.60000000 1.82211880 1.35972539 1.39639418 1.39561874 1.39561259 1.39561243
0.70000000 2.01375271 1.31109505 1.40025067 1.39553718 1.39561194 1.39561241
1.39561242
0.80000000 2.22554093 1.23719590 1.40962725 1.39504146 1.39561980 1.39561246
1.39561243 1.39561243

This is Nevilles Method.


Choice of input method:
1. Input entry by entry from keyboard
2. Input data from a text file
3. Generate data using a function F
Choose 1, 2, or 3 please
3
Input the function F(x) in terms of x
For example: cos(x)
x^(1/6)
Input n
6
Input X(0)
6.9
Input X(1)
7.0
Input X(2)
7.1
Input X(3)
7.2
Input X(4)
7.3
Input X(5)
7.4
Input X(6)
7.5
Input point at which the polynomial is to be evaluated
exp(2)
Select output destination
1. Screen
2. Text file
Enter 1 or 2
1
NEVILLES METHOD
Table for P evaluated at X = 7.38905610 , follows:
Entries are XX(I), Q(I,0), ..., Q(I,I) for each I = 0, ..., N where N = 6

6.90000000 1.37977471
7.00000000 1.38308755 1.39597636
7.10000000 1.38636119 1.39582382 1.39560337
7.20000000 1.38959662 1.39571341 1.39560903 1.39561259
7.30000000 1.39279482 1.39564301 1.39561167 1.39561245 1.39561242
7.40000000 1.39595672 1.39561068 1.39561245 1.39561242 1.39561243 1.39561243
7.50000000 1.39908321 1.39561456 1.39561241 1.39561243 1.39561243 1.39561243
1.39561243
3
RESPUESTA: La aproximación de √𝑒 es 1.39561243

Diferencias divididas: La tabla siguiente contiene la población de Estados Unidos en ciertos


años desde 1930 a 1980.

Año 1930 1940 1950 1960 1970 1980


Población 157326 179323 207892 226500 249003 281522
Utilice diferencias divididas para aproximar la población en los años 1945, 1965 y 1985.
Newtons form of the interpolation polynomial
Choice of input method:
1. Input entry by entry from keyboard
2. Input data from a text file
3. Generate data using a function F
Choose 1, 2, or 3 please
1
Input n
5
Input X(0) and F(X(0)) on separate lines
1930
157326
Input X(1) and F(X(1)) on separate lines
1940
179323
Input X(2) and F(X(2)) on separate lines
1950
207892
Input X(3) and F(X(3)) on separate lines
1960
226500
Input X(4) and F(X(4)) on separate lines
1970
249003
Input X(5) and F(X(5)) on separate lines
1980
281522
Select output destination
1. Screen
2. Text file
Enter 1 or 2
1
NEWTONS INTERPOLATION POLYNOMIAL
Input data follows:
X(0) = 1930.00000000 F(X(0)) = 157326.00000000
X(1) = 1940.00000000 F(X(1)) = 179323.00000000
X(2) = 1950.00000000 F(X(2)) = 207892.00000000
X(3) = 1960.00000000 F(X(3)) = 226500.00000000
X(4) = 1970.00000000 F(X(4)) = 249003.00000000
X(5) = 1980.00000000 F(X(5)) = 281522.00000000
The coefficients Q(0,0), ..., Q(N,N) are:
157326.00000000
2199.70000000
32.86000000
-2.75550000
0.12662083
-0.00317700
Numero de datos =6
x= [1930 1940 1950 1960 1970 1980]
y= [157326 179323 207892 226500 249003 281522]
ans = -0.003177 t^5 + 31.1024 t^4 - 121791.7021 t^3 + 238451382.9079 t^2 -
233421003021.1718 t + 91396157877683.03
Hermite: Un automovil viaja por una carretera recta y su recorrido se cronometra en varios
puntos, los datos se incluyen en la tabla, donde el tiempo se indica en segundos y la
distancia en millas.
Tiempo (s) 0 3 5 8 13
Distancia (mi) 0 225 383 623 993
Velocidad (mi/s) 75 77 80 74 72
Use el polinomio de Hermite para predecir la posición del automovil en el instante t = 10
segundos.
This is Hermite interpolation.
Choice of input method:
1. Input entry by entry from keyboard
2. Input data from a text file
3. Generate data using a function F
Choose 1, 2, or 3 please
1
Input the number of data points minus 1
4
Input X(0), F(X(0)), and F'(X(0)) on separate lines
0
0
75
Input X(1), F(X(1)), and F'(X(1)) on separate lines
3
225
77
Input X(2), F(X(2)), and F'(X(2)) on separate lines
5
383
80
Input X(3), F(X(3)), and F'(X(3)) on separate lines
8
623
74
Input X(4), F(X(4)), and F'(X(4)) on separate lines
13
993
72
Choice of output method:
1. Output to screen
2. Output to text file
Please enter 1 or 2
1
HERMITE INTERPOLATING POLYNOMIAL
The input data follows:
X, F(X), F'(x)
0.0000000000e+00 0.0000000000e+00 7.5000000000e+01
3.0000000000e+00 2.2500000000e+02 7.7000000000e+01
5.0000000000e+00 3.8300000000e+02 8.0000000000e+01
8.0000000000e+00 6.2300000000e+02 7.4000000000e+01
1.3000000000e+01 9.9300000000e+02 7.2000000000e+01

The Coefficients of the Hermite Interpolation Polynomial


in order of increasing exponent follow:

0.0000000000e+00
7.5000000000e+01
0.0000000000e+00
2.2222222222e-01
-3.1111111111e-02
-6.4444444444e-03
2.2638888889e-03
-9.1319444444e-04
1.3052679158e-04
-2.0223631973e-05
Do you wish to evaluate this polynomial?
Enter Y or N
Y
Enter a point at which to evaluate
10
x-value and interpolated-value
1.0000000000e+01 7.4250283910e+02
RESPUESTA: La posición es 7.4250283910e+02 a los 10s
Spline cubico sujeto: Mediante interpolantes de Spline cubico sujeto, aproxime la parte
superior del perro que se muestra en la figura,
This is Clamped Cubic Spline Interpolation.
Choice of input method:
1. Input entry by entry from keyboard
2. Input data from a text file
3. Generate data using a function F with nodes entered from keyboard
4. Generate data using a function F with nodes from a text file
Choose 1, 2, 3, or 4 please
1
Input n
17
Input X(0) and F(X(0)) on separate lines
1
3
Input X(1) and F(X(1)) on separate lines
2
3.7
Input X(2) and F(X(2)) on separate lines
5
3.9
Input X(3) and F(X(3)) on separate lines
6
4.2
Input X(4) and F(X(4)) on separate lines
7
5.7
Input X(5) and F(X(5)) on separate lines
8
6.6
Input X(6) and F(X(6)) on separate lines
10
7.1
Input X(7) and F(X(7)) on separate lines
13
6.7
Input X(8) and F(X(8)) on separate lines
17
4.5
Input X(9) and F(X(9)) on separate lines
20
7
Input X(10) and F(X(10)) on separate lines
23
6.1
Input X(11) and F(X(11)) on separate lines
24
5.6
Input X(12) and F(X(12)) on separate lines
25
5.8
Input X(13) and F(X(13)) on separate lines
27
5.2
Input X(14) and F(X(14)) on separate lines
27.7
4.1
Input X(15) and F(X(15)) on separate lines
28
4.3
Input X(16) and F(X(16)) on separate lines
29
4.1
Input X(17) and F(X(17)) on separate lines
30
3
Enter F'(X(0)) and F'(X(N)) on separate lines
1
-1.5
Select output destination
1. Screen
2. Text file
Enter 1 or 2
1
CLAMPED CUBIC SPLINE INTERPOLATION

The numbers X(0), ..., X(N) are:


1.00000000 2.00000000 5.00000000 6.00000000 7.00000000 8.00000000
10.00000000 13.00000000 17.00000000 20.00000000 23.00000000 24.00000000
25.00000000 27.00000000 27.70000000 28.00000000 29.00000000 30.00000000

The coefficients of the spline on the subintervals are:


for I = 0, ..., N-1
A(I) B(I) C(I) D(I)
3.00000000 1.00000000 -0.34677828 0.04677828
3.70000000 0.44677828 -0.20644344 0.02657986
3.90000000 -0.07422623 0.03277527 0.34145095
4.20000000 1.01567718 1.05712814 -0.57280532
5.70000000 1.41151749 -0.66128783 0.14977033
6.60000000 0.53825284 -0.21197683 0.03392520
7.10000000 0.09744797 -0.00842561 -0.02283383
6.70000000 -0.56961913 -0.21393010 0.05470872
4.50000000 0.34495865 0.44257454 -0.09326099
7.00000000 0.48235907 -0.39677441 0.04532935
6.10000000 -0.67439492 0.01118974 0.16320517
5.60000000 -0.16239991 0.50080526 -0.13840535
5.80000000 0.42399456 0.08558920 -0.22379324
5.20000000 -1.91916752 -1.25717024 2.50562882
4.10000000 0.00406850 4.00465027 -5.98663237
4.30000000 0.79046792 -1.38331886 0.39285094
4.10000000 -0.79761698 -0.20476604 -0.09761698

Vous aimerez peut-être aussi