Displaying 20 results from an estimated 11000 matches similar to: "code for power and suffix for x,y labels in plot( )."
2010 May 01
1
Solving equation
Hello,
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.
2012 Mar 24
1
Solving the equation using uniroot
Hello all,
I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)!
for m when values of n and k are provided
n1<-c(10,13,18,30,60,100,500) # values of n
kx<-seq(1,7,1); # values of k
slv2<-lapply(n1,function(n){
slv1<-lapply(kx,function(k){
lhs<-function(m)
{
2011 Sep 11
3
(no subject)
Dear all,
Can anyone take a look at my program below?
There are two functions: f1 (lambda,z,p1) and f2(p1,cl, cu).
I fixed p1=0.15 for both functions. For any fixed value of lambda (between
0.01 and 0.99),
I solve f1(p1=0.15, lambda=lambda, z)=0 for the corresponding cl and cu
values.
Then I plug the calculated cl and cu back into the function f2.
Eventually, I want to find the lambda value
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.
2010 Jun 02
2
help in expression( )
Hi,
I was trying to have a graph whose axes are of the following type:
X axis: n and Y axis: var[U ((a,b) in suffix, and (n,d) in the power)].
U ((a,b) in suffix, and (n,d) in the power)- U^(n,d) _ (a,b).
Actually I require many plots involving different values of a,b,n,d, so need to keep this complicated notation.
The code I used:
plot(n, hn$h_pg,
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 Aug 20
1
handling recursion relation
Hi,
I wanted to compute the value of the function ifn at certain values of n. But I
am receiving the following error when I was using the following code(given at
the end).
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
I feel that since the function Grx is recursively related, perhaps making the
code too complicated too handle. Can anyone let me know if
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
2010 Aug 22
2
Recursion problem
Hi,
I wanted to compute the value of the function ifn at certain values of n. But I
am receiving the following error when I was using the following code(given at
the end).
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
I feel that since the function Grx is recursively related, perhaps making the
code too complicated too handle. Can anyone let me know if
2010 May 10
2
Warning message
Hello,
I want to draw a histogram of the mean of sample observations drawn from multivariate t distribution. I am getting the following error corresponding to the code I used. Though I am getting the graph, but I am curious to know the warning message.
Warning messages:
1: In if (freq) x$counts else { :
the condition has length > 1 and only the first element will be used
2: In if (!freq)
2010 Nov 09
6
Extending the accuracy of exp(1) in R
Hi,
I want to use a more accurate value of exp(1). The value given by R is
2.718282. I want a value which has more than 15 decimal places. Can anyone let
me know how can I increase the accuracy level.
Actually there are some large multipliers of exp(1) in my whole expression, and
I want a more accurate result at the last step of my program, and for that I
need to use highly accurate value
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 Jan 29
2
Name conflicts when passing arguments for one function to another
I am fairly new to R. I find it surprising that
f <- function(x,a) {x-a}
uniroot(f, c(0,1), a=.5)
works, but
integrate(f, 0, 1, a=.5)
gives an error: Error in integrate(f, 0, 1, a = 0.5) : argument 4
matches multiple formal arguments
What is the best way of avoiding such surprises? Is there a way of
telling integrate() that the 'a' argument is for f()?
If I wrote my own function
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
2011 Sep 03
3
question with uniroot function
Dear all,
I have the following problem with the uniroot function. I want to find
roots for the fucntion "Fp2" which is defined as below.
Fz <- function(z){0.8*pnorm(z)+p1*pnorm(z-u1)+(0.2-p1)*pnorm(z-u2)}
Fp <- function(t){(1-Fz(abs(qnorm(1-(t/2)))))+(Fz(-abs(qnorm(1-(t/2)))))}
Fp2 <- function(t) {Fp(t)-0.8*t/alpha}
th <- uniroot(Fp2, lower =0, upper =1,
2010 Sep 24
1
Solving equations involving gamma functions
Hi,
I want to find a value of n1. I used the following code but I am getting the
error -
Error in as.vector(x, mode) :
cannot coerce type 'closure' to vector of type 'any'
n=10
a_g<-(1/(n*(n-1)))*((pi/3)*(n+1)+(2*sqrt(3)*(n-2))-4*n+6)
a_s<-function(n1)
{
t1=(n1-1)/2;
(t1*(gamma(t1)/gamma(n1/2))^2)/2-1-a_g
}
xm<-solve(a_s)
Can anyone help me out. Thanks in
2011 May 25
1
plotting texas school district using shape files
Hi,
I was plotting or creating a map for Texas school districts using the shape file
of Texas. I could not find any other helpful mail in the mailing list.
txshp<-read.shape(system.file("S:\\Districts_10_11.shp", package="maptools"))
Error- read.shape no found. But read.shape is there in maptools.
If anyone can help me out it will be great. Thanks in advance.
Shant
2008 Apr 12
1
R and Excel disagreement - Goal Seek versus uniroot
Dear friends - occurring in Windows R2.6.2
I am modeling physical chemistry in collaboration with a friend who has
preferred working in Excel. I used uniroot, and find a solution to a two
buffer problem in acid-base chemistry which I believe is physiologically
sensible. Using "goal seek" in Excel my friend found another plausible
root, quite close to zero, and a plot of the function
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
2017 Dec 25
3
plot representation of calculated value known to be 7.4
Dear friends - merry Christmas and thanks a lot for much help during the
year!
In the example below I fail to understand how the calculated value pH is
represented in a simple plot - also included. The calculations are
useful in practice and likely to be right in principle but I cannot see
how this occurs: why a calculated value of 7.4 known as numeric is not
simply plotted as such. It