Mathematica: Convolution Integral

Click For Summary
SUMMARY

The forum discussion focuses on resolving an error encountered while performing a convolution integral in Mathematica. The user provided a code snippet that defines functions for a probability density function and a sine function, but received an error indicating that the integrand is not numerical. The solution involves correcting the argument of the sine function from division to multiplication, ensuring it is dimensionless. This adjustment allows the plot to generate correctly without errors.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of convolution integrals
  • Knowledge of probability density functions, specifically NormalDistribution
  • Basic principles of numerical integration using NIntegrate
NEXT STEPS
  • Review Mathematica's documentation on defining functions and handling numeric conditions
  • Study the concept of dimensionless quantities in mathematical functions
  • Learn about the properties of NormalDistribution in Mathematica
  • Explore advanced techniques for plotting in Mathematica, including error handling
USEFUL FOR

Mathematica users, mathematicians, and data scientists interested in performing convolution integrals and troubleshooting numerical integration errors.

QuantumKnoll
Messages
1
Reaction score
0
Hi all! I'm new to Mathematica.
I have written a code for performing a convolution integral (as follows) but it seems to be giving out error messages:

My code is:

a[x_?NumericQ] := PDF[NormalDistribution[40, 2], x]
b[k_?NumericQ, x_?NumericQ] := 0.0026*Sin[1.27*k/x]^2
c[k_?NumericQ, x_?NumericQ] := {a[x]*b[k, x]}
d[k_?NumericQ] := NIntegrate[c[k, x], {x, 0, Infinity}]
Plot [d[k], {k, 0, 350}]

It gives the following error message multiple times:

ntegrand c[0.00715,x] is not numerical at {x} = {124.67}And the plot doesn't show up..!
Does anyone have any suggestions on how to fix it ?
 
Last edited:
Physics news on Phys.org
The argument of the sin function is wrong. It must be dimensionless, i.e. k multiplied by x not divided by x.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 34 ·
2
Replies
34
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K