1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerical Integration

  1. Aug 8, 2008 #1

    I have the following question in numerical integration in higher dimension. Any help/suggestion would be welcome.

    The integral is ( I am using maple notation ):

    int( int( int( int( int( int( f(x,y,z), z=-infinity..w), w=-infinity..infinity),
    y=-infinity..v), v=-infinity..infinity),
    x=-infinity..u), u=-infinity..infinity);

    The integral is convergent. Indeed f(x,y,z) = K*exp(-( x^2+(y-x)^2+(z-y)^2) )/2), where K is a given constant.

    Thanks in advance

    Kind regards
  2. jcsd
  3. Aug 8, 2008 #2


    User Avatar

    Staff: Mentor

    And you are asking about... ?

    Could be I am missing something obvious, it happens, but I see only statements, no questions.
  4. Aug 8, 2008 #3


    User Avatar
    Staff Emeritus
    Science Advisor

    What is your question? Surely it is not just "how do you do a numerical integration"! That is much too broad.
  5. Aug 8, 2008 #4
    I am sorry, I thought it obvious that I was asking for a numerical method for evaluating the 6 dimension integral.

    Many thanks in advance
  6. Aug 8, 2008 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Hmm..I would first restrict the infinity to a radial variable, i.e, switch to spherical coordinates and see what simplifications, if any, that would give me.
  7. Aug 8, 2008 #6
    Ok. I tried the following transformation:

    x = r*cos(theta)*cos(phi)
    y = r*cos(theta)*(cos(phi) + sin(phi))
    z = r*cos(theta)*(cos(phi) + sin(phi)) + r*sin(theta)

    and the Jacobian is -r^2*cos(theta). This means I am retaining the variables u,v,w as they are.

    Now the question: what are the limits for the six variables: r, theta, phi, u, v, w?

    Another question: Is there a transformation for removing u, v, w from being present in the limits?

    Kind regards and many thanks

  8. Aug 8, 2008 #7


    User Avatar
    Science Advisor
    Homework Helper

    Hi hpriye! :smile:

    The integral is over all x and u with -∞ < x < u < ∞, so:

    [tex]\int_{-\infty}^{\infty} \int_{-\infty}^u f(x,y,x) dx du\ =\ \int_{-\infty}^{\infty} f(x,y,x)\left(\int_x^{\infty} du\right) dx\ =\ \infty[/tex]

    or have I misunderstood the question? :confused:
  9. Aug 8, 2008 #8
    More than misunderstanding I would say misreading :(


  10. Aug 8, 2008 #9
    i would use monte carlo integration. how about you write out your integral in tex so we can all understand it
  11. Aug 8, 2008 #10


    User Avatar
    Science Advisor
    Homework Helper

    Nope … can't be misreading …

    'cos I don't read maple! :biggrin:

    … is it canadian? :confused:

    … i know tex is texan … :rolleyes:
  12. Aug 9, 2008 #11
    ∫_(-∞)^∞▒∫_(-∞)^u▒∫_(-∞)^∞▒∫_(-∞)^v▒∫_(-∞)^∞▒∫_(-∞)^w▒〖f(x,y,z) dz dw dy dv dx du〗

    f(x,y,z)=1/〖√2π〗^3 e^(-1/2(x^2+(y-x)^2+(z-y)^2))-1/√6 e^(-x^2/2-y^2/4-z^2/6)

    I have tried to give the MsWord 2007 format. Hope it is readable! Underscore stands for subscript and ^ stands for superscript

    Kind regards
  13. Aug 9, 2008 #12


    User Avatar
    Science Advisor
    Homework Helper

    in texas we say …

    Hi hpriye! :smile:

    If you mean [tex]\int_{-\infty}^{\infty}\int_{-\infty}^u\int_{-\infty}^{\infty}\int_{-\infty}^v\int_{-\infty}^{\infty}\int_{-\infty}^w f(x,y,z)\,dz dw dy dv dx du[/tex]

    [tex]f(x,y,z)\ =\ \frac{1}{(2\pi)^3} e^{-1/2(x^2+(y-x)^2+(z-y)^2)}\ -\ \frac{1}{\sqrt{6}}e^{-(\frac{1}{2}x^2\,-\,\frac{1}{4}y^2\,-\,\frac{1}{6}z^2)}[/tex]


    [noparse][tex]\int_{-\infty}^{\infty}\int_{-\infty}^u\int_{-\infty}^{\infty}\int_{-\infty}^v\int_{-\infty}^{\infty}\int_{-\infty}^w f(x,y,z)\,dz dw dy dv dx du[/tex]

    [tex]f(x,y,z)\ =\ \frac{1}{(2\pi)^3} e^{-1/2(x^2+(y-x)^2+(z-y)^2)}\ -\ \frac{1}{\sqrt{6}}e^{-(\frac{1}{2}x^2\,-\,\frac{1}{4}y^2\,-\,\frac{1}{6}z^2)}[/tex][/noparse]
  14. Aug 9, 2008 #13
    Re: in texas we say …

    Yes, exactly. But I observed square root symbol is missing, even in the original typesetting. It should be (sqrt(2*pi))^3. Thank you very much!

    Kind regards

  15. Aug 9, 2008 #14


    User Avatar
    Science Advisor
    Homework Helper

    Re: in texas we say …

    hmm … so it's:

    [tex]\int_{-\infty}^{\infty}\int_{-\infty}^u\int_{-\infty}^{\infty}\int_{-\infty}^v\int_{-\infty}^{\infty}\int_{-\infty}^w f(x,y,z)\,dz dw dy dv dx du[/tex]

    [tex]f(x,y,z)\ =\ \frac{1}{(2\pi)^\frac{3}{2}} e^{-1/2(x^2+(y-x)^2+(z-y)^2)}\ -\ \frac{1}{\sqrt{6}}e^{-(\frac{1}{2}x^2\,-\,\frac{1}{4}y^2\,-\,\frac{1}{6}z^2)}[/tex]

    with an extra:

    [noparse][tex]\frac{3}{2}[/tex][/noparse] :wink:
  16. Aug 9, 2008 #15
    Hi hypre.

    As you already know this task is not so simple to solve because of multi-integration. First it is very useful and not so painful see whether first integral exists: :smile:

    [tex] \Theta(u,x,v,y,w)=\int_{-\infty}^{w} f(u,x,v,y,w,z) dz = \frac{1}{2}e^{-\frac{x^2}{2}-\frac{y^3}{4}}\;\sqrt{\pi} \left(1+Erf(\frac{w}{\sqrt{6}}) \right) +
    \frac{1}{4\pi}\; e^{-x^2+xy-\frac{y^2}{2}} \left(1+Erf(\frac{w-y}{\sqrt{2}}) \right)

    Integrals would exist if [tex]u,v,w \in (-\infty,0) [/tex] otherwise integrals diverge !
    You can see that if above integral split on two integrals
    [tex] \int_{-\infty}^{0} \Theta(u,x,v,y,w)\; dw = 0.586571 + O(10^{-6}) [/tex]
    [tex]\int_{0}^{\infty} \Theta(u,x,v,y,w)\; dw \rightarrow \bf{\infty} [/tex]

    Trick how to see whether this exist to plot it. Put [tex] x=y=1 [/tex] as you already know [tex] x \in (-\infty,\infty)[/tex] and [tex]y \in (-\infty,\infty)[/tex]. I made also graph so see what is the shape of function and is attached to this answer.

    If you don't understand just send me email and I will try to explain.

    Enjoy :smile:

    Attached Files:

  17. Aug 9, 2008 #16
    Sorry I forgot to mention numerical solution [tex]= 0.586571 + ...[/tex] comes form [tex]x=y=1[/tex]. It is only to see that first has numerical solution other diverge.
  18. Aug 12, 2008 #17
    Thankyou very much for your efforts!

    One important aspect of this integral is this: It belongs to a class of integrals which apparantly diverge, but not in the real sense.

    For example define two functions
    [tex] f(x)\ =\ x^2 + e^{-x^2} \ [/tex] and
    [tex] g(x)\ =\ x^2 + e^{-2 x^2} \ [/tex]
    then individually the two integrals:
    [tex] \int_{-\infty}^\infty f(x)\ dx [/tex] and [tex] \int_{-\infty}^\infty g(x)\ dx [/tex] diverge but [tex] \int_{-\infty}^\infty (f(x)-g(x))\ dx = \sqrt{\pi} - \sqrt{\frac{\pi}{2}} [/tex]

    Similarly, the six-dimensional integral has another 3 dimension integral in the denominator (which I have not posted or mentioned earlier) such that the ratio is a finite number, in a limiting sense. I know this is a very very complicated integral, which naturally arises while solving problems in financial mathematics, so what I am interested in is, a numerical method to handle such integrals involving limiting case:

    [tex] \lim_{a \rightarrow \infty} \left(\frac{\int_{-a}^a \int_{-a}^u \int_{-a}^a \int_{-a}^v \int_{-a}^a \int_{-a}^w \nu(x,y,z) \ dw\ dz\ dv\ dy\ dx\ du}{\int_{-a}^a \int_{-a}^a \int_{-a}^a \delta(x,y,z) \ dz\ dy\ dx} \right) [/tex]

    Kind regards and thanks to one and all.
    Last edited: Aug 12, 2008
  19. Aug 12, 2008 #18
    No problem.

    I would solved it by Simpsons method, has good accuracy at low number of steps. Don't forget functions are very quick :smile:
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Numerical Integration
  1. Numerical integrations (Replies: 2)