Mathematica Solve Integral A(x)*x^2*cos(nx) w/ Mathematica

AI Thread Summary
The discussion revolves around solving the integral I = Integral (A(x)*x^2*cos(nx)) dx from 0 to infinity, where A is an experimentally derived function of x. It is noted that the integral does not converge unless A has a specific form, such as a negative exponential. To address this, participants suggest constructing an interpolating function based on the experimental data for A and then performing a numerical integration. They emphasize that the interpolation is valid only within the data range. Additionally, if A(x) decreases exponentially, truncating the integral can be a viable approach. Using numerical integration techniques like NIntegrate is recommended for calculating the integral for multiple values of n. For better accuracy, fitting the data to a functional form rather than simple interpolation is also advised.
randomvar
Messages
1
Reaction score
0
Hi guys,
I need a hint on how to solve this integral using mathematica

I = Integral ( A(x)*x^2*cos(nx) )dx , (0 to infinity)

A is a function of x and infact i have the values of A for different values of x which was obtained experimentally.

I need to find the value of I(the integral) for many values of n say from (n=1 to 250)

Any thoughts would be greatly helpful. Let me know if the question is not clear

Thanks a lot,
 
Physics news on Phys.org
Integrate[A (x)*x^2*Cos[n*x], {x, 0, Infinity}] does not converge so no definite integral... if I understood that correctly.

edit: Integrate[a[x]*x^2*Cos[n*x], {x, 0, Infinity}]. Or is this what you want? a is a function of x in this one not a variable. Here too you will not get a definite integral.
 
Last edited:
Only if A is a negative exponential will it converge :

<br /> A =\sum _{i=1}^{\infty } A_i e^{-c_i x^i}<br />
 
Since you have experimental values of A, construct an interpolating function then do the numerical integral. Eg

pts=RandomReal[{0,100},50]//Sort;
data=Table[{x,(100+RandomReal[{-.01,.01}])Exp[-.01 x^2]},{x,pts}];
A=Interpolation[data]
Plot[{A[x],100 Exp[-.01 x^2]},{x,0,100},PlotRange->All,PlotStyle->{Automatic,Dashed}]

But note that the interpolation function is only good within your data range.

Plot[A[x],{x,99,1001},PlotRange->All]
A[100000000000]

But if A[x] really does drop off exponentially (as Hepth points out that it must), then you're probably ok to truncate the integral - eg

int=Table[NIntegrate[A[x] x^2 Cos[n x],{x,0,100}],{n,1,100}]
ListPlot[int[[1;;20]],Joined->True,PlotRange->All]

If you have some more information and can guess what the functional form of A(x) is, then it might be better to use the function Fit[data,funs,vars] to the data instead of interpolate.
 

Similar threads

Replies
13
Views
2K
Replies
9
Views
3K
Replies
1
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
4
Views
3K
Replies
34
Views
4K
Back
Top