ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Metodos numericos tarea

vergasqpongoTarea21 de Noviembre de 2015

527 Palabras (3 Páginas)216 Visitas

Página 1 de 3

[pic 1]

[pic 2][pic 3]

              Métodos Numéricos

                                            [pic 4]           

                                           [pic 5]

[pic 6]

Problema 1

[pic 7]

Código

Option Explicit

Dim i As Integer

Dim x0, x1, eps, ep, fx0, fx1, x2 As Double

Private Sub CommandButton1_Click()

x0 = Cells(14, 6)

x1 = Cells(15, 6)

x2 = 0

eps = Cells(16, 6)

ep = Cells(17, 6)

fx0 = ep - (2 - (1 / (1 + x0 ^ 2))) * ((1 + x0 ^ 2) ^ 0.5) + 2 * x0

fx1 = ep - (2 - (1 / (1 + x1 ^ 2))) * ((1 + x1 ^ 2) ^ 0.5) + 2 * x1

x2 = x1 - ((x0 - x1) / (fx0 - fx1)) * fx1

Do While (Abs(x2 - x1) > eps)

x0 = x1

x1 = x2

fx1 = ep - (2 - (1 / (1 + x0 ^ 2))) * ((1 + x1 ^ 2) ^ 0.5) + 2 * x1

fx0 = ep - (2 - (1 / (1 + x1 ^ 2))) * ((1 + x0 ^ 2) ^ 0.5) + 2 * x0

x2 = x1 - ((x0 - x1) / (fx0 - fx1)) * fx1

Loop

Cells(18, 6) = x2

End Sub

___________________________________________________________________________________

Private Sub CommandButton2_Click()

For i = 18 To 20

Cells(i, 6) = ""

Next

End Sub


Solución

[pic 8]


Problema 2

[pic 9]

Código

Option Explicit

Dim i As Integer

Dim x0, x1, n, l, k, h, E, eps, sh0, ch0, sh1, ch1, lambda0, lambda1, alfa0, alfa1, x2, f0, f1 As Double

___________________________________________________________________________________

Private Sub CommandButton1_Click()

x0 = Cells(2, 14)

x1 = Cells(3, 14)

n = Cells(4, 14)

l = Cells(5, 14)

k = Cells(6, 14)

h = Cells(7, 14)

E = Cells(8, 14)

eps = Cells(9, 14)

Do While (E > eps)

lambda0 = (k * x0 / h) ^ 0.5

alfa0 = (h * x0 / k) ^ 0.5

sh0 = 0.5 * (2.718282 ^ (l / lambda0) - 2.718282 ^ (-(l / lambda0)))

ch0 = 0.5 * (2.718282 ^ (l / lambda0) + 2.718282 ^ (-(l / lambda0)))

f0 = (sh0 + alfa0 * ch0) / (ch0 + alfa0 * sh0) * (lambda0 / (1 + x0)) - n

alfa1 = (h * x1 / k) ^ 0.5

lambda1 = (k * x1 / h) ^ 0.5

sh1 = 0.5 * (2.718282 ^ (l / lambda1) - 2.718282 ^ (-(l / lambda1)))

ch1 = 0.5 * (2.718282 ^ (l / lambda1) + 2.718282 ^ (-(l / lambda1)))

f1 = (sh1 + alfa1 * ch1) / (ch1 + alfa1 * sh1) * (lambda1 / (1 + x1)) - n

x2 = x1 - (f1 * (x0 - x1) / (f0 - f1))

E = Abs(x2 - x1)

x0 = x1

x1 = x2

Loop

Cells(10, 14) = x2

End Sub

___________________________________________________________________________________

Private Sub CommandButton2_Click()

For i = 10 To 12

Cells(i, 14) = ""

Next

End Sub

Solución

[pic 10]

        

...

Descargar como (para miembros actualizados) txt (2 Kb) pdf (703 Kb) docx (741 Kb)
Leer 2 páginas más »
Disponible sólo en Clubensayos.com