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

  • Context: Mathematica 
  • Thread starter Thread starter randomvar
  • Start date Start date
  • Tags Tags
    Integration Mathematica
Click For Summary

Discussion Overview

The discussion revolves around solving the integral I = Integral ( A(x)*x^2*cos(nx) )dx from 0 to infinity using Mathematica. The function A(x) is based on experimental data, and the user seeks guidance on computing the integral for various values of n, specifically from 1 to 250.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Experimental/applied

Main Points Raised

  • One participant requests hints for solving the integral using Mathematica, noting that A(x) is experimentally derived.
  • Another participant asserts that the integral does not converge under the given conditions, suggesting that a definite integral may not be obtainable.
  • A third participant proposes that convergence might only occur if A(x) takes the form of a negative exponential.
  • Another suggestion involves constructing an interpolating function from the experimental values of A and performing a numerical integration, while cautioning that the interpolation is valid only within the data range.
  • This participant also mentions that if A(x) decreases exponentially, truncating the integral could be a viable approach for numerical integration.
  • There is a suggestion to use a fitting function to better approximate A(x) if more information about its form is available.

Areas of Agreement / Disagreement

Participants express differing views on the convergence of the integral, with some asserting it does not converge while others suggest conditions under which it might. The discussion remains unresolved regarding the best approach to compute the integral.

Contextual Notes

Participants highlight limitations related to the convergence of the integral and the dependence of results on the specific form of A(x). There is also mention of the need for caution when using interpolation outside the data range.

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 :

[tex] A =\sum _{i=1}^{\infty } A_i e^{-c_i x^i}[/tex]
 
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 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
5K