def fourier_cos_seq(func, limits, n):
 from sympy.integrals import integrate
 (x, L) = (limits[0], (limits[2] - limits[1]))
 cos_term = cos(((((2 * n) * pi) * x) / L))
 formula = (((2 * cos_term) * integrate((func * cos_term), limits)) / L)
 a0 = (formula.subs(n, S.Zero) / 2)
 return (a0, SeqFormula((((2 * cos_term) * integrate((func * cos_term), limits)) / L), (n, 1, oo)))

def fourier_cos_seq ( func , limits , n ) : from sympy . integrals import integrate ( x , L ) = ( limits [ 0 ] , ( limits [ 2 ] - limits [ 1 ] ) ) cos_term = cos ( ( ( ( ( 2 * n ) * pi ) * x ) / L ) ) formula = ( ( ( 2 * cos_term ) * integrate ( ( func * cos_term ) , limits ) ) / L ) a0 = ( formula . subs ( n , S . Zero ) / 2 ) return ( a0 , SeqFormula ( ( ( ( 2 * cos_term ) * integrate ( ( func * cos_term ) , limits ) ) / L ) , ( n , 1 , oo ) ) )
returns the cos sequence in a fourier series .