How to Numerically Solve a Multiple Integral in Mathematica or Sage?

In summary, the conversation discusses trying to solve a multiple integral involving a potential that depends on positions and velocities. The goal is to calculate the second virial coefficient for a system of particles moving inside a square. The variables and constants involved in the equations are specified, but more context is needed for a complete understanding. The suggested approach is to use iterative methods with Mathematica or Sage software, or to look for a function designed for handling nested integrals. The missing information includes the bounds of integration and how to evaluate certain variables without numeric expressions.
  • #1
Korbid
17
0
I'm trying to solve numerically this multiple integral. But i don't know how to calculate it with Mathamtica or Sage software.

$$\int{e^{-(\vec{v}^2_1+\vec{v}^2_2)}e^{-E(\tau)}}d\vec{r}_1d\vec{r}_2d\vec{v}_1d\vec{v}_2$$
$$E(\tau)=\frac{k}{\tau^2}e^{-\tau/\tau_0}$$
$$\tau(\vec{r}_{12};\vec{v}_{12})=\frac{b-\sqrt{b^2-ac}}{a}$$
$$a=||\vec{v}_{12}||$$
$$b=\vec{r}_{12}\cdot\vec{v}_{12}$$
$$c=||\vec{r}_{12}|| - (2R)^2$$

Thank you!
 
Physics news on Phys.org
  • #2
Korbid said:
I'm trying to solve numerically this multiple integral. But i don't know how to calculate it with Mathamtica or Sage software.

$$\int{e^{-(\vec{v}^2_1+\vec{v}^2_2)}e^{-E(\tau)}}d\vec{r}_1d\vec{r}_2d\vec{v}_1d\vec{v}_2$$
$$E(\tau)=\frac{k}{\tau^2}e^{-\tau/\tau_0}$$
$$\tau(\vec{r}_{12};\vec{v}_{12})=\frac{b-\sqrt{b^2-ac}}{a}$$
$$a=||\vec{v}_{12}||$$
$$b=\vec{r}_{12}\cdot\vec{v}_{12}$$
$$c=||\vec{r}_{12}|| - (2R)^2$$

Thank you!
What you have presented is insufficient. The bounds of the integration are not apparently specified, nor are the variables identified in any way.

Much more context is needed to understand what you want to do.
 
  • #3
SteamKing said:
What you have presented is insufficient. The bounds of the integration are not apparently specified, nor are the variables identified in any way.

Much more context is needed to understand what you want to do.

I'm trying to calculate the second virial coefficient for a potential E that depends on positions and velocities. The N particles are moving inside LxL square.

$$\int^L_0\int^L_0\int^{\infty}_0\int^{\infty}_0{e^{-(\vec{v}^2_1+\vec{v}^2_2)}e^{-E(\tau)}}d\vec{r}_1d\vec{r}_2d\vec{v}_1d\vec{v}_2$$
$$E(\tau)=\frac{k}{\tau^2}e^{-\tau/\tau_0}$$
$$\tau(\vec{r}_{12};\vec{v}_{12})=\frac{b-\sqrt{b^2-ac}}{a}$$
$$a=||\vec{v}_{12}||$$
$$b=\vec{r}_{12}\cdot\vec{v}_{12}$$
$$c=||\vec{r}_{12}|| - (2R)^2$$

R, tau_0 and k are constants.
 
  • #4
I don't have much experience using Mathematica or Sage. But most numerical integration algorithms use iteration to solve such problems anyway, so as long as you know how to calculate a single integral with one of those programs you can use the same technique to calculate 4 nested ones. Just evaluate the integrals from the inside out, and feed the result of the first to the second, from the second to the third, and so on. If the constants give you trouble, just set them all to 1 to start with. (There might be a function supplied that is designed for doing an arbitrary number of integrations as well, so look for that.)

Also, you said you want to numerically integrate these equations, but the information you've provided is only really sufficient for a symbolic integration. For example, how would the software evaluate b without numeric expressions for r12 and v12?
 
  • #5
kreil said:
I don't have much experience using Mathematica or Sage. But most numerical integration algorithms use iteration to solve such problems anyway, so as long as you know how to calculate a single integral with one of those programs you can use the same technique to calculate 4 nested ones. Just evaluate the integrals from the inside out, and feed the result of the first to the second, from the second to the third, and so on. If the constants give you trouble, just set them all to 1 to start with. (There might be a function supplied that is designed for doing an arbitrary number of integrations as well, so look for that.)

Also, you said you want to numerically integrate these equations, but the information you've provided is only really sufficient for a symbolic integration. For example, how would the software evaluate b without numeric expressions for r12 and v12?

I'm sorry, i forgot it.
r12 is the relative position and v12 is the relative velocity
$$ r_{12}=r_1-r_2$$
it's the same for v12
 

FAQ: How to Numerically Solve a Multiple Integral in Mathematica or Sage?

1. What is numerical multiple integration?

Numerical multiple integration is a mathematical technique for calculating the definite integral of a multivariable function over a specific region or volume. It involves dividing the region into smaller subregions and using numerical methods, such as the trapezoidal rule or Simpson's rule, to approximate the integral.

2. Why is numerical multiple integration useful?

Numerical multiple integration allows us to find the area, volume, and other properties of complex shapes or regions that cannot be easily calculated using traditional analytical methods. It is also useful for solving real-world problems in fields such as physics, engineering, and economics.

3. What are the limitations of numerical multiple integration?

Numerical multiple integration can only provide an approximation of the true integral, which becomes less accurate as the number of subregions increases. It also requires careful selection of the integration method and subregion size to ensure accurate results.

4. How does numerical multiple integration differ from analytical integration?

Analytical integration involves using algebraic techniques to find exact solutions to integrals, while numerical multiple integration uses numerical methods to approximate the integral. Analytical integration is only possible for simple functions, while numerical multiple integration can be applied to more complex functions.

5. What are some applications of numerical multiple integration?

Numerical multiple integration is commonly used in fields such as physics, engineering, and economics to solve problems involving area, volume, and other properties of complex shapes or regions. It is also used in computer graphics and animation to render 3D objects and in machine learning for data analysis and pattern recognition.

Similar threads

Back
Top