       # Re: Computing my own function efficiently

• To: mathgroup@smc.vnet.net
• Subject: [mg11169] Re: Computing my own function efficiently
• From: "Tom Marchioro" <tlm@u.washington.edu>
• Date: Wed, 25 Feb 1998 03:31:43 -0500
• Organization: University of Washington
• References: <6cgg8n\$sg1@smc.vnet.net> <6cteh7\$lgs@smc.vnet.net>

```Equivalently, the answer is easily derivable if you just take

Cos[b x]=(E^I b x + E^-I b x)/2

and then use Jordan's Lemma on each resulting term (after scaling x->
x/b).

such integrals arise frequently in physics, usually in the context of
calculating a Green's function, and numerically they can be extremely
slow to converge (no doubt what prompted his original question).  The
possibility of "extending" these integrals into the complex plane and
getting closed form solutions remains one of the wonders of
mathematics.

If you *insist* on doing the integral numerically, the Cos
transformation is still the best way, just follow it up by using
Fourier[...] on the resulting terms.

Hope this proves helpful --- Tom

--
Dr. Thomas L. Marchioro II
Departments of Physics and Chemistry University of Washington
206-323-9599
http://borg.chem.washington.edu/~tlm

mike johnson wrote in message <6cteh7\$lgs@smc.vnet.net>...
>Tommy Nordgren wrote:
>>
>> I have a function that is defined by: f[k_,b_] := Integrate[
>>         Cos[b x] Exp[-x^2]/(k^2+x^2),{x,-Infinity,Infinity}] Since
Mathematica
>> can't solve the integral...
>
>Gradshteyn & Ryzhik, Table of Integrals, Series & Products, 4th ed. Sec
>3.954 gives the following algebraic answer (after some change in
>notation) in terms of error functions:
>
>Pi^(3/2) Exp[k^2]/(4k)*
>   (2 Cosh[b k] - Exp[-b k] Erf[k-b/2] - Exp[bk] Erf[k+b/2])
>
>Sometimes the old ways are still useful. --
>Michael A. Johnson, Mail Stop L-463
>Lawrence Livermore Nat'l Lab
>7000 East Ave., P. O. Box 808
>Livermore, CA 94551
>Fax: (510) 422-6007
>mike-johnson@llnl.gov
>

```

• Prev by Date: Efficient use of coefficient--Efficient simplification
• Next by Date: Re: Any interest (Wolfram or general) in fast multiply?
• Prev by thread: Re: Computing my own function efficiently