MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110637] Re: numerical integration
  • From: Pratip Chakraborty <pratip.chakraborty at gmail.com>
  • Date: Wed, 30 Jun 2010 01:48:48 -0400 (EDT)

Hi,
Seems like Mathemtica can solve this both symbolically as well as Numerically.
But if you want exact symbolic solution it needs some time to integrate.
Here is the code.

(*Symbolic Integration*)
re=Assuming[\[Lambda] \[Element] Reals && \[Epsilon] > 0,
 Integrate[
  Exp[-I*\[Lambda]*(x + y)]*(x -
     y)*((Sinh[Pi*(x + I*\[Epsilon])]*
        Sinh[Pi*(y - I*\[Epsilon])])^-2 - (Sinh[
         Pi*(x - I*\[Epsilon])]*
        Sinh[Pi*(y + I*\[Epsilon])])^-2), {x, -Infinity,
   Infinity}, {y, -Infinity, Infinity}]]

Lets form a function that takes Lambda and Epsilon and returns the result of
the integral as a pair of real numbers {RealPart, ImaginaryPart}.

(*Integral as a function of Parameters Lambda and Epsilon*)
IntegrationResult[Lambda_?NumericQ, Epsilon_?NumericQ] :=
 Module[{val},
  val = re /. \[Lambda] -> Lambda /. \[Epsilon] -> Epsilon; {Re[val],
   Im[val]}];
IntegrationResult[1.5, 2.]

Now for the numerical integration you need to specify numerical values for
the Lambda and the Epsilon. This can be acheived by using the With function
of Mathematica along with NIntegrate. I see that MAthematica can integrate
even with Imaginary value of Lambda.

(*Numerical Integration*)
With[{\[Lambda] = 1. + .2 I, \[Epsilon] = 0.1},
 NIntegrate[
  Exp[-I*\[Lambda]*(x + y)]*(x -
     y)*((Sinh[Pi*(x + I*\[Epsilon])]*
        Sinh[Pi*(y - I*\[Epsilon])])^-2 - (Sinh[
         Pi*(x - I*\[Epsilon])]*
        Sinh[Pi*(y + I*\[Epsilon])])^-2), {x, -Infinity,
   Infinity}, {y, -Infinity, Infinity}]]

I hope this solves your problem. However you can see with Mathematica even
nasty seeming integrals sometimes behave quite like a easy one.

Regards,

Pratip

On Tue, Jun 29, 2010 at 12:59 PM, Peter Pein <petsie at dordos.net> wrote:

> Am Mon, 28 Jun 2010 06:29:45 +0000 (UTC)
> schrieb ofer <ofershl at gmail.com>:
>
> > hi,
> > i have a pretty nasty double integral which i need to solve
> > numerically but mathematica gives me  error messages when i try to
> > solve  it straightforward using NIntegrate
> >
> > the integrand is:
> >
> >
> Exp[-I*\[Lambda]*(x+y)]*(x-y)*((Sinh[Pi*(x+I*\[Epsilon])]*Sinh[Pi*(y-I*\[Epsilon])])^-2
> > -(Sinh[Pi*(x-I*\[Epsilon])]*Sinh[Pi*(y+I*\[Epsilon])])^-2)
> >
> > in the limits x=-infinity..infinity, y=-infinity..infinity
> >
> > with epsilon==>0
> >
> > i'm new to mathematica  and will  appreciate any suggestions
> >
>
> Assuming you replaced epsilon and lambda by numerical values, I can not
> understand why NIntegrate fails. If you didn't so, you'll get an error
> stating that the integrand is nowhere numeric. ("The integrand" ...
> "has evaluated to non-numerical values for all sampling points in the
> region with boundaries"...)
>
> Peter
>
>
>


  • Prev by Date: Re: Setting PageSize and PaperSize
  • Next by Date: Re: Customizing Manipulate's Autorun
  • Previous by thread: Re: numerical integration
  • Next by thread: Re: numerical integration