On 2010-05-01 7:13, Berend Hasselman wrote:


David Winsemius wrote:


On May 1, 2010, at 3:28 AM, Berend Hasselman wrote:



Shant Ch wrote:

I want to solve: x*(3^x)*log(4)-x*log(4/3)-(3^x)+1=0 for x. I used
the
following code,

uniroot(function(x) x*(3^x)*log(4)-x*log(4/3)-(3^x)+1, lower = -2,
upper =
2, tol = 0.001 )

While using this I am getting the following error. Can anyone
please help
me out.
Error in uniroot(function(x) x * (3^x) * log(4) - x * log(4/3) -
(3^x) +
:   f() values at end points not of opposite sign.


Try f(-2) and f(2) and you'll see the cause of the error message.
Define your equation as a function

f<- function(x) return(x*(3^x)*log(4)-x*log(4/3)-(3^x)+1)

and do

curve(f,from=-2,to=2)

curve(f,from=-.1,to=.1)

and draw your conclusions.

Try optimize instead.
...


You could also try package nleqslv (intended for solving equations).
But also try f(0)

Right. And a little calculus shows that that's the only minimum.

 -Peter


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.

Reply via email to