I have the following set of commands to execute a specific 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:

From the first result it follows that n = -1/2, whence it follows that n is not an integer. What is the point at which an integer attribute refers to a character if it does not take it into account in operations, as shown above? How to make Sympy recognize that the first part of a piecewise result is not possible if n is an integer?
source
share