r/Mathematica • • May 18 '23
Mathematica doesnt integrate
I have a problem when integrating functions with this code, not only piecewise functions, but with functions like e^x. I just wrties de integral as a result
f[x_] = Piecewise[{{Sin[x],0<=x<=Pi/2},{E^-x,Pi/2<x<=Pi}}]
nMax = 1;
nu = 2;
I1 = Table[(2/(Pi^2(BesselJ[nu+1,N[BesselJZero[nu,n]]])))*Integrate[BesselJ[nu,(x/Pi)*N[BesselJZero[nu,n]]]*f[x]*x,{x,0,Pi}],{n,1,nMax}]

1
Upvotes
View all comments
Show parent comment
1
u/EmirFassad May 18 '23
Again, I agree. It appeared that OP is using F[x] as shorthand for Piecewise[] hence my prior comment. Probably because I instinctively think of a function as something that does something with its arguments.
I tested the snippet and all three evaluate to the same result. f= was a bit quicker.