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

In summary, the integral does not converge, so there is no definite integral to be performed. If you can guess what the functional form of A(x) is, then you may be able to use the function Fit[data,funs,vars] to the data instead of interpolate.
  • #1
randomvar
1
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
  • #2
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:
  • #3
Only if A is a negative exponential will it converge :

[tex]
A =\sum _{i=1}^{\infty } A_i e^{-c_i x^i}
[/tex]
 
  • #4
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.
 
  • #5


To solve this integral in Mathematica, you can use the built-in function "Integrate" and specify the limits of integration as well as the function A(x). For example, if A(x) is a polynomial function, you can use the following code:

Integrate[A[x]*x^2*Cos[n*x], {x, 0, Infinity}]

If A(x) is a more complex function, you may need to use numerical methods to approximate the integral. In that case, you can use the "NIntegrate" function and specify the number of points to use for the approximation. For example:

NIntegrate[A[x]*x^2*Cos[n*x], {x, 0, Infinity}, Method -> "GaussKronrodRule", MaxRecursion -> 20]

You can then use a loop to iterate through different values of n and obtain the corresponding values of the integral. I hope this helps!
 

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

1. What is an integral and why is it important?

An integral is a mathematical concept used to find the area under a curve. It is important in many fields of science and engineering, as it allows for the calculation of quantities such as displacement, velocity, and acceleration.

2. How does Mathematica solve integrals?

Mathematica uses a combination of symbolic and numerical methods to solve integrals. It first attempts to find an exact solution using symbolic manipulation, and if that is not possible, it uses numerical methods to approximate the integral.

3. Can Mathematica solve any integral?

No, Mathematica may not be able to solve all integrals. It is limited by its algorithms and the complexity of the integral. Some integrals may require advanced techniques or may not have a closed-form solution.

4. What is the role of A(x) and n in the integral equation?

A(x) is a function of x that is multiplied by the x^2 term, while n is a constant that is multiplied by the cosine term. These parameters affect the shape and behavior of the integral and may change the complexity of the solution.

5. How can I check if Mathematica has solved the integral correctly?

You can use the "Integrate" function with the same integral equation to compare the results. You can also plot the original function and the integral solution to visually confirm if they are the same.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • Calculus and Beyond Homework Help
Replies
1
Views
300
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
945
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Topology and Analysis
Replies
4
Views
305
Back
Top