31 Mar 00:12 2015

### Sine product integral

Dear all,

First of all, many thanks for Sympy, which is a great tools !

I try to integrate a product of two sinus functions such as :

f(x) = sin(pi*n/L*x) * sin(pi*m/L*x)

where n and m are two positive integer (and L>0). I've found the correct expected values (L/2 if m=n, 0 otherwise). But if I make a small change of variable, moving x to x+L/2, then Sympy fails to provide me an answer. Is there a way to "help" Sympy finding the correct solution ?

An example is below :

----

z = symbols('z')

m, n = symbols('m n', positive=True, integer=True)

L = symbols('L', positive=True, real=True)

def e1(z, n, L):

k_n = n*pi/L

return sin(k_n*(z))

def e2(z, n, L):

k_n = n*pi/L

return sin(k_n*(z+L/2))

Imn1 = integrate(fu(e1(z, n, L)*e1(z, m, L)), (z, 0, L))

Imn2 = integrate(fu(e2(z, n, L)*e2(z, m, L)), (z, -L/2, L/2))

---

In [16]: Imn1

Out[16]: Piecewise((L/2, m == n), (0, True))

In [17]: Imn2

Out[17]: Integral(sin(pi*m*(L/2 + z)/L)*sin(pi*n*(L/2 + z)/L), (z, -L/2, L/2))

Best regards,

Julien

-- First of all, many thanks for Sympy, which is a great tools !

I try to integrate a product of two sinus functions such as :

f(x) = sin(pi*n/L*x) * sin(pi*m/L*x)

where n and m are two positive integer (and L>0). I've found the correct expected values (L/2 if m=n, 0 otherwise). But if I make a small change of variable, moving x to x+L/2, then Sympy fails to provide me an answer. Is there a way to "help" Sympy finding the correct solution ?

An example is below :

----

z = symbols('z')

m, n = symbols('m n', positive=True, integer=True)

L = symbols('L', positive=True, real=True)

def e1(z, n, L):

k_n = n*pi/L

return sin(k_n*(z))

def e2(z, n, L):

k_n = n*pi/L

return sin(k_n*(z+L/2))

Imn1 = integrate(fu(e1(z, n, L)*e1(z, m, L)), (z, 0, L))

Imn2 = integrate(fu(e2(z, n, L)*e2(z, m, L)), (z, -L/2, L/2))

---

In [16]: Imn1

Out[16]: Piecewise((L/2, m == n), (0, True))

In [17]: Imn2

Out[17]: Integral(sin(pi*m*(L/2 + z)/L)*sin(pi*n*(L/2 + z)/L), (z, -L/2, L/2))

Best regards,

Julien

You received this message because you are subscribed to the Google Groups "sympy" group.

To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.

To post to this group, send email to sympy-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.

Visit this group at http://groups.google.com/group/sympy.

To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/adbc610b-360a-438b-ba46-1446ae059c5c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.