import sympy

from sympy import exp, integrate, pi, sqrt, Symbol, symbols, oo

from sympy import Abs, Q, periodic_argument, polar_lift, refine

from sympy import cos

from sympy import Rational as Rat

"""
Explanation: Lattice Boltzmann Method
End of explanation
"""


#u = Symbol("u",assume="real")
u = Symbol("u",real=True)
#T_0 =Symbol("T_0",assume="positive")
T_0 =Symbol("T_0",real=True,positive=True)

#v = Symbol("v",assume="real")
v = Symbol("v",real=True)

#phi_v = sqrt( pi/(Rat(2)*T_0))*exp( - (v-u)**2/(Rat(2)*T_0))
phi_v = sqrt( pi/(2*T_0))*exp( - (v-u)**2/(2*T_0))

integrate(phi_v,v)

integrate(phi_v,(v,-oo,oo))

(integrate(phi_v,v).subs(u,oo)- integrate(phi_v,v).subs(u,-oo)).expand()

integrate(phi_v,(v,-oo,oo),conds='none')

integrate(phi_v,(v,-oo,oo),conds='separate')

"""
Explanation: $d2q9$
cf.Jonas Tölke.  Implementation of a Lattice Boltzmann kernel using the Compute
Unified Device Architecture developed by nVIDIA. Comput. Visual Sci. DOI 10.1007/s00791-008-0120-2
Affine Spaces
Lattices, that are "sufficiently" Galilean invariant, through non-perturbative algebraic theory
cf. http://staff.polito.it/pietro.asinari/publications/preprint_Asinari_PA_2010a.pdf, I. Karlin and P. Asinari, Factorization symmetry in the lattice Boltzmann method.  Physica A 389, 1530 (2010).  The prepaper that this seemd to be based upon and had some more calculation details is 
Maxwell Lattices in 1-dim.
Maxwell's (M) moment relations
End of explanation
"""


refine(integrate(phi_v,(v,-oo,oo)), Q.is_true(Abs(periodic_argument(1/polar_lift(sqrt(T_0))**2, oo)) <= pi/2))

"""
Explanation: cf. http://stackoverflow.com/questions/16599325/simplify-conditional-integrals-in-sympy
End of explanation
"""


