You are on page 1of 7

UNIVERSIDAD NACIONAL INTERCULTURAL “FABIOLA SALAZAR

LEGUÍA” DE BAGUA

´´AÑO DEL FORTALECIMIENTO DE LA SOBERANÍA NACIONAL´´

FACULTAD DE INGENIERIA CIVIL

ESCUELA PROFESIONAL DE INGENIERIA CIVIL

V CICLO

MÉTODOS NUMÉRICOS

ALUMNA
CENTURION MESONES CYNTHIA DARSY
DNI

76959034
CORREO

ccenturion@unibagua.edu.pe

DOCENTE
ROGER FERNÁNDEZ VILLAROEL

PRECISIONES PARA LA PRESENTACIÓN

Cynthia Darsy Centurion Mesones


Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
MÉTODO DEL PUNTO FIJO

# -- coding: utf-8 --
"""
Created on Thu Mar 31 17:35:52
2022

@author: Tramite
"""

import numpy as np
from matplotlib import pyplot as plt

def f(x):
f=2*x-np.exp(-1*x)
return f

def fun(x):
g=np.exp(-1*x)/2
return g
xi=0

while(True):
xn=fun(xi)
if(abs(xn-xi)/xn<0.000001):
break
print(xi)
xi=xn

print('La raiz es: ')


print(xn)

x=np.linspace(-1,1,100)

plt.figure()

plt.plot(x,f(x))
plt.plot(xn,f(xn),marker='o')
plt.grid()

plt.show()

Cynthia Darsy Centurion Mesones


Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
# -- coding: utf-8 --
"""
Created on Thu Mar 31 17:35:52
2022

@author: Tramite
"""

import numpy as np
from matplotlib import pyplot as plt

def f(x):
f=3.4*x-np.exp(-2.4*x)
return f

def fun(x):
g=np.exp(-2.4*x)/3.4
return g
xi=1

while(True):
xn=fun(xi)
if(abs(xn-xi)/xn<0.000001):
break
print(xi)
xi=xn

print('La raiz es: ')


print(xn)

x=np.linspace(-1,1,100)

plt.figure()

plt.plot(x,f(x))
plt.plot(xn,f(xn),marker='o')
plt.grid()

plt.show()

Cynthia Darsy Centurion Mesones


Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
MÉTODO DE LA SECANTE

# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# -*- coding: utf-8 -*-
""" """
"""
Spyder Editor Spyder Editor
Spyder Editor
This is a temporary script file. This is a temporary script file.
This is a temporary script file.
""" """
"""
# Algoritmo posicion falsa para raices # Algoritmo posicion falsa para raices
# Algoritmo posicion falsa para raices
# Busca en intervalo [a,b] # Busca en intervalo [a,b]
# Busca en intervalo [a,b]
import numpy as np import numpy as np
import numpy as np
# -- coding: utf-8 -- # -- coding: utf-8 --
# -- coding: utf-8 --
""" """
"""
Created on Tue Apr 26 04:45:08 2022 Created on Tue Apr 26 04:45:08 2022
Created on Tue Apr 26 04:45:08 2022
@author: Tramite @author: Tramite
@author: Tramite
""" """
"""
def f(x): def f(x):
def f(x):
return -5+2*x+14*x**3-2*x**5 return -5+2*x+14*x**3-2*x**5
return -5+2*x+14*x**3-2*x**5
x0=0; x0=4;
x0=5;
x1=-1; x1=-3;
x1=4;
x2=0 x2=0
x2=0
fx0=f(x0) fx0=f(x0)
fx0=f(x0)
fx1=f(x1) fx1=f(x1)
fx1=f(x1)
tol=0.00005 tol=0.00005
tol=0.00005
while (abs(fx1)>tol): while (abs(fx1)>tol):
while (abs(fx1)>tol):
x2=x1-((fx1*(x0-x1))/(fx0-fx1)) x2=x1-((fx1*(x0-x1))/(fx0-fx1))
x2=x1-((fx1*(x0-x1))/(fx0-fx1))
print (x2) print (x2)
print (x2)
fx2=f(x2) fx2=f(x2)
fx2=f(x2)
x0=x1 x0=x1
x0=x1
x1=x2 x1=x2
x1=x2
fx0=f(x0) fx0=f(x0)
fx0=f(x0)
fx1=f(x1) fx1=f(x1)
fx1=f(x1)
print('La aproximación de la raiz: es', print('La aproximación de la raiz: es',
print('La aproximación de la raiz: es',
x2) x2)
x2)

Cynthia Darsy Centurion Mesones


Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
Cynthia Darsy Centurion Mesones
Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Spyder Editor Spyder Editor

This is a temporary script file. This is a temporary script file.


""" """

# Algoritmo posicion falsa para raices # Algoritmo posicion falsa para raices
# Busca en intervalo [a,b] # Busca en intervalo [a,b]
import numpy as np import numpy as np

# -- coding: utf-8 -- # -- coding: utf-8 --


""" """
Created on Tue Apr 26 04:45:08 2022 Created on Tue Apr 26 04:45:08 2022

@author: Tramite @author: Tramite


""" """

def f(x): def f(x):


return 3*x**4-5*x**3+4*x**2-8*x-6 return 3*x**4-5*x**3+4*x**2-8*x-6
x0=4; x0=0;
x1=3; x1=-1;
x2=0 x2=0
fx0=f(x0) fx0=f(x0)
fx1=f(x1) fx1=f(x1)
tol=0.00005 tol=0.00005
while (abs(fx1)>tol): while (abs(fx1)>tol):
x2=x1-((fx1*(x0-x1))/(fx0-fx1)) x2=x1-((fx1*(x0-x1))/(fx0-fx1))
print (x2) print (x2)
fx2=f(x2) fx2=f(x2)
x0=x1 x0=x1
x1=x2 x1=x2
fx0=f(x0) fx0=f(x0)
fx1=f(x1) fx1=f(x1)
print('La aproximación de la raiz: es', x2) print('La aproximación de la raiz: es', x2)

Cynthia Darsy Centurion Mesones


Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú
Cynthia Darsy Centurion Mesones
Universidad Nacional Intercultural «Fabiola Salazar Leguía» Bagua –Amazonas - Perú

You might also like