[R] double integral with C

2007-01-24 Thread Stefano
Hi all,
This is more a C querie rather than a R one:
I'm writing a C code passing a function F to adapt fortran subroutine. I
need to integrate over two variables of F, call them x1 and x2. Then I
call the C code in R to optimize the integrated F function.
for example F could be defined as
---
static double marg_like(const double *param,
double x1,
double x2){...}
---
Then I integrate over x1 and x2 with
-
F77_CALL(adapt)(2,(-5,-5),(5,5),100,1700,F,0.01,1)
-

So here my question: I should I define x1 and x2? For the time being I
defined them as static variables, i.e.
static double x1;
static double x2;

but I'm pretty sure this is wrong

Any hint?
thanks in advance
Stefano

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Double integral

2006-09-22 Thread Caio Lucidius Naberezny Azevedo
Hi all,
   
  I need to solve double integrals with no closed solution. Calling x and y the 
two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, given 
a joint funcion g(x,y), I need evaluate the integral of this function under 
that random structure. Could anyone suggest me a package or even a suitable 
method to solve this problem?
   
   
  Thanks all,
   
  Caio


-
 VocĂȘ quer respostas para suas perguntas? Ou vocĂȘ sabe muito e quer 
compartilhar seu conhecimento? Experimente o Yahoo! Respostas!
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Double integral

2006-09-22 Thread Caio Lucidius Naberezny Azevedo
Hi all,
   
  I need to solve double integrals with no closed solution. Calling x and y the 
two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, given 
a joint funcion g(x,y), I need evaluate the integral of this function under 
that random structure. Could anyone suggest me a package or even a suitable 
method to solve this problem?
   
   
  Thanks all,
   
  Caio


-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Double integral

2006-09-22 Thread Sundar Dorai-Raj

Caio Lucidius Naberezny Azevedo said the following on 9/22/2006 4:40 PM:
 Hi all,

   I need to solve double integrals with no closed solution. Calling x and y 
 the two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, 
 given a joint funcion g(x,y), I need evaluate the integral of this function 
 under that random structure. Could anyone suggest me a package or even a 
 suitable method to solve this problem?


   Thanks all,

   Caio
 
   
 -
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

Have you tried

RSiteSearch(double integral)

as the posting guide suggests?

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] double integral

2006-05-05 Thread Dominique Katshunga
Dear r-users,
Is there any command in R allowing to evaluate a double integral? for
instance let say I want to evaluate the following integral:
integrate[lo=(0,1),up=(2,3)] f(x,y)=x^2+y^2
where lo is the vector of lower bounds and up that of upper bounds.
I thaught the function adapt would work but it did not.
Many thanks,
Dominique K.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] double integral

2006-05-05 Thread Gabor Grothendieck
Try RSiteSearch(double integral)


On 5/5/06, Dominique Katshunga [EMAIL PROTECTED] wrote:
 Dear r-users,
 Is there any command in R allowing to evaluate a double integral? for
 instance let say I want to evaluate the following integral:
 integrate[lo=(0,1),up=(2,3)] f(x,y)=x^2+y^2
 where lo is the vector of lower bounds and up that of upper bounds.
 I thaught the function adapt would work but it did not.
 Many thanks,
 Dominique K.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] double integral

2006-05-05 Thread Thomas Lumley
On Fri, 5 May 2006, Dominique Katshunga wrote:

 Dear r-users,
 Is there any command in R allowing to evaluate a double integral? for
 instance let say I want to evaluate the following integral:
 integrate[lo=(0,1),up=(2,3)] f(x,y)=x^2+y^2
 where lo is the vector of lower bounds and up that of upper bounds.
 I thaught the function adapt would work but it did not.

Works for me:

 library(adapt)
 help(adapt)
 adapt(2,c(0,2),c(1,3),functn=function(xy) xy[1]^2+xy[2]^2)
value   relerr   minpts   lenwrkifail
 6.67 7.315578e-08  165   730


-thomas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html