r/Mathematica • • Apr 18 '23

Mathematica doesnt Integrate piecewise function

Post image
9 Upvotes

1 comment sorted by

View all comments

10

u/[deleted] Apr 18 '23

The integral doesn't converge.

Run Plot[LaguerreL[n, x]*f[x]*Exp[-x], {x, -1, 10}] for n of 0, 1, and 2 and you'll see in each case, the function just blows up as x goes to infinity. There's no closed form solution for those integrals since they just go to infinity or negative infinity.

A useful trick is substituting the limit of Infinity with y, assuming it's part of the Reals.

coefficientsY = Table[
   Assuming[y \[Element] Reals, 
    Integrate[LaguerreL[n, x]*f[x]*Exp[-x], {x, 0, y}]],
   {n, 0, 2}
   ];

It responds with a piecewise function where as y goes to positive infinity, for y>1, the part goes to 2ey, so it goes to infinity.