0
$\begingroup$

May be this is more of a math problem, but I really need to know how to do it? can anyone help?

Integrate[Sin[n1 \[Pi] sp] Sin[n2 \[Pi] sp] (1/(s - sp)), {sp, 0, 1}]
$\endgroup$
  • $\begingroup$ What are n1, n2 and s? $\endgroup$ – zhk Jul 14 '17 at 0:58
  • $\begingroup$ @zhk some indices I want to sum over later (both of them will vary from 1 to 10 for example), you can think of them as numbers. s is also a variable . I will multiply the current integral by some other terms and integrate over s. $\endgroup$ – Delaram Nematollahi Jul 14 '17 at 1:00
  • $\begingroup$ Then n1[Pi] is a syntax error. $\endgroup$ – John Doty Jul 14 '17 at 1:11
  • $\begingroup$ If you are pasting Mathematica source code into a post, like \[Pi] for example, then the posting software "eats" the leading backslash. But if you manually insert an extra backslash in front of each backslash then the first one guards the second one and you will see \[Pi]. That will keep from confusing people into thinking that you have a function n2[Pi] instead of having n2*\[Pi]. (It is also possible to manually edit in Greek characters if that is something you think you need to do) You can also use the formatting tools during posting to put code into highlighted blocks) $\endgroup$ – Bill Jul 14 '17 at 5:28
  • $\begingroup$ @Bill, Thank you, that was really helpful $\endgroup$ – Delaram Nematollahi Jul 14 '17 at 16:02
3
$\begingroup$

Something like this?

Int = Integrate[Sin[n1 π sp] Sin[n2 π sp] (1/(s - sp)), sp]

(Limit[Int, sp -> 1] - Limit[Int, sp -> 0]) // FullSimplify
$\endgroup$
  • $\begingroup$ it still gives me this error :Infinite expression 1/0 encountered. >> $\endgroup$ – Delaram Nematollahi Jul 14 '17 at 1:15
  • $\begingroup$ zhk's answer works fine here -- maybe try restarting Mathematica to clear unwanted/old definitions. $\endgroup$ – bill s Jul 14 '17 at 1:17
  • $\begingroup$ @zhk thank you so much, It works fine $\endgroup$ – Delaram Nematollahi Jul 14 '17 at 1:28
  • $\begingroup$ @zhk Thank you for your answer, I am calculating this integral now: intn1n2s = Integrate[ (1/ 2 (Cos[2 n1 [Pi] s] (CosIntegral[-2 n1 [Pi] (-1 + s)] - CosIntegral[-2 n1 [Pi] s]) - Log[1 - s] + Log[-s] - Sin[2 n1 [Pi] s] (SinIntegral[2 n1 [Pi] s] + SinIntegral[2 n1 [Pi] - 2 n1 [Pi] s]))) Sin[ n [Pi] s] Sin[m [Pi] s], s] , but when I apply the Limit function for s->1 it gives me ComplexInfinity. (n1,n2,n&m are numbers ), Do you have any idea how should I fix it? $\endgroup$ – Delaram Nematollahi Jul 14 '17 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.