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 la Falsa Posición
Utilizando macros de VBA de Excel
Ing. Néstor Augusto Oyarce Linares
naoyarcel@gmail.com
aFalsaPosicionGrafica - 1
Option Explicit
Sub XY_10_Dic_2020_4()
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 FALSA POSICIÓN
'10 de Diciembre de 2020, ejercicio 4
Cells.Clear
Cells(1, 1).Value = " ECUACIÓN : "
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
ECUACIÓN : 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
bFalsaPosicionCalculo - 1
Option Explicit
Sub Parte2_Falsa_Posición()
Dim Xa As Double, Ya As Double, i As Integer, Xb As Double, Xm As Double, Yb As Double
Dim Error As Double, Ym As Double, j As Integer, X As Double, Y As Double
'Función de Recurrencia
'c=b-f(b)*(a-b)/(f(a)-f(b))
Cells.Clear
Cells(1, 1).Value = "Método Numérico de la Falsa Posición"
Cells(2, 2).Value = "Valor de X"
Cells(2, 3).Value = "Valor de Y"
Cells(2, 5).Value = " Xf "
Cells(2, 6).Value = " Yf "
Cells(2, 7).Value = "Iteraciones"
Xa = 1.35
Xb = 1.4
For j = 1 To 20
Ya = (Xa) ^ (3) + 2 * (Xa) ^ (2) + 10 * Xa - 20
Yb = (Xb) ^ (3) + 2 * (Xb) ^ (2) + 10 * Xb - 20
Xm = Xb - Yb * (Xa - Xb) / (Ya - Yb)
Ym = (Xm) ^ (3) + 2 * (Xm) ^ (2) + 10 * Xm - 20
If Ya * Ym < 0 Then Xb = Xm Else Xa = Xm
Error = Abs(Xa - Xb)
Cells(j + 3, 2).Value = Xm
Cells(j + 3, 3).Value = Ym
If Error <= 0.000001 Then Exit For
Next j
X = Xm
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 la Falsa Posición
Valor de X Valor de Y Xf Yf Iteraciones
1.368638564 -0.003576541 1.368808108 2.22045E-15 8
1.368806583 -3.21669E-05
1.368808094 -2.89284E-07
1.368808108 -2.60159E-09
1.368808108 -2.33955E-11
1.368808108 -2.08278E-13
1.368808108 -2.66454E-15
1.368808108 2.22045E-15

More Related Content

What's hot (11)

Pratikum 2 urai wira s
Pratikum 2 urai wira sPratikum 2 urai wira s
Pratikum 2 urai wira s
 
Pratikum 1 hardiansyah
Pratikum 1 hardiansyahPratikum 1 hardiansyah
Pratikum 1 hardiansyah
 
8th Alg - L8.2--March12
8th Alg - L8.2--March128th Alg - L8.2--March12
8th Alg - L8.2--March12
 
5.3sqrt
5.3sqrt5.3sqrt
5.3sqrt
 
Product rule
Product ruleProduct rule
Product rule
 
20160616技術會議
20160616技術會議20160616技術會議
20160616技術會議
 
Pre-Cal 40S Slides April 9, 2008
Pre-Cal 40S Slides April 9, 2008Pre-Cal 40S Slides April 9, 2008
Pre-Cal 40S Slides April 9, 2008
 
A2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials NotesA2 6-4 Factoring Polynomials Notes
A2 6-4 Factoring Polynomials Notes
 
Worksheet sine and cosine rule
Worksheet  sine and cosine ruleWorksheet  sine and cosine rule
Worksheet sine and cosine rule
 
Pc12 sol c03_cp
Pc12 sol c03_cpPc12 sol c03_cp
Pc12 sol c03_cp
 
Exercise #11 notes
Exercise #11 notesExercise #11 notes
Exercise #11 notes
 

Similar to 0.0. falsa posicion-naol

1.  Write an equation in standard form of the parabola that has th.docx
1.  Write an equation in standard form of the parabola that has th.docx1.  Write an equation in standard form of the parabola that has th.docx
1.  Write an equation in standard form of the parabola that has th.docx
KiyokoSlagleis
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Vyacheslav Arbuzov
 
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. falsa posicion-naol (20)

0.0. secante modificada
0.0. secante modificada0.0. secante modificada
0.0. secante modificada
 
Math cbse samplepaper
Math cbse samplepaperMath cbse samplepaper
Math cbse samplepaper
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)
 
4th Semeste Electronics and Communication Engineering (June-2016) Question Pa...
4th Semeste Electronics and Communication Engineering (June-2016) Question Pa...4th Semeste Electronics and Communication Engineering (June-2016) Question Pa...
4th Semeste Electronics and Communication Engineering (June-2016) Question Pa...
 
Cbse Class 12 Maths Sample Paper 2012
Cbse Class 12 Maths Sample Paper 2012Cbse Class 12 Maths Sample Paper 2012
Cbse Class 12 Maths Sample Paper 2012
 
4th Semester (July-2016) Civil Engineering Question Paper
4th Semester (July-2016) Civil Engineering Question Paper4th Semester (July-2016) Civil Engineering Question Paper
4th Semester (July-2016) Civil Engineering Question Paper
 
ISI MSQE Entrance Question Paper (2010)
ISI MSQE Entrance Question Paper (2010)ISI MSQE Entrance Question Paper (2010)
ISI MSQE Entrance Question Paper (2010)
 
4th semester Computer Science and Information Science Engg (2013 December) Qu...
4th semester Computer Science and Information Science Engg (2013 December) Qu...4th semester Computer Science and Information Science Engg (2013 December) Qu...
4th semester Computer Science and Information Science Engg (2013 December) Qu...
 
1.  Write an equation in standard form of the parabola that has th.docx
1.  Write an equation in standard form of the parabola that has th.docx1.  Write an equation in standard form of the parabola that has th.docx
1.  Write an equation in standard form of the parabola that has th.docx
 
4th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
4th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...4th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
4th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
 
4th Semester (June; July-2015) Computer Science and Information Science Engin...
4th Semester (June; July-2015) Computer Science and Information Science Engin...4th Semester (June; July-2015) Computer Science and Information Science Engin...
4th Semester (June; July-2015) Computer Science and Information Science Engin...
 
Precalculus 1 chapter 1
Precalculus 1 chapter 1Precalculus 1 chapter 1
Precalculus 1 chapter 1
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
 
3rd semester Computer Science and Information Science Engg (2013 December) Q...
3rd  semester Computer Science and Information Science Engg (2013 December) Q...3rd  semester Computer Science and Information Science Engg (2013 December) Q...
3rd semester Computer Science and Information Science Engg (2013 December) Q...
 
Calculus - 1 Functions, domain and range
Calculus - 1 Functions, domain and rangeCalculus - 1 Functions, domain and range
Calculus - 1 Functions, domain and range
 
4th Semester CS / IS (2013-June) Question Papers
4th Semester CS / IS (2013-June) Question Papers 4th Semester CS / IS (2013-June) Question Papers
4th Semester CS / IS (2013-June) Question Papers
 
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...
 
Module 2 polynomial functions
Module 2   polynomial functionsModule 2   polynomial functions
Module 2 polynomial functions
 
C++ ammar .s.q
C++  ammar .s.qC++  ammar .s.q
C++ ammar .s.q
 
3rd Semester Electronics and Communication Engineering (June-2016) Question P...
3rd Semester Electronics and Communication Engineering (June-2016) Question P...3rd Semester Electronics and Communication Engineering (June-2016) Question P...
3rd Semester Electronics and Communication Engineering (June-2016) Question P...
 

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

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
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
Madan Karki
 

Recently uploaded (20)

Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
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
 
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
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.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...
 
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdfBURGER ORDERING SYSYTEM PROJECT REPORT..pdf
BURGER ORDERING SYSYTEM PROJECT REPORT..pdf
 
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
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptxROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 
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
 
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
 

0.0. falsa posicion-naol

  • 1. Cálculo de la raíz de una ecuación no lineal mediante el Método Numérico de la Falsa Posición Utilizando macros de VBA de Excel Ing. Néstor Augusto Oyarce Linares naoyarcel@gmail.com
  • 2. aFalsaPosicionGrafica - 1 Option Explicit Sub XY_10_Dic_2020_4() 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 FALSA POSICIÓN '10 de Diciembre de 2020, ejercicio 4 Cells.Clear Cells(1, 1).Value = " ECUACIÓN : " 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. ECUACIÓN : 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. bFalsaPosicionCalculo - 1 Option Explicit Sub Parte2_Falsa_Posición() Dim Xa As Double, Ya As Double, i As Integer, Xb As Double, Xm As Double, Yb As Double Dim Error As Double, Ym As Double, j As Integer, X As Double, Y As Double 'Función de Recurrencia 'c=b-f(b)*(a-b)/(f(a)-f(b)) Cells.Clear Cells(1, 1).Value = "Método Numérico de la Falsa Posición" Cells(2, 2).Value = "Valor de X" Cells(2, 3).Value = "Valor de Y" Cells(2, 5).Value = " Xf " Cells(2, 6).Value = " Yf " Cells(2, 7).Value = "Iteraciones" Xa = 1.35 Xb = 1.4 For j = 1 To 20 Ya = (Xa) ^ (3) + 2 * (Xa) ^ (2) + 10 * Xa - 20 Yb = (Xb) ^ (3) + 2 * (Xb) ^ (2) + 10 * Xb - 20 Xm = Xb - Yb * (Xa - Xb) / (Ya - Yb) Ym = (Xm) ^ (3) + 2 * (Xm) ^ (2) + 10 * Xm - 20 If Ya * Ym < 0 Then Xb = Xm Else Xa = Xm Error = Abs(Xa - Xb) Cells(j + 3, 2).Value = Xm Cells(j + 3, 3).Value = Ym If Error <= 0.000001 Then Exit For Next j X = Xm 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 la Falsa Posición Valor de X Valor de Y Xf Yf Iteraciones 1.368638564 -0.003576541 1.368808108 2.22045E-15 8 1.368806583 -3.21669E-05 1.368808094 -2.89284E-07 1.368808108 -2.60159E-09 1.368808108 -2.33955E-11 1.368808108 -2.08278E-13 1.368808108 -2.66454E-15 1.368808108 2.22045E-15