- #1
member 428835
Hi PF!
I have a function ##\phi ns## defined below, and ##\phi ns## is continuous everywhere except ##s=0##, where it is singular. However, ##\lim_{s\to 0}\phi ns(s) = 0##, and since I'm integrating in this domain I thought I would define a new function ##\phi nsP## such that ##\phi nsP(s=0)=0## and ##\phi nsP(s) = \phi n(s)## everywhere else. When integrating I get several error messages. Would you mind copy-pasting this code into a notebook and seeing what you think the issue is? I'm happy to talk about the error messages specifically but thought just posting the code verbatim would be easier.
I should say when I don't define the piecewise function I do not receive any error messages but later on (not shown above) there are singular issues that I think would not be an issue if this were straightened out here.
I have a function ##\phi ns## defined below, and ##\phi ns## is continuous everywhere except ##s=0##, where it is singular. However, ##\lim_{s\to 0}\phi ns(s) = 0##, and since I'm integrating in this domain I thought I would define a new function ##\phi nsP## such that ##\phi nsP(s=0)=0## and ##\phi nsP(s) = \phi n(s)## everywhere else. When integrating I get several error messages. Would you mind copy-pasting this code into a notebook and seeing what you think the issue is? I'm happy to talk about the error messages specifically but thought just posting the code verbatim would be easier.
Code:
\[Alpha] = \[Pi]/2;
\[Phi]s[s_] = Table[LegendreP[j, 1, Cos[s]], {j, 1, 15, 2}];
dP[s_, j_] = D[LegendreP[j, 1, s], s];
\[Phi]ns[s_] =
Table[j (-Sin[s]^2 + Cos[s]^2) LegendreP[j, 1, Cos[s]] +
2 Sin[s]^2 Cos[s] dP[Cos[s], j], {j, 1, 15, 2}];
\[Phi]nsP[s_] =
Piecewise[{{\[Phi]ns[s] , s != 0}, {Table[0, {j, 1, 15, 2}],
s == 0}}];
m = Table[
NIntegrate[
Sin[s] \[Phi]nsP[s][[i]]*\[Phi]s[s][[j]], {s, 0, \[Alpha]},
AccuracyGoal -> 10], {i, 8}, {j, 8}];
I should say when I don't define the piecewise function I do not receive any error messages but later on (not shown above) there are singular issues that I think would not be an issue if this were straightened out here.