Mathematica: Convolution between Lorentzian and Gaussian

Click For Summary
SUMMARY

The forum discussion centers on performing convolution between a Lorentzian function and a Gaussian function using Mathematica. The user initially implements the convolution using the built-in Convolve function, which results in long computation times. Another participant suggests that while the computation takes only 15 seconds on their laptop, the output may not meet the user's expectations. They recommend using ListConvolve for numerical convolution as a more efficient alternative.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of Lorentzian and Gaussian functions
  • Knowledge of convolution operations in mathematical contexts
  • Experience with numerical methods in data analysis
NEXT STEPS
  • Explore the use of ListConvolve in Mathematica for numerical convolution
  • Investigate optimization techniques for Mathematica code execution
  • Learn about the properties and applications of Lorentzian and Gaussian functions
  • Study performance benchmarks for different convolution methods in Mathematica
USEFUL FOR

Mathematica users, data analysts, physicists, and anyone interested in numerical methods for convolution operations.

Niles
Messages
1,834
Reaction score
0
Hi

I have the following code:

Code:
lorentz[A_, Ox_, Oy_, FWHM_, x_] := 
  A (1/3.14) FWHM/((x - Ox)^2 + FWHM^2) + Oy;
gauss[A_, Ox_, Oy_, x_, C_] := A Exp[-(x - Ox)^2 C] + Oy;

Convolve[lorentz[1, 0, 0, 1, x], gauss[1, 0, 0, x, 1], x, y]

It takes extremely long time for this to finish -- is it just an example, where Mathematica is the wrong tool?Niles.
 
Physics news on Phys.org
It only takes 15 seconds on my laptop, but the result probably is not what you want:

0.318471 Convolve[1/(1 + x^2), E^-x^2, x, y]

You may want to use ListConvolve and do it numerically.
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
5
Views
3K