r1 = Vector('r1',dim=2)
r2 = Vector('r2',dim=2)

V2 = Function('V')
n2 = partition_function.new_derivation()
n2.set_name('specialize_n2d2')
n2.set_title('Specialized to N=2, D=2')
#n2.do_print()
n2.add_step(specialize_integral(R,(r1,r2)),'specialize to N=2')
n2.add_step(replace(V,V2(r1,r2)),'replace potential with N=2')
#n2.do_print()

r_cm = Vector('r_cm',dim=2)
r_12 = Vector('r_12',dim=2)

r_12_def = definition(r_12, r2-r1)
r_cm_def = definition(r_cm, (r1+r2)/2)

V12 = Function('V')

# replace r1,r2 with r_12 and r_cm
#   tranformation of limit region is hard, but the square box should be equivalent in periodic
#   boundary conditions
#  Jacobian is 1

n2.add_step(specialize_integral(r1,(r_12,r_cm)),'Switch variables')
n2.add_step(replace(V2(r1,r2),V12(r_12)),'Specialize to a potential that depends only on interparticle distance')
n2.add_step(replace(V12(r_12),V12(Abs(r_12))),'Depend only on the magnitude of the distance')
#n2.add_step(replace_func(V12(r_12),Eq(V12,V12(Abs(r_12)))),'Depend only on the magnitude of the distance')
n2.do_print()

# this should form one page - listing some definitions and setting out the basic form for the
# parition function

from sympy import Symbol, Integral, exp
from derivation_modeling.derivation import derivation, definition, replace_definition

Z = Symbol('Z')
T = Symbol('T')
k = Symbol('k')
V = Symbol('V')
R = Symbol('R')
Beta = Symbol('beta')


partition_function = derivation(Z,Integral(exp(-V/(k*T)),R))
partition_function.set_name('partition')
partition_function.set_title('Partition Function')

beta_def = definition(Beta,1/(k*T),T)

partition_function.add_step( replace_definition(beta_def), 'Insert definition of beta')

# this should form one page - listing some definitions and setting out the basic form for the
# parition function

from sympy import Symbol, Integral, exp
from derivation_modeling.derivation import derivation, definition, replace_definition

Z = Symbol('Z')
T = Symbol('T')
k = Symbol('k')
V = Symbol('V')
R = Symbol('R')
Beta = Symbol('beta')

partition_function = derivation(Z, Integral(exp(-V / (k * T)), R))
partition_function.set_name('partition')
partition_function.set_title('Partition Function')

beta_def = definition(Beta, 1 / (k * T), T)

partition_function.add_step(replace_definition(beta_def),
                            'Insert definition of beta')