CS代考 Introduction

Introduction
Consider the problem of finding a root of the equation h(x)=0, where h(x) is a continuous function of a single variable x. The Newton-Raphson method can be used to find
such a root, if you can evaluate the gradient of the function h(x). The false position or regula falsi algorithm is a simple alternative method for which the gradient does
not need to be evaluated. To use it, it is necessary to start with two values L and U (“lower” and “upper”) for which LPowCoder代写 加微信 powcoder

have different signs and, because h(x) is continuous, there must be at least one value of x between L and U with h(x)=0.
Starting with such a pair of values L and U, the next step is to calculate a value M (“middle”) as M = L
(if you were to draw a graph of h(x) against x and
connect the points (L,h(L)) and (U,h(U)) with a straight line, then M would be the point between L and U where the line intersects the axis). If h(M)=0 then M is the required
root. Otherwise, if h(L)h(M) O and a, # 0. The arguments to your function should be: a, a vector of coefficients such that a [1] represents do, a [2] represents a1, and so on; lower,
the initial value of L; upper, the initial value of U; and tol, the value of a. The default value of tol should be 1e-6. Your function should start by checking that the values
of lower and upper do indeed bracket a root: if so, it should return the estimated root as a single value. Otherwise it should return the value NA with an appropriate
warning message. Your function must not use any of R’s own root-finding routines such as polyroot (), uniroot () or anything similar.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com