Re: [R] solve scalar linear equation

2014-05-22 Thread message

On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:

--

Message: 32
Date: Mon, 19 May 2014 23:04:27 +0100
From: Rui Barradas ruipbarra...@sapo.pt
To: message let...@openmailbox.org, r-help@r-project.org

uniroot(function(x) 5*x - 55, c(0, 20))



Why does this instruction fail if the interval is changed?


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-22 Thread Berend Hasselman

On 22-05-2014, at 12:28, message let...@openmailbox.org wrote:

 On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:
 --
 Message: 32
 Date: Mon, 19 May 2014 23:04:27 +0100
 From: Rui Barradas ruipbarra...@sapo.pt
 To: message let...@openmailbox.org, r-help@r-project.org
 uniroot(function(x) 5*x - 55, c(0, 20))
 
 Why does this instruction fail if the interval is changed?
 
 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

See the Details section of the uniroot documentation.

Berend

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-22 Thread Rui Barradas

Hello,

Because there is no root of that function in the interval c(0, 10). Just 
like the error message says.


Rui Barradas

Em 22-05-2014 11:28, message escreveu:

On 2014-05-20 10:00, r-help-requ...@r-project.org wrote:

--

Message: 32
Date: Mon, 19 May 2014 23:04:27 +0100
From: Rui Barradas ruipbarra...@sapo.pt
To: message let...@openmailbox.org, r-help@r-project.org

uniroot(function(x) 5*x - 55, c(0, 20))



Why does this instruction fail if the interval is changed?


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



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-22 Thread message

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?



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?


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-22 Thread Rui Barradas

Hello,
See inline.

Em 22-05-2014 13:35, message escreveu:

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's not. This is basic Math.




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?


I believe that Berend was trying to have you read that The function 
values at the endpoints must be of opposite signs (or zero), for 
extendInt=no, the default.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-22 Thread Berend Hasselman

On 22-05-2014, at 14:35, message let...@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
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] solve scalar linear equation

2014-05-19 Thread message

Readers,

The function 'solve' states that it is applicable to a vector or matrix 
object.


Please what is the syntax to solve a very simple equation like:

5x + 1 = 56

The books read so far give explanations for simultaneous linear 
equations or differential equations, but there have not been able to 
find a very basic description to solve simple equations (as an initial 
learning stage). Thanks.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] solve scalar linear equation

2014-05-19 Thread Rui Barradas

Hello,

Try ?uniroot instead.
Your equation is equivalent to 5x - 55 = 0, so the instruction would be

uniroot(function(x) 5*x - 55, c(0, 20))

Hope this helps,

Rui Barradas

Em 19-05-2014 14:46, message escreveu:

Readers,

The function 'solve' states that it is applicable to a vector or matrix
object.

Please what is the syntax to solve a very simple equation like:

5x + 1 = 56

The books read so far give explanations for simultaneous linear
equations or differential equations, but there have not been able to
find a very basic description to solve simple equations (as an initial
learning stage). Thanks.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.