def f(dx):
    rho = rhoc * (delta + dx)
    return DerivTerms('dphir_dDelta', T, rho, fluid)
def f(dx):
    T = Tc / (tau + dx)
    return DerivTerms('d2phi0_dTau2', T, rho, fluid)
def f(dx):
    T = Tc / (tau + dx)
    return DerivTerms('dphir_dTau', T, rho, fluid)
def f(dx):
    T = Tc / (tau + dx)
    return DerivTerms('d2phir_dDelta2', T, rho, fluid)
def f(dx):
    rho = rhoc * (delta + dx)
    return DerivTerms('d2phir_dTau2', T, rho, fluid)
## fluid = 'Water'
## T = 647.74374374374372#647#Props(fluid,'Tcrit')+1
## rho = 322.32199999#358#Props(fluid,'rhocrit')+1
## H = Props('H','T',T,'D',rho,fluid)
## P = Props('P','T',T,'D',rho,fluid)
## print T,rho,H,P

fluid = 'R125'
T = 300
rho = 1.5
H = Props('H', 'T', T, 'D', rho, fluid)
P = Props('P', 'T', T, 'D', rho, fluid)
print T, rho, H, P

dpdT__rho = DerivTerms('dpdT|rho', T, rho, fluid)
dpdrho__T = DerivTerms('dpdrho|T', T, rho, fluid)
dhdT__rho = DerivTerms('dhdT|rho', T, rho, fluid)
dhdrho__T = DerivTerms('dhdrho|T', T, rho, fluid)
print '*******************************************'
print 'CHECKING DERIVATIVES FROM EOS'
print '*******************************************'
dpdT__rho_num = finite_diff('P', 'T', T, 'D', rho, fluid, 1, 1, 4)
print 'dpdT|rho'
print dpdT__rho
print dpdT__rho_num

dpdrho__T_num = finite_diff('P', 'T', T, 'D', rho, fluid, 2, 1, 4)
print 'dpdrho|T'
print dpdrho__T
print dpdrho__T_num