SlideShare a Scribd company logo
1 of 5
Download to read offline
Cálculo de la raíz de una ecuación no lineal mediante el Método Numérico de Steffensen
Utilizando macros de VBA de Excel
Ing. Néstor Augusto Oyarce Linares
naoyarcel@gmail.com
aSteffensenGrafica - 1
Option Explicit
Sub XY_12_Dic_2020_7()
Dim X As Double, Y As Double, i As Integer, X1 As Double, X0 As Double, XX As Double
Dim Err As Double, YD As Double, j As Integer, gx0 As Double, gx As Double
'Método Numérico de STEFFENSEN
'14 de Diciembre de 2020, ejercicio 7
Cells.Clear
Cells(1, 1).Value = " ECUACION : "
Cells(3, 1).Value = " X^3+2*X^2+10*X-20"
Cells(1, 2).Value = " ENSAYOS : "
Cells(3, 2).Value = " X "
Cells(3, 3).Value = " Y "
For i = 1 To 10
X = 1 + i / 10
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
Range("A1", "A3").Font.Bold = True
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
ECUACION : ENSAYOS :
X^3+2*X^2+10*X-20 X Y
1.1 -5.249
1.2 -3.392
1.3 -1.423
1.4 0.664
-6
-5
-4
-3
-2
-1
0
1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Series1
Series2
bSteffensenCalculo - 1
Option Explicit
Sub Parte2_Steffensen()
Dim X1 As Double, Y1 As Double, i As Integer, X2 As Double, Z As Double, Yb As Double
Dim Err As Double, Yz As Double, j As Integer, Y As Double, X As Double
'Función de Recurrencia de Steffensen
'X2 = X1 - (Y1)^2/(Yz-Y1)
'Z = X1+Y1
'Yz = f(Z)
Cells.Clear
Cells(1, 1).Value = "Método Numérico de Steffensen"
Cells(3, 2).Value = "Valor de X"
Cells(3, 3).Value = "Valor de Y"
Cells(3, 7).Value = "Iteraciones"
Cells(j + 3, 2).Value = " Xf "
Cells(j + 3, 3).Value = " Yf "
X1 = 1.3
For j = 1 To 20
Y1 = (X1) ^ (3) + 2 * (X1) ^ (2) + 10 * X1 - 20
Z = X1 + Y1
Yz = (Z) ^ (3) + 2 * (Z) ^ (2) + 10 * Z - 20
X2 = X1 - (Y1) ^ 2 / (Yz - Y1)
Y = (X2) ^ (3) + 2 * (X2) ^ (2) + 10 * X2 - 20
Err = Abs(X2 - X1)
Cells(j + 3, 2).Value = X2
Cells(j + 3, 3).Value = Y
If Err <= 0.0000001 Then Exit For
X1 = X2
Next j
X = X2
Y = (X) ^ (3) + 2 * (X) ^ (2) + 10 * X - 20
Cells(4, 5).Value = X
Cells(4, 6).Value = Y
Cells(4, 7).Value = j
Range("E1", "E4").Font.Bold = True
Range("E1", "E4").Font.Color = RGB(8, 44, 196)
Cells.EntireColumn.AutoFit
End Sub
' Ing. Néstor Augusto Oyarce Linares
Método Numérico de Steffensen
Xf Yf Iteraciones
1.402379779 0.71515279 1.368808108 2.22045E-15 6
1.375352109 0.138314932
1.369077229 0.005677868
1.368808571 9.76547E-06
1.368808108 2.89133E-11
1.368808108 2.22045E-15

More Related Content

What's hot

Quadratic equations
Quadratic equationsQuadratic equations
Quadratic equations
estelav
 
Ejerciciosderivadasresueltos
EjerciciosderivadasresueltosEjerciciosderivadasresueltos
Ejerciciosderivadasresueltos
bellidomates
 
Engr 371 final exam december 1997
Engr 371 final exam december 1997Engr 371 final exam december 1997
Engr 371 final exam december 1997
amnesiann
 
Tugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadratTugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadrat
trisnasariasih
 
Tugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadratTugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadrat
trisnasariasih
 
A2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials NotesA2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials Notes
vhiggins1
 
Practicefor3rdperiodexam
Practicefor3rdperiodexamPracticefor3rdperiodexam
Practicefor3rdperiodexam
Dulce Garza
 
5.2factoringquads
5.2factoringquads5.2factoringquads
5.2factoringquads
vhiggins1
 

What's hot (19)

present_2_new
present_2_newpresent_2_new
present_2_new
 
Completing the square
Completing the squareCompleting the square
Completing the square
 
Quadratic equations
Quadratic equationsQuadratic equations
Quadratic equations
 
SPLTV SMA Global Prestasi ( Rachelle Raine X-SC 1)
SPLTV SMA Global Prestasi ( Rachelle Raine X-SC 1)SPLTV SMA Global Prestasi ( Rachelle Raine X-SC 1)
SPLTV SMA Global Prestasi ( Rachelle Raine X-SC 1)
 
5.3sqrt
5.3sqrt5.3sqrt
5.3sqrt
 
Ejerciciosderivadasresueltos
EjerciciosderivadasresueltosEjerciciosderivadasresueltos
Ejerciciosderivadasresueltos
 
Bayesian regression intro with r
Bayesian regression intro with rBayesian regression intro with r
Bayesian regression intro with r
 
Engr 371 final exam december 1997
Engr 371 final exam december 1997Engr 371 final exam december 1997
Engr 371 final exam december 1997
 
Funções 5
Funções  5Funções  5
Funções 5
 
Distributed Machine Learning with Apache Mahout
Distributed Machine Learning with Apache MahoutDistributed Machine Learning with Apache Mahout
Distributed Machine Learning with Apache Mahout
 
Tugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadratTugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadrat
 
The Derivative of e^x and lnx
The Derivative of e^x and lnxThe Derivative of e^x and lnx
The Derivative of e^x and lnx
 
Tugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadratTugas matematika menemukan konsep persamaan kuadrat
Tugas matematika menemukan konsep persamaan kuadrat
 
Calculo integral - Larson
Calculo integral - LarsonCalculo integral - Larson
Calculo integral - Larson
 
A2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials NotesA2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials Notes
 
Practicefor3rdperiodexam
Practicefor3rdperiodexamPracticefor3rdperiodexam
Practicefor3rdperiodexam
 
5.2factoringquads
5.2factoringquads5.2factoringquads
5.2factoringquads
 
Resumen de Integrales (Cálculo Diferencial e Integral UNAB)
Resumen de Integrales (Cálculo Diferencial e Integral UNAB)Resumen de Integrales (Cálculo Diferencial e Integral UNAB)
Resumen de Integrales (Cálculo Diferencial e Integral UNAB)
 
Sol1
Sol1Sol1
Sol1
 

Similar to 0.0. steffensen.naol

Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
Nish Kala Devi
 

Similar to 0.0. steffensen.naol (20)

0.0. secante modificada
0.0. secante modificada0.0. secante modificada
0.0. secante modificada
 
0.0. biseccion
0.0. biseccion0.0. biseccion
0.0. biseccion
 
0.0. punto fijo
0.0. punto fijo0.0. punto fijo
0.0. punto fijo
 
Assignment For Matlab Report Subject Calculus 2
Assignment For Matlab Report Subject  Calculus 2Assignment For Matlab Report Subject  Calculus 2
Assignment For Matlab Report Subject Calculus 2
 
ゲーム理論BASIC 第36回 -続・交渉集合-
ゲーム理論BASIC 第36回 -続・交渉集合-ゲーム理論BASIC 第36回 -続・交渉集合-
ゲーム理論BASIC 第36回 -続・交渉集合-
 
ゲーム理論BASIC 第42回 -仁に関する定理の証明2-
ゲーム理論BASIC 第42回 -仁に関する定理の証明2-ゲーム理論BASIC 第42回 -仁に関する定理の証明2-
ゲーム理論BASIC 第42回 -仁に関する定理の証明2-
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)
 
138191 rvsp lecture notes
138191 rvsp lecture notes138191 rvsp lecture notes
138191 rvsp lecture notes
 
ゲーム理論BASIC 第41回 -続・仁-
ゲーム理論BASIC 第41回 -続・仁-ゲーム理論BASIC 第41回 -続・仁-
ゲーム理論BASIC 第41回 -続・仁-
 
ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-
 
Module 2 polynomial functions
Module 2   polynomial functionsModule 2   polynomial functions
Module 2 polynomial functions
 
Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
Dirty quant-shortcut-workshop-handout-inequalities-functions-graphs-coordinat...
 
K-Map.pptx
K-Map.pptxK-Map.pptx
K-Map.pptx
 
ゲーム理論 BASIC 演習74 補足 -コアの存在, 線型計画問題-
ゲーム理論 BASIC 演習74 補足 -コアの存在, 線型計画問題-ゲーム理論 BASIC 演習74 補足 -コアの存在, 線型計画問題-
ゲーム理論 BASIC 演習74 補足 -コアの存在, 線型計画問題-
 
DurbinWatsonVBA
DurbinWatsonVBADurbinWatsonVBA
DurbinWatsonVBA
 
Arrays
ArraysArrays
Arrays
 
Matlab file
Matlab file Matlab file
Matlab file
 
Numerical solution of the Schr¨odinger equation
Numerical solution of the Schr¨odinger equationNumerical solution of the Schr¨odinger equation
Numerical solution of the Schr¨odinger equation
 
Multivriada ppt ms
Multivriada   ppt msMultivriada   ppt ms
Multivriada ppt ms
 
数学カフェ 確率・統計・機械学習回 「速習 確率・統計」
数学カフェ 確率・統計・機械学習回 「速習 確率・統計」数学カフェ 確率・統計・機械学習回 「速習 確率・統計」
数学カフェ 確率・統計・機械学習回 「速習 確率・統計」
 

More from Agua SAC (6)

0.0. newton raphson
0.0. newton raphson0.0. newton raphson
0.0. newton raphson
 
Publi 05.03.2015
Publi 05.03.2015Publi 05.03.2015
Publi 05.03.2015
 
Trapecio tarea 1
Trapecio tarea 1Trapecio tarea 1
Trapecio tarea 1
 
Sistema información geografica y dengue
Sistema información geografica y dengueSistema información geografica y dengue
Sistema información geografica y dengue
 
Ejercicio amp2 naol
Ejercicio amp2 naolEjercicio amp2 naol
Ejercicio amp2 naol
 
Ejercicio amp2 naol
Ejercicio amp2 naolEjercicio amp2 naol
Ejercicio amp2 naol
 

Recently uploaded

ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DrGurudutt
 

Recently uploaded (20)

How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Quiz application system project report..pdf
Quiz application system project report..pdfQuiz application system project report..pdf
Quiz application system project report..pdf
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
ANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdfANSI(ST)-III_Manufacturing-I_05052020.pdf
ANSI(ST)-III_Manufacturing-I_05052020.pdf
 
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdfBURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
E-Commerce Shopping using MERN Stack where different modules are present
E-Commerce Shopping using MERN Stack where different modules are presentE-Commerce Shopping using MERN Stack where different modules are present
E-Commerce Shopping using MERN Stack where different modules are present
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon
 
Multivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptxMultivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptx
 

0.0. steffensen.naol

  • 1. Cálculo de la raíz de una ecuación no lineal mediante el Método Numérico de Steffensen Utilizando macros de VBA de Excel Ing. Néstor Augusto Oyarce Linares naoyarcel@gmail.com
  • 2. aSteffensenGrafica - 1 Option Explicit Sub XY_12_Dic_2020_7() Dim X As Double, Y As Double, i As Integer, X1 As Double, X0 As Double, XX As Double Dim Err As Double, YD As Double, j As Integer, gx0 As Double, gx As Double 'Método Numérico de STEFFENSEN '14 de Diciembre de 2020, ejercicio 7 Cells.Clear Cells(1, 1).Value = " ECUACION : " Cells(3, 1).Value = " X^3+2*X^2+10*X-20" Cells(1, 2).Value = " ENSAYOS : " Cells(3, 2).Value = " X " Cells(3, 3).Value = " Y " For i = 1 To 10 X = 1 + i / 10 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 Range("A1", "A3").Font.Bold = True 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
  • 3. ECUACION : ENSAYOS : X^3+2*X^2+10*X-20 X Y 1.1 -5.249 1.2 -3.392 1.3 -1.423 1.4 0.664 -6 -5 -4 -3 -2 -1 0 1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 Series1 Series2
  • 4. bSteffensenCalculo - 1 Option Explicit Sub Parte2_Steffensen() Dim X1 As Double, Y1 As Double, i As Integer, X2 As Double, Z As Double, Yb As Double Dim Err As Double, Yz As Double, j As Integer, Y As Double, X As Double 'Función de Recurrencia de Steffensen 'X2 = X1 - (Y1)^2/(Yz-Y1) 'Z = X1+Y1 'Yz = f(Z) Cells.Clear Cells(1, 1).Value = "Método Numérico de Steffensen" Cells(3, 2).Value = "Valor de X" Cells(3, 3).Value = "Valor de Y" Cells(3, 7).Value = "Iteraciones" Cells(j + 3, 2).Value = " Xf " Cells(j + 3, 3).Value = " Yf " X1 = 1.3 For j = 1 To 20 Y1 = (X1) ^ (3) + 2 * (X1) ^ (2) + 10 * X1 - 20 Z = X1 + Y1 Yz = (Z) ^ (3) + 2 * (Z) ^ (2) + 10 * Z - 20 X2 = X1 - (Y1) ^ 2 / (Yz - Y1) Y = (X2) ^ (3) + 2 * (X2) ^ (2) + 10 * X2 - 20 Err = Abs(X2 - X1) Cells(j + 3, 2).Value = X2 Cells(j + 3, 3).Value = Y If Err <= 0.0000001 Then Exit For X1 = X2 Next j X = X2 Y = (X) ^ (3) + 2 * (X) ^ (2) + 10 * X - 20 Cells(4, 5).Value = X Cells(4, 6).Value = Y Cells(4, 7).Value = j Range("E1", "E4").Font.Bold = True Range("E1", "E4").Font.Color = RGB(8, 44, 196) Cells.EntireColumn.AutoFit End Sub ' Ing. Néstor Augusto Oyarce Linares
  • 5. Método Numérico de Steffensen Xf Yf Iteraciones 1.402379779 0.71515279 1.368808108 2.22045E-15 6 1.375352109 0.138314932 1.369077229 0.005677868 1.368808571 9.76547E-06 1.368808108 2.89133E-11 1.368808108 2.22045E-15