Displaying 20 results from an estimated 3000 matches similar to: "Integral implicit function"
2012 Apr 24
2
Some Help Needed
Dear all,
I need to do some calculation where the code used are below. I get
error message when I choose k to be large, say greater than 25.
The error message is
"Error in integrate(temp, lower = 0, upper = 1, k, x, rho, m) :
the integral is probably divergent".
Can anyone give some help on resolving this. Thanks.
Hannah
m <- 100
alpha <- 0.05
rho <- 0.1
F0
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
2011 Jun 06
2
Taking Integral and Optimization using Integrate, Optim and maxNR
Dear All, Hello!
I have some questoins in R programming as follows:
Question 1- How to take the integral of this function with respect to y, such that x would appear in the output after taking integral.
f(x,y)=(0.1766*exp(-exp(y+lnx))*-exp(y+lnx))/(1-exp(-exp(y+lnx))) y in (-6.907,-1.246)
It is doable in maple but not in R. At least I could not find the way.
p.s: result from maple is:
2013 Apr 09
1
Solving an integral in R gives the error “The integral is probably divergent”
I am trying to solve an integral in R. However, I am getting an error when
I am trying to solve for that integral.
The equation that I am trying to solve is as follows:
$$ C_m = \frac{{abs{x}}e^{2x}}{\pi^{1/2}}\int_0^t t^{-3/2}e^{-x^2/t-t}dt $$
[image: enter image description here]
The code that I am using is as follows:
a <- seq(from=-10, by=0.5,length=100)
## Create a function to compute
2011 Nov 14
2
how to include integrate in a function that can be solved with uniroot?
Hallo,
I am trying to define expectation as an integral
and use uniroot to find the distribution parameter
for a given expectation.
However I fail to understand how to define properly
the functions involved and pass the parameters correctly.
Can anyone help me out?
Thanks,
Gerrit Draisma.
This what I tried:
=======
> # exponential density
> g <- function(x,lambda){ lambda
2005 Mar 09
3
problem using uniroot with integrate
Hi,
I'm trying to calculate the value of the variable, dp, below, in the
argument to the integral of dnorm(x-dp) * pnorm(x)^(m-1). This
corresponds to the estimate of the sensitivity of an observer in an
m-alternative forced choice experiment, given the probability of
a correct response, Pc, a Gaussian assumption for the noise and
no bias. The function that I wrote below gives me an error:
2010 Jul 19
2
integral in R
Hello All,
I have to create a variable that is a function of another one (already
created), its cumulative distribution function and the integral of this
cumulative distribution, with limits: 0 and the value of the variable.
To be clear, I have the variable called “cip”. And its cdf called “cdfcip”
I need to create the variable:
bip = cip + ((1 – cdfcip)^4)*integral((1-cdf(u))^4*du, 0, value
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
2010 Dec 15
5
Solution to differential equation
Hello,
I am trying to find the analytical solution to this differential equation
dR/dt = k1*(R^k2)*(1-(R/Rmax)); R(0) = Ro
k1 and k2 are parameters that need to fitted, while Ro and Rmax are the
baseline and max value (which can be fitted or fixed). The response (R)
increases
initially at an exponential rate governed by the rate constants k1 and k2.
Response has a S-shaped curve as a function
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
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
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
4
Solving a simple linear equation using uniroot give error object 'x' not found
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 the problem
2002 Mar 22
0
sequential t-test - replies
[my original message to s-news & r-help is attached ]
No one possessed or knew of any S/R code for the sequential t-test. Also
it doesn't appear in the SAS index.
One or two suggested obtaining the S+ seqtrial software which may (or may
not) cover this, but this seemed to be a bit of a "hammer to crack a nut".
I have written a function based on the treatment in Wetheril
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
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
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.
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(
2018 Mar 23
1
Integrate erros on certain functions
In the help for ?integrate:
>When integrating over infinite intervals do so explicitly, rather than
just using a large number as the endpoint. This increases the chance of a
correct answer ? any function whose integral over an infinite interval is
finite must be near zero for most of that interval.
I understand that and there are examples such as:
## a slowly-convergent integral
integrand
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