I have the following set of commands to do a definite integral
n [2]: from sympy import *
init_printing()
x,L = symbols('x, L')
n = symbols('n', integer = True)
exp = sin((n+Rational(1,2))*pi*x/L)**2
integrate(exp, (x,0,L))
The result of these commands shown below:
The first result implies that n=-1/2 which implies that n is not an integer. What is the point of giving an integer attribute to the symbol if it doesn't account for it in operations as shown above? How can I force sympy to recognize that the first part of the piecewise result is impossible if n is integer?