# function in R

• Nov 4th 2012, 10:59 AM
Reem
function in R
Hello,

I have problems in writing a function in R for this particular question below.
Thank you

The method of dichotomy (or method of division in halves) is a simple way for
numerically solving equations in a single unknown. Consider the equation f(x) = 0
with a continuous monotonic function f on the interval [a, b] which takes values
of dierent signs at the end points of the interval and which has a single root x*
within [a, b]. To nd the solution x* approximately, one divides [a; b] into halves
and calculates the value of f(x1) at the midpoint (a+b)/2 . If f(x1) not equal to 0, one takes
the two intervals [a, x1] and [x1,b] and from them selects for the next dichotomy
the one at the end points of which the values of the function dier in sign. This
continued division into halves gives a sequence x1, x2,..., which converges to the
root x* when the interval becomes very small.
Use the method of dichotomy to find the pth quantile of the standard normal
distribution (we assume that the function qnorm is not available). That is,
pnorm(x) = p
pnorm(x) - p = 0
f(x) = 0