Matlab and Mathematica can't do this integration

Click For Summary

Discussion Overview

The discussion revolves around the challenges of integrating a probability density function (PDF) derived from a bivariate normal distribution transformed into polar coordinates. Participants explore the difficulties in obtaining a closed form for the integral and the implications for calculating the cumulative distribution function (CDF) and statistical properties such as mean and variance.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents a complex PDF and seeks assistance with its integration, noting that both MATLAB and Mathematica fail to provide a solution.
  • Another participant questions the variable of integration, clarifying that the integration is with respect to theta, not z.
  • There is a suggestion to change the order of integration to potentially simplify the problem, although the original poster reports unsuccessful attempts with this approach.
  • Participants discuss the lack of a closed form for the integrals involved, with one asserting that both the integrals with respect to theta and z do not yield closed forms.
  • One participant proposes rescaling the random variables to simplify the problem, but the original poster indicates this would lead to a different distribution that is not applicable to their case.
  • Another participant mentions that the integration with respect to z could yield results in terms of the error function, but the original poster expresses frustration over the subsequent integration with respect to theta.
  • There is a discussion about the transformation to polar coordinates and its implications for the CDF versus PDF, with some participants questioning the necessity of this transformation.
  • One participant suggests that if the goal is to find the mean and variance, it may be more efficient to numerically evaluate these statistics directly rather than attempting to derive the distribution over z.
  • Another participant mentions alternatives like quadrature or simulation for obtaining numeric values if a closed form is unattainable.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and effectiveness of transforming to polar coordinates, as well as the feasibility of obtaining closed forms for the integrals. The discussion remains unresolved, with multiple competing approaches and no consensus on the best method to proceed.

Contextual Notes

Limitations include the complexity of the integrand and the dependence on the specific values of the parameters involved, which may affect the ability to derive closed forms. The discussion also highlights the challenges of numerical integration in this context.

ay0034
Messages
11
Reaction score
0
Hello,

While doing a research, I obtained the following PDF:



f_{Z}(z)=\frac{1}{2\pi\sigma^{2}_{1}\sigma^{2}_{2}}e^{-\frac{1}{2} ( \frac{\mu^{2}_{1}}{\sigma^{2}_{1}} + \frac{\mu^{2}_{2}}{\sigma^{2}_{2}})}\int^{2\pi}_{0}ze^{-\frac{1}{2\sigma^{2}_{1}\sigma^{2}_{2}}\{ \sigma^{2}_{2}z^{2}cos^{2}\theta+ \sigma^{2}_{1}z^{2}sin^{2}\theta-2\sigma^{2}_{2}\mu_{1}zcos\theta-2\sigma^{2}_{1}\mu_{2}zsin\theta \} }



This integral won't be in a closed form. In addition to that, I have to integrate this PDF to get a CDF. Since this PDF is what I calculated, I want to check the CDF is going to be 1 as z goes to infinity.

However, both MATLAB and mathematica cannot integrate this PDF. Please help me with this annoying integration.

I appreciated it in advance.
 
Physics news on Phys.org
mu's and sigma's can be any number. And in this case, mu1 and mu2 are different, and sig1 and sig2 are different as well.
 
With respect to which variable is the integration to be performed? dz ?, d\theta ?
 
If your interest is only \int_{-\infty}^{\infty} f_Z(z) dz have you tried changing the order of integration?

Let h(z,\theta) = the messy function you are dealing with.

Taking some liberties with limits and the order of integration, which you would need to justify, we have:

\int_{-\infty}^{\infty} f_Z(z)dz = \lim_{a \rightarrow \infty} \int_{-a}^{a} f_Z(z) dz

= \lim_{a \rightarrow \infty} \int_{-a}^{a} \int_{0}^{2\pi} h(z,\theta) d\theta\ dz

= \int_{0}^{2\pi} \left( \lim_{a \rightarrow \infty} \int_{-a}^{a} h(z,\theta)\ dz \right) \ d\theta
 
Oh i forgot to put that. It's dtheta, not dz.

And I have tried what you are talking about, and I got no good results. Since the integration does not have a closed form, replacing it with a and using limit function was not helpful.
 
ay0034 said:
Since the integration does not have a closed form.

Which integration does not have a closed form?
\int z e^{C_1 z^2 + C_2 z} dz ?
 
Both of them. With respect to theta and with respect to z.
 
In the problem you are working, can you rescale the random variables so that the means of the rescaled variables are 0 and their standard deviations are 1 ?
 
Unfortunately, I can't. If so, my PDF would be a Rayleigh distribution and I can take advantage of existing information out there. That is my problem.
 
  • #10
wrt z you could get the answer in terms of the error-function, if you want that.
 
  • #11
You're right. The thing is I have to integrate that error function with respect to theta. I almost gave up to do this double integration, and am trying to calculate mean and variance. But without a closed form PDF, that looks impossible as well.
 
  • #12
I'm trying to relate this problem to your thread on "Chi or Rayleigh or Ricean?". It looks like you are transforming to polar coordinates by X = z cos(theta) , Y = z sin(theta). Does the z in front of the exponential come from the volume element for polar coordinate integration? If so, isn't this calculation for a CDF rather than a PDF ? (I'm just guessing about your intentions.)
 
  • #13
Yes, the PDF I wrote down is already transformed to a polar coordinates. And z you referred to came from the fact that dxdy is transformed to r*drd\theta.

As you know, this is kind of a function of r.v., I began with a CDF, transformed it to a polar coordinates, and took derivative of the CDF with respect to z so I get a PDF.

Matlab can numerically calculate values of PDF at each point, but cannot integrate it numerically nor symbolically.
 
  • #14
As far as I can see, your integrand is only the product of two normal distributions over x and y, i.e. a bivariate normal distribution with zero covariance. Why do you want to express this in polar coordinates? The integral from from z=0 to infinity will indeed be equal to one, of course very easily demonstrated in cartesian coordinates.

If you absolutely want to express it in polar coordinates, the expression will be quite simple (with simple analytical expressions for the primitive functions of integrals) if you set mu_1 and mu_2 as the centre of your polar coordinates.
 
  • #16
ay0034 said:
...am trying to calculate mean and variance. But without a closed form PDF, that looks impossible as well.

Are you only after the mean and variance? In that case, I would not bother trying to calculate the distribution over Z, but just numerically evaluate the mean and variance of Z by integrating over X and Y (will work fine for any values of means and variances of the two normal distributions)
 
  • #17
I didn't check the integrand, but if it does not have a closed form, and you want a numeric value then your alternatives are quadrature or simulation. The integral is one-dimensional? then Quadrature should work fine.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K