Re: [R] integrate and quadratic forms

From: rdporto1 <rdporto1_at_terra.com.br>
Date: Fri 19 Jan 2007 - 16:30:47 GMT


Thanks Jim. But a narrower problem still remains. Please, look at this new code:

lambda=c(.6,.3)
integral = function(u) {
  theta = (atan(.6*u) + atan(.3*u))/2 - .1*u/2   rho = (1+.6^2*u^2)^(1/4) * (1+.3^2*u^2)^(1/4)   integrand = sin(theta)/(u*rho)
}

> integrate(integral,0,Inf)$value

[1] 1.222688

If I replace
  theta = sum(atan(lambda*u))/2 - .1*u/2 I get
> integrate(integral,0,Inf)$value

[1] 1.517134

It seems there is a problem between the sum() and integrate() functions.

Is there a way to solve this problem?

Thanks in advance.

Rogerio.

> They do give the same answer, unfortunately the examples you sent were not
> the same. Integral2 was missing a 'sin'. So I would assume there might be
> something else wrong with your functions. You might want to try breaking it
> down into smaller steps so you can see what you are doing. It definitely is
> hard to read in both cases.
>
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?



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. Received on Sat Jan 20 03:48:24 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 Jan 2007 - 17:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.