[R] solve scalar linear equation

Berend Hasselman bhh at xs4all.nl
Thu May 22 14:55:55 CEST 2014


On 22-05-2014, at 14:35, message <letter at openmailbox.org> wrote:

> On 2014-05-22 11:00, Berend Hasselman wrote:
>>>> uniroot(function(x) 5*x - 55, c(0, 10))
>>> Error in uniroot(function(x) 5 * x - 55, c(0, 10)) :
>>> f() values at end points not of opposite sign
>> I don’t believe this.
>> The error message says it all.
>> 5*0-55 ==> -55
>> 5*10-55 ==> -5
> 
> The error states "opposite sign", which suggests to a rudimentary novice that end points (0 and 10, or 0 and 20) must give results of the function such that one value is negative, another value is positive. Or is this interpretation wrong?
> 

No. It is exactly what the error message says. Both function values are negatieve i.e. not of opposite sign.
Which is why you got the error message.

>> See the Details section of the uniroot documentation.
> 
> The documentation states that the upper end point (in this example 10, or 20) must be strictly larger than the lower point (0). What is being mis-understood please?
> 

Read the sentences after the first.

Berend


More information about the R-help mailing list