Está en la página 1de 8

UNIVERSIDAD DE ORIENTE

NUCLEO ANZOÀTEGUI

ESCUELA DE INGENERIA ELÈCTRICA

MÉTODOS NUMÉRICOS

SECCIÓN: 01

Evolución 3

Profesor: Bachilleres:

Ángel Villarroel Luis Triana CI 26953060

José Verjel CI 27157603

Puerto la cruz, mayo, 2019


1) La curva del gráfico representa una cerca que, con los ejes coordenados
delimita un terreno irregular. Utilice el algoritmo más adecuado que calcule
el área del terreno lo más exacto posible.
x 0 1 2 3 4 5 6 7 8
f(x) 2 2.9 1.8 2.4 2.6 1.3 1.2 2.1 0.9

Entrada de datos

a=0

b=8

g(x)=f(x)

n=8

Definición de variables

x , xo, a , b , suma , h : real; n , i, m :integer

Asignación de valores

g(x) ←f(x)

xo ←a

x8 ←b

𝑏−𝑎
ℎ←
𝑛
[Inicio de la ejecución el programa]

Procedure Simpson 1/3

Xo=a
Sum=0
h=8/8=1

for i = 1 to 4 do

x1=xo-h+2h= 0+1=1

Sum=sum + 4(gx1) =0+4(2.9) =11.6

If I ≠4 then

Sum= sum +2g(x1+h) = 11.6+2g(2.9+1)=15.2


x2= xo- h 2(2)h= 0 + 3(1) = 3

Sum= sum + 4g(x2) = 15.2+4g(3)= 24.8

If I ≠4 then

Sum = sum +2g(x2+h) = 24.8 +2g(3+1) =30

X3=xo-h+2(3)h= 0+ 4(1)=5

Sum= sum + 4g(x3)= 30+4(1.3)=35.2

If I ≠ 4 then

Sum=sum +2g(x3+h)=35.2+2g(6)=37.6

X4=xo-h+2(4)h= 0+7(1)=7

Sum= sum +4g(x7)=37.6+4(2.1)=46

End for i

Sum = sum +g(0)+g(8) = 46 + 2+0.9=48.9

Sum = h/3(sum) = 16.3


8
Finalmente ∫0 𝑓(𝑥)𝑑𝑥 =16.3

En conclusión el área es 16.3𝑚2

2) Escriba un programa para hallar la 2a derivada de la función f(x)=


(1−2𝑐𝑜𝑠(𝑥)
en x= 0.3 con tamaño de paso 0.5:
(𝜋−3𝑥)

Entrada de datos
(1−2𝑐𝑜𝑠(𝑥)
g(x) = (𝜋−3𝑥)

x= 0.3

h=0.5

Definición de variables y asignación de valores


(1−2𝑐𝑜𝑠(𝑥)
g(x) ← ; x ←0.3; h← 0.5
(𝜋−3𝑥)

Cálculo de las derivadas

D'= [(g(x + h) - g(x-h)]/ 2h = [g(0.3+ 0.5) - g(0.3-0.5)]/ 2(0.5) = -0.272


D''= [(g(x + h) - 2g(x) +2g(x-h)]/ h2 = [g (0.3+ 0.5) - 2g(0.3) + g (0.3-0.5)]/ 0.52 =0.104

Fin del programa

2𝜋 𝑠𝑒𝑛(2𝑥)
3)𝐸𝑣𝑎𝑙ú𝑒 𝑙𝑎 𝑖𝑛𝑡𝑒𝑔𝑟𝑎𝑙 ∫0 dx aplicando el algoritmo adecuado
2+cos(𝑥)
con n=7. Tome tres decímales.
Entrada de datos

a=0

b=2π
𝑠𝑒𝑛(2𝑥)
g(x)= 2+cos(𝑥)

n=7

Definición de variables

n , i ,m : integer ; a , b , h , ,sum , x , g(x) : real

Asignación de valores

xo←a

x7←b
𝑠𝑒𝑛(2𝑥)
g(x) ← 2+cos(𝑥)

n← (0,1,2,3,4,5,67,8.9..)

𝑏−𝑎
ℎ←
𝑛
x(xo,x1,x2,x3,x4,x5,x6,x7)=(0,π/6, π/4, π/2, π,4π/3,3π/2, 2π)

gx(gx0,gx1,gx2,gx3,gx4,gx5,gx6,gx7) = (0;0.302;0.369;0;0;0.577;0;0)

Para el desarrollo del programa se utiliza la estructura condicional « IF  THEN  »


que en español traduce « Si  entonces  »

2𝜋−0
=0.898
7

Se asignan valores de x dentro del intervalo a y b

x(xo,x1,x2,x3,x4,x5,x6,x7)=(0,π/6, π/4, π/2, π,4π/3,3π/2, 2π)


gx(gx0,gx1,gx2,gx3,gx4,gx5,gx6,gx7) = (0;0.302;0.369;0;0;0.577;0;0)

Sum=0

If n=7 then
𝑛 𝑛 7 1
Odd= 2 -int[ 2]= 2 – 3 = > 0 n> 1
2

sum= sum + simpson 3/8 (h, g(𝑋4 , 𝑋5 , 𝑋6 , 𝑋7 ))

[Calculando el Simpson de 3/8]

For i=5 to 6 do

X5=xo+(5)h=4.49

Sum= sum +3g(x5)= 0+3g(4.49)=0.726

For i=6 to 6 do

X6=xo+ (6) h=5.388

Sum= sum +3g(x6) = 0.726+3g (5.388) =-0.390

End for i

Sum=𝑔(𝑋4 ) + 𝑠𝑢𝑚 + 𝑔(𝑋7 ) =-0.390 + 0+0=-0.390


3ℎ 3∗0.898
Finalmente Simpson 3/8= ∗ 𝑠𝑢𝑚 = ∗ −0.390 = −0.131
8 8

end Simpson /78

m= n-3 > 1

If m> 1 them

Sum= sum + Simpson1/3(h,m,g)

m=4> 1

For I = 1 to 2 do

X1=xo – h+2 (1)h=0-0.898+2(0.898)=0.898


Sum =sum +4 g(𝑋1 ) = 0+ 4(0.898) = 1.488

If I ≠ 2 them

Sum= sum + 2 g(𝑋1 + ℎ) = 1.488 + 2 g(0.898 + 0.898)= 0.998

For I=2 to do

𝑋2 = 𝑥𝑜 − ℎ + 2 ∗ 𝑖 ∗ ℎ = 0 − 0.898 + 4(0.898) =1.674

Sum = sum+ 4 g(𝑋2 ) = 0.998+ 4*(x2) = -1.842

End for i

Sum = g(𝑋0 )+sum+ g(𝑋4 )=0-1.842+0 =-1.842

ℎ 0.898
Finalmente Simpson 1/3= 3 ∗ 𝑠𝑢𝑚 = ∗ −1.842 = -1.543
3

End simpson 1/3

Sum = −0.131-1.543=-1.674

End if

2𝜋 𝑠𝑒𝑛(2𝑥)
𝑓𝑖𝑛𝑎𝑙𝑚𝑒𝑛𝑡𝑒 ∫0 dx =-1.674
2+cos(𝑥)

Fin del programa

𝜋
4) Evalué ∫0 𝑒 2𝑡 𝑠𝑒𝑛(t)dt usando el algoritmo de la regla de trapecio para
6

n=6.

Entrada de datos

n=6
a=0
b= 𝜋/6 = 0.523
g(t)= 𝑒2𝑡 𝑠𝑒𝑛(t)

Definición de variables

n , i : integer ; a , b , h , sum , t , g(t) : real


Asignación de valores iniciales
𝑔(𝑡) ← 𝑒 2𝑡 𝑠𝑒𝑛 (t)

𝑎 ←0

𝑏 ← 𝜋/6

𝑛←6

𝑏−𝑎
ℎ←
𝑛
𝑡0 ← 0

[Inicio de la ejecución el programa]

0.523 − 𝑜
ℎ= = 0.087
6
𝑆𝑢𝑚 = 0

𝑭𝒐𝒓 𝑖 = 1 𝒕𝒐 5 𝒅𝒐

𝑖=1

𝑡1 = 𝑡0 + (1) ∗ (ℎ) = 0 + (1) ∗ (0.087) = 0.087

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 2𝑔(𝑡1 ) = 0 + (2) ∗ (0.103) =0.206

𝑭𝒐𝒓 𝑖 = 2 𝒕𝒐 5 𝒅𝒐

𝑖=2

𝑡2 = 𝑡0 + (2) ∗ (ℎ) = 0 + (2) ∗ (0.087) =0.174

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 2𝑔(𝑡2 ) = 0.206 + (2) ∗ (0.245) =0.696

𝑭𝒐𝒓 𝑖 = 3 𝒕𝒐 5 𝒅𝒐

𝑖=3

𝑡3 = 𝑡0 + (3) ∗ (ℎ) = 0 + (3) ∗ (0.435) =0.261

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 2𝑔(𝑡3 ) = 0.696 + (2) ∗ (0.435) = 1.566

𝑭𝒐𝒓 𝑖 = 4 𝒕𝒐 5 𝒅𝒐

𝑖=4

𝑡4 = 𝑡0 + (4) ∗ (ℎ) = 0 + (4) ∗ (0.087) =0.348

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 2𝑔(𝑡4 ) = 1.566 + (2) ∗ (0.683) =2.932


𝑭𝒐𝒓 𝑖 = 1 𝒕𝒐 5 𝒅𝒐

𝑖=5

𝑡5 = 𝑡0 + (5) ∗ (ℎ) = 0 + (5) ∗ (0.087) =0.435

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 2𝑔(𝑡5 ) = 2.932 + (2) ∗ (1.006) =4.944

𝑬𝒏𝒅 𝑭𝒐𝒓 𝒊

𝑆𝑢𝑚 = 𝑆𝑢𝑚 + 𝑔(𝑡0 ) + 𝑔(𝑡6 ) = 4.944 + 0 + 1.427 = 6.373


𝜋
𝑆𝑢𝑚 6.373
Finalmente, ∫02 𝑒2𝑡 𝑠𝑒𝑛(t)dt = ℎ ∗ = 0.087 ∗ = 0.277
2 2

Fin del programa

5) Considere el problema de valor inicial y’ = x 2 + y 2 ; y(0)=1. Use Heun


con h=0.5 para hallar y(0.5) Tome tres decimales.
Calculo de x

Para n=1 x1= xo +1h = 01(0.5) = 0.5

Calculo de y
(𝑓(𝑥𝑜,𝑦𝑜)+𝑓(𝑐𝑖;𝑦𝑖∗)
Para n= 0; y1= yo + h
2

y*= yo + h f(xo;yo) = 1+ 0.5 f(0;1)= 1.5


(𝑓(0,1)+𝑓(0.5;1.5)
y1=1+ = 1.875
2

Fin del programa

También podría gustarte