I have a function defined like :
g[n_, x_] := ((n + 2)*Cos[π*(n + 2)*x] - Cot[π*x] *Sin[(n + 2)*π*x])
and I want to do the following :
Integrate[x*g[n, x]*g[m, x], {x, 0, 1}]
But this results in the error :
Integrate::idiv: Integral of x ((2+m) Cos[(2+m) π x]-Cot[π x] Sin[(2+m) π x]) ((2+n) Cos[(2+n) π x]-Cot[π x] Sin[(2+n) π x]) does not converge on {0,1}.
On the other hand, if I specify values of n and m it gives me a numerical output, as desired. Experimenting with the numbers, I have been able to determine that whenever m = n + odd#, where odd# is any odd number > 1, the integral is zero within machine precision.
Table[Integrate[x*g[n, x]*g[n + i, x], {x, 0, 1}], {n, 3}, {i, 3}]
Results in :
{{-(6656/(735*Pi^2)), 0, -(2816/(2835*Pi^2))}, {-(15872/(945*Pi^2)), 0, -(72704/(38115*Pi^2))}, {-(1013504/(38115*Pi^2)), 0, -(1801216/(585585*Pi^2))}}
Considering the above, can someone please guide me how I can obtain the output of Integrate as a function of n or n and m? One way I can think of is to find the relation between coefficients of my output but I can't figure out how to do that by hand or by any code.
Edit : Inspired from comments I tried the following to check for specific cases of n and m values. Here I take m=n+3 which I have verified works for n upto 10 (atleast).
Integrate[x*g[n, x]*g[n + 3, x], {x, 0, 1},
Assumptions -> {n \[Element] {1, 2, 3}}] (* Fails *)
Integrate[x*g[n, x]*g[n + 3, x], {x, 0, 1}] /. n -> 1 (* Works *)
Integrate[x*g[n, x]*g[n + 3, x], {x, 0, 1}] /. n -> 2 (* Works *)
Integrate[x*g[n, x]*g[n + 3, x], {x, 0, 1}] /. n -> 3 (* Works *)
```
AssumptionsorAssumingis the way to go. See e.g. 1, 2 or 3. – Artes May 04 '20 at 21:39Integrate[x*g[n, x]*g[n, x], {x, 0, 1}, Assumptions -> {n \[Element] Integers}]which provided me with outputIntegrate::idiv: Integral of x ((2+n) Cos[(2+n) \[Pi] x]-Cot[\[Pi] x] Sin[(2+n) \[Pi] x])^2 does not converge on {0,1}.Could you please look into this more? I am also trying to read all the discussion on the links you provided. – Nitin May 04 '20 at 22:50Cot[Pi x]ingwhich diverges whenxgoes to0and when it goes to1. – Artes May 04 '20 at 23:11Mathematicashouldn't provide a finite value when I specify the value ofnandm, right? But it does as can be seen from the question I posted. – Nitin May 04 '20 at 23:12nandmIntegrate can calculate specified case, in general seems it cannot. Try to rewrite your integrand to get rid ofCotputting e.g.Cos/Sin. Perhaps you should also try thePrincipalValueoption inIntegrate. – Artes May 04 '20 at 23:23Mathematicanot knowing the value ofn. – Nitin May 04 '20 at 23:41