Displaying 1 result from an estimated 1 matches for "regularfalsi".
Did you mean:
regulafalsi
2010 Dec 21
3
how to see what's wrong with a self written function?
Hi all,
I am writing a simple function to implement regularfalsi (secant) method.
###################################################
regulafalsi=function(f,x0,x1){
x=c()
x[1]=x1
i=1
while ( f(x[i])!=0 ) {
i=i+1
if (i==2) {
x[2]=x[1]-f(x[1])*(x[1]-x0)/(f(x[1])-f(x0))
} else {
x[i]=x[i-1]-f(x[i-1])*(x[i-1]-x[i-2])/(f(x[i-1])-f(x[i-2]))
}
}
x[...