Hello,
Yes, it's FAQ 7.31 but it's not uniroot's fault.
The proper way of checking the result would be to call the function fun,
not to take the digits output by the print method and compute the
function's expression with them.
rui@rui:~$ R -q -f rhelp.R
fun <- function(x) {x^x -23}
#
Yes. This kind of issue is covered in any decent undergraduate course in
numerical methods... it is not specific to R. It is also related to FAQ 7.31.
https://en.m.wikipedia.org/wiki/Root-finding_algorithms
Colleagues,
I've been using uniroot to identify a root of an equation.
As a check, I always verify that calculated root.
This is where I need some help.
Consider the following script
fun <- function(x) {x^x -23}
# Clearly the root lies somewhere between 2.75 and 3.00
uniroot(fun, lower =
Thanks a lot - f was renamed FF and things are OK
BW
Troels
-Oprindelig meddelelse-
Fra: Berwin A Turlach
Sendt: 19. december 2018 10:27
Til: Troels Ring
Emne: Re: [R] uniroot problem
G'day Troels,
On Wed, 19 Dec 2018 10:03:09 +0100
"Troels Ring" wrote:
> Dear friend
Dear friends and helpers - in the script below, uniroot is called with a
function CHB that calls a function, Charge. On its own, CHB apparently does
what is expected, but from within uniroot, problems appear. An error is
thrown
Error in f(lower, ...) : could not find function "f"
So CHB is not
Many thanks Ellison
I have modified it as you suggested but I have this error message Error
in f(lower, ...) : unused argument(s) (N = 54)
I am not sure which arguments I have missed?
*y - function(t,n){
diff - 0.5
df1 - 2*n-2
ncp1 - sqrt((diff^2*n)/2)
p - 1- pt(t,df=df1)
test -
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
On Fri, Jun 22, 2012 at 4:00 PM, jeka12386 jeka12...@hotmail.co.uk wrote:
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
I have defined t at the beginning of my query.
I have added n on uniroot below and still getting the same error message
uniroot(integ,lower=0,upper=1000,n)
--
View this message in context:
http://r.789695.n4.nabble.com/Uniroot-error-message-with-in-intergration-tp4634247p4634264.html
Sent
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.
Because uniroot has a second parameter called 'interval' which overrides lower
and upper and you have
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
On 07-04-2012, at 19:48, jeka12386 wrote:
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
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 =
kchkchkch wrote
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 *
Heh. Yes,
Berend Hasselman wrote
Shouldn't the line with uniroot be (why try as function?)
sol = uniroot(fcn, lower = p1, upper = 1)
Before the line with for(i in 1:n) insert the following
fcn = function(p2) p1*f(p1) + (.20/5.66)*(exp(5.66*(p2 - p0)) -
exp(5.66*(p1 - p0))) + (1 -
kchkchkch wrote
Heh. Yes,
Berend Hasselman wrote
Shouldn't the line with uniroot be (why try as function?)
sol = uniroot(fcn, lower = p1, upper = 1)
Before the line with for(i in 1:n) insert the following
fcn = function(p2) p1*f(p1) + (.20/5.66)*(exp(5.66*(p2 - p0)) -
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 1 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
You should ask your instructor or teaching assistant for help. R-help
is not for doing homework.
Duncan Murdoch
On 06/05/2011 9:00 AM, CarJabo wrote:
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 1
sorry I am not asking someone to do my homework, as I have finished all the
procedure. I am just wondering why this technical error occurs, so I can fix
it myself.
By the way i don't have any instructor or teaching assistant for help, so
any suggestion for the error will be appreciated.
Thanks
On Fri, May 6, 2011 at 6:33 AM, CarJabo carly_...@hellokitty.com wrote:
sorry I am not asking someone to do my homework, as I have finished all the
procedure. I am just wondering why this technical error occurs, so I can fix
it myself.
My guess would be it has something to do with the random
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
On Sat, Apr 02, 2011 at 08:24:07AM -0400, ivo welch wrote:
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
Thanks for your advice. There was an error in the equation that is was
copying.
Doug
--
View this message in context:
http://r.789695.n4.nabble.com/uniroot-tp3260090p3264288.html
Sent from the R help mailing list archive at Nabble.com.
__
Hi,
I am using the uniroot function in order to carry out a bivariate Monte
Carlo simulation using the logistics model.
I have defined the function as:
BV.FV - function(x,y,a,A)
(((x^(-a^-1)+y^(-a^-1))^(a-1))*(y^(a-1/a))*(exp(-((1^(-a^-1)+y^(-a^-1))^a)+y^-1)))-A
and the procedure is as
dpender wrote:
Hi,
I am using the uniroot function in order to carry out a bivariate Monte
Carlo simulation using the logistics model.
I have defined the function as:
BV.FV - function(x,y,a,A)
(((x^(-a^-1)+y^(-a^-1))^(a-1))*(y^(a-1/a))*(exp(-((1^(-a^-1)+y^(-a^-1))^a)+y^-1)))-A
On Fri, Feb 04, 2011 at 04:35:00AM -0800, dpender wrote:
Hi,
I am using the uniroot function in order to carry out a bivariate Monte
Carlo simulation using the logistics model.
I have defined the function as:
BV.FV - function(x,y,a,A)
I looked at the descriptions for uniroot and optimize and they are somewhat
different but the book reference is the same and I am wondering if there are
reasons to pick one over the other?
Thank you.
Kevin
__
R-help@r-project.org mailing list
Well, there is a difference between finding a root, and finding a
minimum or a maximum. So you would use one or the other depending on
which you need to do.
-Don
At 7:00 PM -0800 11/19/09, rkevinbur...@charter.net wrote:
I looked at the descriptions for uniroot and optimize and they are
I have the following function for which I need to find the root of a:
f - function(R,a,c,q) sum((1 - (1-R)^a)^(1/a)) - c * q
To give context for the problem, this is a psychometric issue where R is
a vector denoting the percentage of students scoring correct on test
item i in class j, c is the
-help-boun...@r-project.org] On
Behalf Of Doran, Harold
Sent: Monday, March 16, 2009 10:34 AM
To: r-help@r-project.org
Subject: [R] Uniroot and Newton-Raphson Anomaly
I have the following function for which I need to find the root of a:
f - function(R,a,c,q) sum((1 - (1-R)^a)^(1/a)) - c * q
To give
Thanks for this reply. Here I was trying to calculate implied volatility
using BS formula. This is my code :
oo = 384.40 # traded option price
uu = 1563.25 # underlying price
tt = 0.656 # time to maturity in year
ii = 2.309/100 # interest rate, annualized
th.price = function(x)
Sorry, in my previous post I forgot to include strike price, which is K =
1160
megh wrote:
Thanks for this reply. Here I was trying to calculate implied volatility
using BS formula. This is my code :
oo = 384.40 # traded option price
uu = 1563.25 # underlying price
tt = 0.656
Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of megh
Sent: Monday, February 09, 2009 4:27 AM
To: r-help@r-project.org
Subject: Re: [R] uniroot() problem
Thanks for this reply. Here I was trying to calculate implied volatility
using BS formula
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
One can't tell for sure without seeing the function, but I'd guess
that you have a numerical issue. Here is an example to reflect upon:
f=function(x) (exp(x)-exp(50))*(exp(x)+exp(50))
uniroot(f,c(0,100))
$root
[1] 49.7
$f.root
[1] -1.640646e+39
$iter
[1] 4
$estim.prec
[1]
35 matches
Mail list logo