{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from CoolProp.CoolProp import Props\n",
      "from math import sqrt\n",
      "import numpy as np\n",
      "import matplotlib.pyplot as plt\n",
      "import scipy.optimize\n",
      "%matplotlib inline"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Residual Terms"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Pressure"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Presssure is given by\n",
      "$$ \\frac{p}{\\rho R T} = 1+\\delta\\sum_{i=1}^I n_i\\left(\\frac{\\partial A_i(\\tau,\\delta)}{\\partial\\delta} \\right)_{\\tau} $$\n",
      "Set up as a residual\n",
      "$$ \\zeta = \\frac{p}{\\rho R T} - 1-\\delta\\sum_{i=1}^I n_i\\left(\\frac{\\partial A_i(\\tau,\\delta)}{\\partial\\delta} \\right)_{\\tau} $$\n",
      "combine \n",
      "$$ \\zeta = \\frac{p-\\rho R T}{\\rho R T} -\\delta\\sum_{i=1}^I n_i\\left(\\frac{\\partial A_i(\\tau,\\delta)}{\\partial\\delta} \\right)_{\\tau} $$\n",
      "$$ \\zeta = \\frac{p-\\rho R T}{\\rho R T} -\\frac{\\rho}{\\rho_r}\\sum_{i=1}^I n_i\\left(\\frac{\\partial A_i(\\tau,\\delta)}{\\partial\\delta} \\right)_{\\tau} $$\n",
      "We can divide through by $\\rho$ since we know $\\rho$ is non-zero\n",
      "$$ \\zeta = \\frac{p-\\rho R T}{\\rho^2 R T} -\\sum_{i=1}^I n_i\\left(\\frac{1}{\\rho_r}\\frac{\\partial A_i(\\tau,\\delta)}{\\partial\\delta} \\right)_{\\tau} $$\n",
      "to yield the solution from Span, 2000"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Specific heat at constant volume"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Specific heat at constant volume\n",
      "$$ \\frac{c_v}{R} = "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}