Displaying 20 results from an estimated 1100 matches similar to: "uniroot violates bounds?"
2023 Feb 20
1
uniroot violates bounds?
Le 18/02/2023 ? 21:44, J C Nash a ?crit?:
> I wrote first cut at unirootR for Martin M and he revised and put in
> Rmpfr.
>
> The following extends Ben's example, but adds the unirootR with trace
> output.
>
> c1 <- 4469.822
> c2 <- 572.3413
> f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1))
> uniroot(f, c(1e-6, 1))
> library(Rmpfr)
>
2023 Feb 18
0
uniroot violates bounds?
c1 <- 4469.822
c2 <- 572.3413
f <- function(x) { c1/x - c2/(1-x) }; uniroot(f, c(1e-6, 1))
uniroot(f, c(1e-6, 1))
provides a root at -6.00e-05, which is outside of the specified
bounds. The default value of the "extendInt" argument to uniroot() is
"no", as far as I can see ...
$root
[1] -6.003516e-05
$f.root
[1] -74453981
$iter
[1] 1
$init.it
[1] NA
2018 Jul 30
2
trace in uniroot() ?
In looking at rootfinding for the histoRicalg project (see gitlab.com/nashjc/histoRicalg),
I thought I would check how uniroot() solves some problems. The following short example
ff <- function(x){ exp(0.5*x) - 2 }
ff(2)
ff(1)
uniroot(ff, 0, 10)
uniroot(ff, c(0, 10), trace=1)
uniroot(ff, c(0, 10), trace=TRUE)
shows that the trace parameter, as described in the Rd file, does not seem to
be
2018 Aug 13
1
trace in uniroot() ?
Despite my years with R, I didn't know about trace(). Thanks.
However, my decades in the minimization and root finding game make me like having
a trace that gives some info on the operation, the argument and the current function value.
I've usually found glitches are a result of things like >= rather than > in tests etc., and
knowing what was done is the quickest way to get there.
2018 Aug 13
0
trace in uniroot() ?
I tend to avoid the the trace/verbose arguments for the various root
finders and optimizers and instead use the trace function or otherwise
modify the function handed to the operator. You can print or plot the
arguments or save them. E.g.,
> trace(ff, print=FALSE, quote(cat("x=", deparse(x), "\n", sep="")))
[1] "ff"
> ff0 <- uniroot(ff, c(0, 10))
2011 Apr 03
1
How do I modify uniroot function to return .0001 if error ?
I am calling the uniroot function from inside another function using these
lines (last two lines of the function) :
d <- uniroot(k, c(.001, 250), tol=.05)
return(d$root)
The problem is that on occasion there's a problem with the values I'm
passing to uniroot. In those instances uniroot stops and sends a message
that it can't calculate the root because f.upper * f.lower is greater
2012 Nov 01
1
What does uniroot return when an error occurs
Hi,
I'm using the uniroot function, and would like to detect an error which
occurs, for instance, when the values at endpoints are not of opposite
signs. For example:
uniroot( function(x) x^2+1, lower=1, upper=2 ).
I want to say something like:
if "error in uniroot(...)" return NA else return uniroot$root
Thanks a lot!
Asaf
--
View this message in context:
2020 Oct 06
0
Solving a simple linear equation using uniroot give error object 'x' not found
On 06/10/2020 11:00 a.m., Sorkin, John wrote:
> Colleagues,
> I am trying to learn to use uniroot to solve a simple linear equation. I define the function, prove the function and a call to the function works. When I try to use uniroot to solve the equation I get an error message,
> Error in yfu n(x,10,20) : object 'x' not found.
>
> I hope someone can tell we how I can fix
2011 Apr 02
1
uniroot speed and vectorization?
curiosity---given that vector operations are so much faster than
scalar operations, would it make sense to make uniroot vectorized? if
I read the uniroot docs correctly, uniroot() calls an external C
routine which seems to be a scalar function. that must be slow. I am
thinking a vectorized version would be useful for an example such as
of <- function(x,a) ( log(x)+x+a )
uniroot( of, c(
1999 Apr 23
1
[S] uniroot -- doesn't work recursively
Dear Prof Azzalini,
You have an interesting example of recursive use of uniroot().
[re-cited at the end]
However, note that R currently has the same problem as S-plus:
Uniroot() doesn't work reliably, recursively.
When you found it to be better, you were just lucky.
The relevant file in R's source, src/main/optimize.c
says
/* WARNING : As things stand, these routines should
2012 Apr 07
1
Uniroot error
Dear All
I am trying to find a uniroot of a function within another function (see
example) but I am getting an error message (f()values at end points not of
opposite sign). I was wondering if you would be able to advise how redefine
my function so that I can find the solution. In short my first function
calculates the intergrale which is function of "t" , I need to find the
uniroot of
2011 May 06
1
Uniroot - error
Hi,
I have tried to use uniroot to solve a value (value a in my function) that
gives f=0, and I repeat this process for 10000 times(stimulations). However
error occures from the 4625th stimulation - Error in uniroot(f, c(0, 2),
maxiter = 1000, tol = 0.001) :
f() values at end points not of opposite sign
I have also tried interval of (lower=min(U), upper=max(U)) and it won't work
as well.
2011 Dec 14
1
uniroot function question
I have one equation, two unknowns, so I am trying to build the solution set
by running through possible values for one unknown, and then using uniroot
to solve for the accompanying second solution, then graphing the two
vectors.
p0 = .36
f = function(x) 0.29 * exp(5.66*(x - p0))
f.integral = integrate(f, p0, 1)
p1 = p0 + .01
i = 1
n = (1 - p0)/.01
p1.vector = rep(0,n)
p2.vector = rep(0,n)
for (i
2007 Mar 29
1
ansari.test.default: bug in call to uniroot?
A recent message on ansari.test() prompted me to play with the examples. This
doesn't work for me in R version 2.4.1
R> ansari.test(rnorm(100), rnorm(100, 0, 2), conf.int = TRUE)
Error in uniroot(ab, srange, tol = 1e-04, zq = qnorm(alpha/2, lower = FALSE)) :
object "ab" not found
It looks like there's a small typo in ccia() inside
ansari.test.default() in which
2005 Jun 30
0
vecortizing uniroot() for numerical solutions
# Hi All,
#
# I need to solve a somewhat complex equation at many parameter
values for
# a number of different parameters.
# A simplified version of the equation is: 0= (d1/(h1^2))-(h2*(d2^2))
# I'd like to solve it across a parameter space of d1 and d2, holding
# h1 and h2 constant.
# It seems that uniroot() can do it, but I don't see how to
vectorize it.
#
2006 Jul 29
1
uniroot
Hello,
I am struggling to find the root of a exponent
function.
"uniroot" is complaining about a values at end points
not of opposite sign?
s<- sapply(1:length(w),function(i)
+ {
+
+ +
+
+
uniroot(saeqn,lower=-5000,upper=0.01036597923,l=list(t=w[i],gp=gp))$root
+ })
Error in uniroot(saeqn, lower = -5000, upper =
0.01036597923, l = list(t = w[i], :
f() values at
2013 May 30
2
RFC: a "safe" uniroot() function for future R
With main R releases only happening yearly in spring, now is
good time to consider *and* discuss new features for what we
often call "R-devel" and more officially is
R Under development (unstable) (.....) -- "Unsuffered Consequences"
Here is one such example I hereby expose to public scrutiny:
A few minutes ago, I've committed the following to R-devel
(the
2008 Dec 31
1
uniroot() problem
I have a strange problem with uniroot() function. Here is the result :
> uniroot(th, c(-20, 20))
$root
[1] 4.216521e-05
$f.root
[1] 16.66423
$iter
[1] 27
$estim.prec
[1] 6.103516e-05
Pls forgive for not reproducing whole code, here my question is how "f.root"
can be 16.66423? As it is finding root of a function, it must be near Zero.
Am I missing something?
--
View this message
2012 Jun 22
4
Uniroot error message with in intergration
Dear all
I am trying to calculate the value of n using uniroot. Here is the message
I am having:
<<<
Error in uniroot(integ, lower = 0, upper = 1000, n) :
'interval' must be a vector of length 2 >>>
Please would you be able to give me an indication on why I am having this
error message.
Many thanks
EXAMPLE BELOW:
## t = statistics test from t -distribution
2007 Jan 31
2
what is the purpose of an error message in uniroot?
Hi all,
This is probably a blindingly obvious question: Why does it matter in
the uniroot function whether the f() values at the end points that you
supply are of the same sign?
For example:
f <- function(x,y) {y-x^2+1}
#this gives a warning
uniroot(f,interval=c(-5,5),y=0)
Error in uniroot(f, interval=c(-5, 5), y = 0) : f() values at end
points not of opposite sign
#this doesn't give a