regula-falsi(false position) method in c


REGULA-FALSI METHOD:

Let,the graph of the equation Y=f(x) pass through two points A[a,f(a)] and B[b,f(b)] such that f(a) and f(b) are of opposite sign.

let p be a root of f(x)=0 lying between a and b, p is the abscissa of the point where the graph of Y=f(x) meets the x-axis.join AB,if the chord AB meets the x-axis at a point whose abscissa is x1,then x1 is the first approximation of the root.


The equation of the chord AB is,

y-f(a)=(f(b)-f(a)) / (b-a)*(x-a)

x1=(a*f(b)-b*f(a)) / f(b)-f(a)

coding:







output:



0 comments:

Copyright © 2013 free coding