r - newton.method issues -
Has this method broken up in R? I am using the following functions to find: f (x) = 2.5 * exp (-0.5 * (2 * 0.045x)) + 2.5 * exp (-0.045) + 2.5 * exp (-1.5 * X) - 100
This is responding to -38.4762403 which is not close (F (x) = 2.90380 9A + 25x = -38.4762403). The answer should be around 0.01-0.1. This function should be coordinated.
For normal tasks such as F (x) = x * *, it responds as 8.89210984 for which f (x) = 0.001222392 and I set tolerance to 10 ^ -12.
Besides, is Newton a non-graphical version of the method? I saw nleqslv but do not know how to use it ..
Thanks for your help
There are several root finders in R, like uniroot
and polyroot
. You can use customizable tasks like optim
, optimize
or nlminb
for more complex issues. An example of solving this problem with uniroot
is.
## Define the function f & lt; - function (x) {2.5 * exp (-0.5 * (2 * 0.045 - x)) + 2.5 * APP (-0.045) + 2.5 * AP (-1.5 * x) - 100} ## Pane Y and LT; - Seak (-20,20,0.1) plot (Y, F (y), ylim = c (-100,100), xlim = c (-20,20)) ## Roots uniform (F, C (-5.0) )) Uniform (F, C (0, 10))
Comments
Post a Comment