Professional Documents
Culture Documents
naoyarcel@gmail.com
aNewtonRaphsonGrafica - 1
Option Explicit
Sub X_Y()
Cells.Clear
For i = 1 To 20
X = i - 0.5 * i
Y = (X) ^ (3) + 2 * (X) ^ (2) + 10 * X - 20
Cells(i + 3, 2).Value = X
Cells(i + 3, 3).Value = Y
If Y > 0 Then Exit For
Next i
Cells.EntireColumn.AutoFit
End Sub
Sub Crea_grafico()
Dim grafico As ChartObject
Dim wks As Worksheet
Set wks = ActiveWorkbook.Sheets("Hoja1")
Set grafico = wks.ChartObjects.Add(Left:=400, Width:=450, Top:=50, Height:=200)
grafico.Name = "Grafico_1"
grafico.Chart.ChartType = xlXYScatterSmoothNoMarkers
grafico.Chart.SetSourceData Source:=wks.Range("B4:D15")
End Sub
'Ing. Néstor Augusto Oyarce Linares
Ecuación : ENSAYOS :
4
X^3+2*X^2+10*X-20 X Y
0.5 -14.375 2
1 -7 0
1.5 2.875 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
-4
Series1
-6
Series2
-8
-10
-12
-14
-16
Se nota que la curva de la ecuación cruza el eje X en el intervalo 1.2 y 1.4 ,para el valor inicial de
iteración con el método de Newton_Raphson de manera aproximada el valor de 1.36
bNewtonRaphsonCalculo - 1
Option Explicit
Sub NewtonRaphson_Calculo()
Cells.Clear
X1 = 1.36
For j = 1 To 30
Y = (X1) ^ (3) + 2 * (X1) ^ (2) + 10 * X1 - 20
YD = 3 * (X1) ^ 2 + 4 * (X1) + 10
X2 = X1 - Y / YD
Error = Abs(X2 - X1)
X1 = X2
Cells(j + 3, 3).Value = X2
Cells(j + 3, 4).Value = Y
If Error <= 0.0000001 Then Exit For
Next j
X = X2
Cells(4, 7).Value = X
Cells(4, 8).Value = Y
Cells(4, 9).Value = j
Range("G2", "G4").Font.Bold = True
Range("G2", "G4").Font.Color = RGB(8, 44, 196)
Cells.EntireColumn.AutoFit
End Sub
' Ing. Néstor Augusto Oyarce Linares
'Si hubiera alguna observación o inquietud me hacen conocer a mi correo
'naoyarcel@gmail.com
Método Numérico de Newton
Valor de X Valor de Y Xf Yf Iteraciones