Displaying 20 results from an estimated 24 matches for "pracma".
2023 Nov 09
1
Dependency errors for package pracma
I tried to update my package {pracma} on CRAN from 2.4.2 (2022-09-21)
to version 2.4.4 (2023-11-08). This package reverse depends / imports
/ suggests on 350 packages on CRAN and 25 packages on Bioconductor.
The only changes are small corrections on some help files, a new
function for stereographic projection, and `gcd` and `Lcm` req...
2023 Nov 09
1
Dependency errors for package pracma
What really interests me:
With all those strict checking procedures, how is it possible that the
new 'Matrix' version got accepted on CRAN?
I think this happened twice to me before, and it takes a lot of time
to check package dependencies that turn out to be not dependent --
more time than checking dependencies that are real.
2013 Feb 15
1
minimizing a numerical integration
Dear all,
I am a new user to R and I am using pracma and nloptr libraries to minimize
a numerical integration subject to a single constraint . The integrand
itself is somehow a complicated function of x and y that is computed
through several steps. i formulated the integrand in a separate function
called f which is a function of x &y. I want to...
2012 Dec 31
2
code to convert 3D geographical coordinates to Cartesian?
Is there packaged code to convert geographical coordinates (e.g.,
longitude, latitude, elevation) to Cartesian coordinates in 3-space?
I can see how to do this using
1. a spherical-to-Cartesian conversion like pracma::sph2cart(tpr)
http://cran.r-project.org/web/packages/pracma/
2. a geographical-to-spherical conversion. This seems to involve (in
roughly increasing order of difficulty or error-prone-ness)
* converting longitude (units=?) to an azimuthal angle (units=rad)
* converting latitude (units=?) t...
2012 Jan 27
3
Numerical instability in new R Windows development version
I have a question concerning the new Windows toolchain for R >= 2.14.2.
When trying out my package 'pracma' on the win-builder development version
it will stop with the following error message:
> f3 <- function(x, y) sqrt((1 - (x^2 + y^2)) * (x^2 + y^2 <= 1))
> dblquad(f3, -1, 1, -1, 1) # 2.094395124 , i.e. 2/3*pi , err = 2e-8
Warning in sqrt((1 - (x^2 + y^2)) * (x^2 + y^2 &...
2012 May 09
2
problem with Gauss Hermite ( x and w )
Hi all,
I am using the 'gaussHermite' function from the 'pracma' library
############ CODES ###########
library(pracma)
cc=gaussHermite(10)
cc$x^2
cc$x^5
cc$x^4
############ CODES ###########
as far so good. However, it does NOT work for any NON integer values, say
############ CODES ###########
cc$x^(2.5)
cc$x^(-2.5)
############ CODES ###########
But...
2012 Mar 23
3
R numerical integration
Hi all,
Is there any other packages to do numerical integration other than the
default 'integrate'?
Basically, I am integrating:
integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
The integration is ok provided sigma is >0.
However, when mu=-1.645074 and sigma=17535.26
It stopped working. On the other hand, Maple gives me a value of
0.5005299403.
It is an
2012 Apr 02
2
Error in gamma(delta + (complex(0, 0, 1) * (x - mu))/alpha) : unimplemented complex function
I am trying to obtain the grafic of a pdf . but this error keeps showing .
Here is the code
MXN.fd = function(x,alpha,beta,mu,delta)
{
A = (2*cos(beta/2))^(2*delta)
B = 2*alpha*pi*gamma(2*delta)
C = (beta*(x-mu))/alpha
D = abs(gamma(delta + (complex(0,0,1)*(x-mu))/alpha)^2)
M = A/B*exp(C)*D
M
plot(x,M,type="l",lwd=2,col="red")
}
alpha = 0.02612297
beta = -0.50801886
mu =
2013 Jul 17
2
Using RasterBricks
...ll of the rasterfinal will have the AREA UNDER CURVE formed by the
values in each cell of the three original rasters.
For example:
s[4] has the values: 4,8,12
y<-s[4];
x<-0:2;
You can see the AUC in this graph:
plot(x,y, type='l')
And calculate it using the function trapz (package:pracma)
library(pracma)
trapz(x,y)
#################################################################################
My idea was to use 'stackApply':
FINAL<-stackApply(s,1,myFUN)
with:
myFUN=function(y)
{
x<-1:length(y)
trapz(x,y)
}
It doesn´t work. What I am doing wrong??
Many thanks,...
2023 Aug 13
4
Noisy objective functions
...eldermead ucminf optim_BFGS
---------------------------------------------------
1 0.21 0.32 0.13 0.00 0.00
3 0.52 0.63 0.50 0.00 0.00
10 0.81 0.91 0.87 0.00 0.00
Solvers: nmk = dfoptim::nmk, anms = pracma::anms [both Nelder-Mead codes]
neldermead = nloptr::neldermead,
ucminf = ucminf::ucminf, optim_BFGS = optim with method "BFGS"
Read the table as follows: `nmk` will be successful in 21% of the
trials, while for example `optim` will never come close to the true
minimum....
2024 Feb 24
1
Clustering Functions used by Reverse-Dependencies
...ed an issue on GitHub and would like to collect any ideas:
https://github.com/discoleo/PackageBrowser/issues/1
There are some model packages that could be used to test the clustering:
1) Rcpp, xml: the core-functionality will always be needed; splitting into modules may not be possible/useful;
2) pracma: most reverse-dependencies are likely using only a small subset of the functions in pracma;
(there was some discussion on R-package-devel about reverse dependencies a few weeks ago)
3) survival: I have no idea in which category it falls - but it has a lot of reverse-dependencies;
Note:
I missed s...
2013 Feb 18
2
error: Error in if (is.na(f0$objective)) { : argument is of length zero
...4 hours
and then i got the following errors:
Error in if (is.na(f0$objective)) { : argument is of length zero
In addition: Warning message:
In is.na(f0$objective) :
is.na() applied to non-(list or vector) of type 'NULL'
Here is the syntax itself:
library('nloptr')
library('pracma')
# objective function
f <- function(x,s) {m<-100
t<-2*m+1
H<-matrix(data=NA,nrow=t,ncol=t)
I<-diag(t)
delta<-2*x[1]/t
z<--x[1]+.5*delta
range1<-t
for (i in 1:range1){
z_i=-x[1]+(i-.5)*delta
for (j in 1:range1){
up<-(((-x[1]+j*delta-(1-x[2])*z_i)/x[2]))-...
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
Dear list,
[cross-posting from Stack Overflow where this question has remained
unanswered for two weeks]
I'd like to perform a numerical integration in one dimension,
I = int_a^b f(x) dx
where the integrand f: x in IR -> f(x) in IR^p is vector-valued.
integrate() only allows scalar integrands, thus I would need to call
it many (p=200 typically) times, which sounds suboptimal. The
2011 Nov 22
5
x, y for point of intersection
Hi everyone,
?
I am trying to get a point of intersection between a
polyline and a straight line ?.. and get the x and y coordinates of this point.
For exemplification consider this:
?
?
set.seed(123)
?
k1 <-rnorm(100, mean=1.77, sd=3.33)
?k1 <- sort(k1)
q1 <- rnorm(100, mean=2.37, sd=0.74)
q1 <- sort(q1, decreasing = TRUE)
plot(k1, q1, xlim <- c((min(k1)-5),
2011 Nov 03
1
Question about Calculation of Cross Product
The function of crossprod in R puzzled me.
I would like to calculate the cross product of two vectors. According to my text book, it defines like this:
a = (ax, ay, az)
b = (bx, by, bz)
then, the cross product of a and b is:
a X b = (ay*bz-az*by, az*bx-ax*bz, ax*by-ay*bz)
It can also write in a determinant format.
But the crossprod or tcrossprod function in R appeared not calculate the cross
2012 Jan 07
1
k-means++
Hi everyone -
I know that R is capable of clustering using the k-means algorithm, but can
R do k-means++ clustering as well?
Thanks,
--
Dr. Ferebee Tunno
Assistant Professor
Department of Mathematics and Statistics
Arkansas State University
P.O. Box 70
State University, AR. 72467
ftunno@astate.edu
(870) 329-7710
[[alternative HTML version deleted]]
2012 Apr 18
0
Numerical integration again
Hi all,
Here is an integration function
require(pracma) # for 'quadinf'
myint=function(j) {
quadinf(function(x)
(1/(1+exp(-x)))^j*(1-1/(1+exp(-x)))^(k-j)*dnorm(x,mu,casigma),-Inf,Inf)
}
in any optimization routine. It works fine most of the time but failed with
some particular sets of values, say one of the following:
k=20
mu=-1.97829...
2013 Feb 27
0
A program running for a too long time
...e period but with a message " maximum number of
iterations in romberg has been reached". I need to :
1- make changes in my code so that it gives me ouput in a short time
keeping the value of m at 100.
2-increase the number of iterations in romberg.
library('nloptr')
library('pracma')
f <- function(x,y) {m<-100
t<-2*m+1
H<-matrix(data=NA,nrow=t,ncol=t)
I<-diag(t)
delta<-2*x[1]/t
z<--x[1]+.5*delta
range1<-t
for (i in 1:range1){
z_i=-x[1]+(i-.5)*delta
for (j in 1:range1){
up<-(((-x[1]+j*delta-(1-x[2])*z_i)/x[2]))-y
down...
2013 Feb 16
3
two dimensional integration
Dear R-users,
I'm wondering how to calculate this double integral in R:
int_a^b int_c^y g(x, y) dx dy
where g(x,y) = exp(- alpha (y - x)) * b
Thanks for answering!
Cheers,
Alui
[[alternative HTML version deleted]]
2011 Dec 31
4
Base function for flipping matrices
Hi all,
Are there base functions that do the equivalent of this?
fliptb <- function(x) x[nrow(x):1, ]
fliplr <- function(x) x[, nrow(x):1]
Obviously not hard to implement (although it needs some more checks),
just wondering if it had already been implemented.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/