Aplicación libre 1. Métodos de Bisección, Newton-Raphson y Secante
metod de newton raphson y secante (C++)
-
Upload
henry-alvarez -
Category
Documents
-
view
214 -
download
0
Transcript of metod de newton raphson y secante (C++)
-
7/26/2019 metod de newton raphson y secante (C++)
1/1
====Newton Raphson====clear all
clc
syms x
xi=input('\n dame el valor inicial: ')%4
ec=input('\n dame la ecuacion a evaluar: ') %(-!"#x$)&(!#x)&(!)
a=di**(ec+x)
*=inline(ec)
*=inline(a)
n=,
i=,
es=!#$(-n)
ea=,
whileas(ea).es
*print*('iteracion:%/!*\n'+i&)
*x=*eval(*+xi)
*x=*eval(*+xi)
xr=xi-(*x0*x)
i=&i,
ea=as((xr-xi)0xr)# xi=xr
end
====1ecante====
clear all
clc
syms x
x=input('\n dame 2: ')%
x=input('\n dame 2: ')%3
ec=input('\n dame la *ormula a evaluar: ') %(-!"#x$)&(!#x)&(!)%a=di**(ec+x)
*=inline(ec)
%*=inline(a)
n=,
i=,
es=!#$(-n)
ea=,
whileas(ea).es
*print*('iteracion:%/!*\n'+i&)
*x=*eval(*+x)
*x=*eval(*+x)
xr=x-((*x#(x-x))0(*x-*x))
i=&i,
ea=as((xr-x)0xr)#
x=x
x=xr
end