{
 "metadata": {
  "name": "",
  "signature": "sha256:ec1f215eb4df0e5e2bdc002acd107005a2401db562ea545eaf34be0f8fe96c93"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import *\n",
      "from IPython.display import display, Math, Latex\n",
      "from IPython.core.display import display_html\n",
      "init_session(quiet=True, use_latex='mathjax')\n",
      "init_printing()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IPython console for SymPy 0.7.6 (Python 2.7.8-32-bit) (ground types: python)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def format_deriv(arg, itau, idel):\n",
      "    \"\"\" \n",
      "    A function for giving a nice latex representation of \n",
      "    the partial derivative in question \n",
      "    \"\"\"\n",
      "    if itau+idel == 1:\n",
      "        numexp = ''\n",
      "    else:\n",
      "        numexp = '^{{{s:d}}}'.format(s=itau+idel)\n",
      "        \n",
      "    if itau == 0:\n",
      "        tau = ''\n",
      "    elif itau == 1:\n",
      "        tau = '\\\\partial \\\\tau'\n",
      "    else:\n",
      "        tau = '\\\\partial \\\\tau^{{{s:d}}}'.format(s=itau)\n",
      "        \n",
      "    if idel == 0:\n",
      "        delta = ''\n",
      "    elif idel == 1:\n",
      "        delta = '\\\\partial \\\\delta'\n",
      "    else:\n",
      "        delta = '\\\\partial \\\\delta^{{{s:d}}}'.format(s=idel)\n",
      "        \n",
      "    temp = '\\\\frac{{\\\\partial{{{numexp:s}}} {arg:s}}}{{{{{tau:s}}}{{{delta:s}}}}} = '\n",
      "    return temp.format(**locals())"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Derivatives of $\\Delta$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "B_i, a_i, tau, delta, XX = symbols('B_i, a_i, tau, delta, XX')\n",
      "theta = symbols('theta', cls=Function)(tau, delta)\n",
      "Delta = theta**2+B_i*((delta-1)**2)**a_i\n",
      "display(Math('\\\\Delta = ' + latex(Delta)))\n",
      "\n",
      "#c_i, beta_i = symbols('c_i, beta_i')\n",
      "#_theta = (1-tau) + c_i*((delta-1)**2)**(1/(2*beta_i))\n",
      "\n",
      "def deriv(idel, itau):\n",
      "    dd = diff(diff(Delta, tau, itau), delta, idel)\n",
      "    dd = dd.subs(((delta-1)**2)**(a_i)/(delta-1)**idel, XX)\n",
      "    dd = factor(dd, XX)\n",
      "    dd = dd.subs(XX, ((delta-1)**2)**(a_i)/(delta-1)**idel)\n",
      "    \n",
      "    #dd = use(dd, simplify, 1)\n",
      "    display(Math(format_deriv('\\Delta',itau,idel)\n",
      "                 + latex(dd)))\n",
      "    #el = diff(diff(Delta, tau, itau), delta, idel)\n",
      "    #args = dict(c_i = 0.7, beta_i = 0.3, B_i = 0.3, a_i = 3.5, tau = 1.3, delta = 0.9) \n",
      "    #for n in range(1,5):\n",
      "    #    for _itau in range(0,n+1):\n",
      "    #        s = diff(diff(_theta, tau, _itau), delta, n-_itau).subs(args)\n",
      "    #        el = el.replace(diff(diff(theta, tau, _itau), delta, n-_itau), s)\n",
      "    #el = el.subs(theta, _theta)\n",
      "    #print el.subs(args).evalf()\n",
      "\n",
      "for n in range(1,5):\n",
      "    for itau in range(0,n+1):\n",
      "        deriv(itau, n-itau)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\Delta = B_{i} \\left(\\left(\\delta - 1\\right)^{2}\\right)^{a_{i}} + \\theta^{2}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb95fcf8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\Delta}{{\\partial \\tau}{}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb96fac8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\Delta}{{}{\\partial \\delta}} = \\frac{2 B_{i} a_{i} \\left(\\left(\\delta - 1\\right)^{2}\\right)^{a_{i}}}{\\delta - 1} + 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb929630>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta}{{\\partial \\tau^{2}}{}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\left(\\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )}\\right)^{2}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xbb55b00>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta}{{\\partial \\tau}{\\partial \\delta}} = 2 \\left(\\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb6d1908>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta}{{}{\\partial \\delta^{2}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\left(\\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\frac{2 \\left(\\left(\\delta - 1\\right)^{2}\\right)^{a_{i}}}{\\left(\\delta - 1\\right)^{2}} \\left(2 B_{i} a_{i}^{2} - B_{i} a_{i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xcd1b6d8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta}{{\\partial \\tau^{3}}{}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xcd1b898>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta}{{\\partial \\tau^{2}}{\\partial \\delta}} = 2 \\left(\\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xcd1b3c8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta}{{\\partial \\tau}{\\partial \\delta^{2}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + 4 \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb929630>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta}{{}{\\partial \\delta^{3}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + \\frac{2 \\left(\\left(\\delta - 1\\right)^{2}\\right)^{a_{i}}}{\\left(\\delta - 1\\right)^{3}} \\left(4 B_{i} a_{i}^{3} - 6 B_{i} a_{i}^{2} + 2 B_{i} a_{i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xbabd7f0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta}{{\\partial \\tau^{4}}{}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\tau^{4}}  \\theta{\\left (\\tau,\\delta \\right )} + 8 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\left(\\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )}\\right)^{2}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xba8def0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta}{{\\partial \\tau^{3}}{\\partial \\delta}} = 2 \\left(\\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta\\partial \\tau^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 3 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 3 \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xba8d550>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta}{{\\partial \\tau^{2}}{\\partial \\delta^{2}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{2}\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 4 \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 4 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\theta{\\left (\\tau,\\delta \\right )} + 4 \\left(\\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )}\\right)^{2}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xbb55cc0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta}{{\\partial \\tau}{\\partial \\delta^{3}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{3}\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\tau} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\theta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9d6d30>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta}{{}{\\partial \\delta^{4}}} = 2 \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{4}}  \\theta{\\left (\\tau,\\delta \\right )} + 8 \\frac{\\partial}{\\partial \\delta} \\theta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\theta{\\left (\\tau,\\delta \\right )} + 6 \\left(\\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\theta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\frac{2 \\left(\\left(\\delta - 1\\right)^{2}\\right)^{a_{i}}}{\\left(\\delta - 1\\right)^{4}} \\left(8 B_{i} a_{i}^{4} - 24 B_{i} a_{i}^{3} + 22 B_{i} a_{i}^{2} - 6 B_{i} a_{i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb95f908>"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Derivatives of $\\theta$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "A_i, beta_i, tau, delta = symbols('A_i, beta_i, tau, delta')\n",
      "theta = (1-tau) + A_i*((delta-1)**2)**(1/(2*beta_i))\n",
      "display(Math('\\\\theta = ' + latex(theta)))\n",
      "\n",
      "def deriv(idel, itau):\n",
      "    display(Math(format_deriv('\\\\theta',itau,idel)\n",
      "                 + latex( diff(diff(theta, tau, itau), delta, idel)) ))\n",
      "    #print diff(diff(theta, tau, itau), delta, idel).subs(dict(A_i = 0.7, beta_i = 0.3, tau = 1.3, delta = 0.9))\n",
      "\n",
      "for n in range(1,5):\n",
      "    for itau in range(0,n+1):\n",
      "        deriv(itau, n-itau)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\theta = A_{i} \\left(\\left(\\delta - 1\\right)^{2}\\right)^{\\frac{1}{2 \\beta_{i}}} - \\tau + 1$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb713358>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\theta}{{\\partial \\tau}{}} = -1$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb713710>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\theta}{{}{\\partial \\delta}} = \\frac{A_{i} \\left(2 \\delta - 2\\right) \\left(\\left(\\delta - 1\\right)^{2}\\right)^{\\frac{1}{2 \\beta_{i}}}}{2 \\beta_{i} \\left(\\delta - 1\\right)^{2}}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb80eb70>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\theta}{{\\partial \\tau^{2}}{}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb713898>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\theta}{{\\partial \\tau}{\\partial \\delta}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb713f98>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\theta}{{}{\\partial \\delta^{2}}} = \\frac{A_{i} \\left(-1 + \\frac{1}{\\beta_{i}}\\right) \\left(\\left(\\delta - 1\\right)^{2}\\right)^{\\frac{1}{2 \\beta_{i}}}}{\\beta_{i} \\left(\\delta - 1\\right)^{2}}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb718390>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\theta}{{\\partial \\tau^{3}}{}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8a7390>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\theta}{{\\partial \\tau^{2}}{\\partial \\delta}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8a7b38>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\theta}{{\\partial \\tau}{\\partial \\delta^{2}}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8a79b0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\theta}{{}{\\partial \\delta^{3}}} = \\frac{A_{i} \\left(\\left(\\delta - 1\\right)^{2}\\right)^{\\frac{1}{2 \\beta_{i}}}}{\\beta_{i} \\left(\\delta - 1\\right)^{3}} \\left(2 - \\frac{3}{\\beta_{i}} + \\frac{1}{\\beta_{i}^{2}}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8a7f60>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\theta}{{\\partial \\tau^{4}}{}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8abd68>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\theta}{{\\partial \\tau^{3}}{\\partial \\delta}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b0978>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\theta}{{\\partial \\tau^{2}}{\\partial \\delta^{2}}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b06d8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\theta}{{\\partial \\tau}{\\partial \\delta^{3}}} = 0$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b04e0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\theta}{{}{\\partial \\delta^{4}}} = \\frac{A_{i} \\left(\\left(\\delta - 1\\right)^{2}\\right)^{\\frac{1}{2 \\beta_{i}}}}{\\beta_{i} \\left(\\delta - 1\\right)^{4}} \\left(-6 + \\frac{11}{\\beta_{i}} - \\frac{6}{\\beta_{i}^{2}} + \\frac{1}{\\beta_{i}^{3}}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b9b38>"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Derivatives of $\\psi$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "C_i, D_i, tau, delta = symbols('C_i, D_i, tau, delta')\n",
      "psi = exp( -C_i*(delta-1)**2 -D_i*(tau-1)**2)\n",
      "display(Math('\\\\psi = ' + latex(psi)))\n",
      "\n",
      "def deriv(idel, itau):\n",
      "    display(Math(format_deriv('\\\\psi',itau, idel)\n",
      "                 + latex( diff(diff(psi, tau, itau), delta, idel)).replace(latex(psi),'\\psi') ))\n",
      "    #print diff(diff(psi, tau, itau), delta, idel).subs(dict(C_i = 10, D_i = 275, tau= 1.3, delta = 0.9))\n",
      "\n",
      "for n in range(1,5):\n",
      "    for itau in range(0,n+1):\n",
      "        deriv(itau, n-itau)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\psi = e^{- C_{i} \\left(\\delta - 1\\right)^{2} - D_{i} \\left(\\tau - 1\\right)^{2}}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b0a90>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\psi}{{\\partial \\tau}{}} = - D_{i} \\left(2 \\tau - 2\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b06d8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\psi}{{}{\\partial \\delta}} = - C_{i} \\left(2 \\delta - 2\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8db1d0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\psi}{{\\partial \\tau^{2}}{}} = 2 D_{i} \\left(2 D_{i} \\left(\\tau - 1\\right)^{2} - 1\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8d9d30>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\psi}{{\\partial \\tau}{\\partial \\delta}} = C_{i} D_{i} \\left(2 \\delta - 2\\right) \\left(2 \\tau - 2\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8cfa90>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\psi}{{}{\\partial \\delta^{2}}} = 2 C_{i} \\left(2 C_{i} \\left(\\delta - 1\\right)^{2} - 1\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8dbfd0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\psi}{{\\partial \\tau^{3}}{}} = 4 D_{i}^{2} \\left(\\tau - 1\\right) \\left(- 2 D_{i} \\left(\\tau - 1\\right)^{2} + 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8d16d8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\psi}{{\\partial \\tau^{2}}{\\partial \\delta}} = - 2 C_{i} D_{i} \\left(2 \\delta - 2\\right) \\left(2 D_{i} \\left(\\tau - 1\\right)^{2} - 1\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8d1b38>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\psi}{{\\partial \\tau}{\\partial \\delta^{2}}} = 4 C_{i} D_{i} \\left(\\tau - 1\\right) \\left(- 2 C_{i} \\left(\\delta - 1\\right)^{2} + 1\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8d9d30>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\psi}{{}{\\partial \\delta^{3}}} = 4 C_{i}^{2} \\left(\\delta - 1\\right) \\left(- 2 C_{i} \\left(\\delta - 1\\right)^{2} + 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8dbc88>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\psi}{{\\partial \\tau^{4}}{}} = 4 D_{i}^{2} \\left(4 D_{i}^{2} \\left(\\tau - 1\\right)^{4} - 12 D_{i} \\left(\\tau - 1\\right)^{2} + 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b06d8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\psi}{{\\partial \\tau^{3}}{\\partial \\delta}} = - 4 C_{i} D_{i}^{2} \\left(2 \\delta - 2\\right) \\left(\\tau - 1\\right) \\left(- 2 D_{i} \\left(\\tau - 1\\right)^{2} + 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b04e0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\psi}{{\\partial \\tau^{2}}{\\partial \\delta^{2}}} = 4 C_{i} D_{i} \\left(2 C_{i} \\left(\\delta - 1\\right)^{2} - 1\\right) \\left(2 D_{i} \\left(\\tau - 1\\right)^{2} - 1\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0x41e00b8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\psi}{{\\partial \\tau}{\\partial \\delta^{3}}} = 8 C_{i}^{2} D_{i} \\left(\\delta - 1\\right) \\left(\\tau - 1\\right) \\left(2 C_{i} \\left(\\delta - 1\\right)^{2} - 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb86cb70>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\psi}{{}{\\partial \\delta^{4}}} = 4 C_{i}^{2} \\left(4 C_{i}^{2} \\left(\\delta - 1\\right)^{4} - 12 C_{i} \\left(\\delta - 1\\right)^{2} + 3\\right) \\psi$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8b06d8>"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Derivatives of $\\alpha_r$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "n_i, tau, delta = symbols('n_i, tau, delta')\n",
      "Delta_bi = symbols('Delta_bi', cls=Function)(tau, delta)\n",
      "psi = symbols('psi', cls=Function)(tau, delta)\n",
      "alphar = n_i*delta*Delta_bi*psi\n",
      "display(Math('\\\\alpha^{{r}}_{{NA,i}} = ' \n",
      "             + latex(alphar).replace(latex(Delta_bi),'\\Delta^{b_i}')))\n",
      "\n",
      "def collector(a):\n",
      "    return collect(a, Delta_bi)\n",
      "    \n",
      "def deriv(idel, itau):\n",
      "    dd = diff(diff(alphar, tau, itau), delta, idel)\n",
      "    dd = simplify(dd)\n",
      "    dd = use(dd, expand, 2)\n",
      "    display(Math(format_deriv('\\\\alpha^{{r}}_{{NA,i}}',itau,idel)\n",
      "                 + latex(dd).replace(latex(Delta_bi),'\\Delta^{b_i}') ))\n",
      "\n",
      "for n in range(1,5):\n",
      "    for itau in range(0,n+1):\n",
      "        deriv(itau, n-itau)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\alpha^{{r}}_{{NA,i}} = \\delta n_{i} \\Delta^{b_i} \\psi{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb61dd68>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau}{}} = \\delta n_{i} \\left(\\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb86cef0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\alpha^{{r}}_{{NA,i}}}{{}{\\partial \\delta}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} + \\Delta^{b_i} \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4f28>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{2}}{}} = \\delta n_{i} \\left(\\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9d9940>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau}{\\partial \\delta}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} + \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} + \\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9530b8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\alpha^{{r}}_{{NA,i}}}{{}{\\partial \\delta^{2}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} + 2 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} + 2 \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} + 2 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4cf8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{3}}{}} = \\delta n_{i} \\left(\\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta^{b_i} + 3 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9d9940>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{2}}{\\partial \\delta}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta^{b_i} + \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\delta \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} + \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb93d630>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau}{\\partial \\delta^{2}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta^{b_i} + 2 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} + \\delta \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} + 2 \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} + 2 \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0x23b2198>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\alpha^{{r}}_{{NA,i}}}{{}{\\partial \\delta^{3}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta^{b_i} + 3 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} + 3 \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} + 6 \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9462b0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{4}}{}} = \\delta n_{i} \\left(\\Delta^{b_i} \\frac{\\partial^{4}}{\\partial \\tau^{4}}  \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\tau^{4}}  \\Delta^{b_i} + 4 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta^{b_i} + 6 \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb86c240>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{3}}{\\partial \\delta}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{4}}{\\partial \\delta\\partial \\tau^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta\\partial \\tau^{3}}  \\Delta^{b_i} + \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta^{b_i} + 3 \\delta \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta^{b_i} + 3 \\delta \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\delta \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta^{b_i} + 3 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4ef0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau^{2}}{\\partial \\delta^{2}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{4}}{\\partial \\delta^{2}\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{2}\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\delta \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta^{b_i} + \\delta \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\delta \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta^{b_i} + 2 \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta^{b_i} + 4 \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4d68>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\alpha^{{r}}_{{NA,i}}}{{\\partial \\tau}{\\partial \\delta^{3}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{4}}{\\partial \\delta^{3}\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{3}\\partial \\tau}  \\Delta^{b_i} + 3 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta^{b_i} + \\delta \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta^{b_i} + 3 \\delta \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\delta \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta^{b_i} + 6 \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\psi{\\left (\\tau,\\delta \\right )} + 3 \\frac{\\partial}{\\partial \\tau} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 6 \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta^{b_i} + 3 \\frac{\\partial}{\\partial \\tau} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb946080>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\alpha^{{r}}_{{NA,i}}}{{}{\\partial \\delta^{4}}} = n_{i} \\left(\\delta \\Delta^{b_i} \\frac{\\partial^{4}}{\\partial \\delta^{4}}  \\psi{\\left (\\tau,\\delta \\right )} + \\delta \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{4}}  \\Delta^{b_i} + 4 \\delta \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\delta \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta^{b_i} + 6 \\delta \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\Delta^{b_i} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\psi{\\left (\\tau,\\delta \\right )} + 4 \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta^{b_i} + 12 \\frac{\\partial}{\\partial \\delta} \\Delta^{b_i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\psi{\\left (\\tau,\\delta \\right )} + 12 \\frac{\\partial}{\\partial \\delta} \\psi{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta^{b_i}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb86c6a0>"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Derivatives of $\\Delta^{b_i}$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "b_i, tau, delta = symbols('b_i, tau, delta')\n",
      "Delta = symbols('Delta', cls=Function)(tau, delta)\n",
      "\n",
      "#c_i, beta_i, a_i, d_i = symbols('c_i, beta_i, a_i, d_i')\n",
      "#_theta = (1-tau) + c_i*((delta-1)**2)**(1/(2*beta_i))\n",
      "#_Delta = _theta**2+d_i*((delta-1)**2)**a_i\n",
      "#print _Delta\n",
      "\n",
      "def deriv(idel, itau):\n",
      "    dd = diff(diff(Delta**b_i, tau, itau), delta, idel)\n",
      "    dd = use(dd, simplify, 2)\n",
      "    dd = use(dd, factor, 2)\n",
      "    \n",
      "    display(Math(format_deriv('\\\\Delta^{{b_i}}', itau, idel)\n",
      "                 + latex(simplify(dd)) ))\n",
      "    \n",
      "    #el = diff(diff(Delta**b_i, tau, itau), delta, idel)\n",
      "    #args = dict(c_i = 0.7, beta_i = 0.3, d_i = 0.3, a_i = 3.5, b_i = 0.875, tau = 1.3, delta = 0.9) \n",
      "    #for n in range(1,5):\n",
      "    #    for _itau in range(0,n+1):\n",
      "    #        s = diff(diff(_Delta, tau, _itau), delta, n-_itau).subs(args)\n",
      "    #        el = el.replace(diff(diff(Delta, tau, _itau), delta, n-_itau), s)\n",
      "    #el = el.subs(Delta, _Delta)\n",
      "    #print el.subs(args).evalf()\n",
      "\n",
      "for n in range(1,5):\n",
      "    for itau in range(0,n+1):\n",
      "        deriv(itau, n-itau)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "latex": [
        "$$\\frac{\\partial{} \\Delta^{{b_i}}}{{\\partial \\tau}{}} = b_{i} \\Delta^{b_{i} - 1}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb946e80>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{} \\Delta^{{b_i}}}{{}{\\partial \\delta}} = b_{i} \\Delta^{b_{i} - 1}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb93da20>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta^{{b_i}}}{{\\partial \\tau^{2}}{}} = b_{i} \\left(b_{i} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{b_{i} - 2}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb953240>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta^{{b_i}}}{{\\partial \\tau}{\\partial \\delta}} = \\frac{b_{i}}{\\Delta^{3}{\\left (\\tau,\\delta \\right )}} \\left(\\left(b_{i} - 1\\right) \\Delta^{b_{i} + 1}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} + \\Delta^{b_{i} + 2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb946ba8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{2}} \\Delta^{{b_i}}}{{}{\\partial \\delta^{2}}} = b_{i} \\left(b_{i} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{b_{i} - 2}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xc4ddc50>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta^{{b_i}}}{{\\partial \\tau^{3}}{}} = b_{i} \\left(3 \\left(b_{i} - 1\\right) \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + \\left(b_{i}^{2} - 3 b_{i} + 2\\right) \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} + \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 3}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9f97f0>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta^{{b_i}}}{{\\partial \\tau^{2}}{\\partial \\delta}} = b_{i} \\left(b_{i}^{2} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 2 \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{b_{i} - 3}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xc4ddba8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta^{{b_i}}}{{\\partial \\tau}{\\partial \\delta^{2}}} = b_{i} \\left(\\left(b_{i}^{2} - 3 b_{i} + 2\\right) \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} + \\left(2 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + b_{i} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 2 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta{\\left (\\tau,\\delta \\right )} + \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 3}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4710>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{3}} \\Delta^{{b_i}}}{{}{\\partial \\delta^{3}}} = b_{i} \\left(3 \\left(b_{i} - 1\\right) \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + \\left(b_{i}^{2} - 3 b_{i} + 2\\right) \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} + \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 3}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4a58>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta^{{b_i}}}{{\\partial \\tau^{4}}{}} = b_{i} \\left(6 \\left(b_{i}^{2} - 3 b_{i} + 2\\right) \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + \\left(b_{i}^{3} - 6 b_{i}^{2} + 11 b_{i} - 6\\right) \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{4} + \\left(4 b_{i} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i} \\left(\\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} - 4 \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\left(\\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{2}{\\left (\\tau,\\delta \\right )} + \\Delta^{3}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\tau^{4}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 4}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb953240>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta^{{b_i}}}{{\\partial \\tau^{3}}{\\partial \\delta}} = b_{i} \\left(b_{i}^{3} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} + 3 b_{i}^{2} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i}^{2} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 6 b_{i}^{2} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} + b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 9 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 9 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + 11 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} + \\Delta^{3}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} - \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\tau^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 6 \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 6 \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 6 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3}\\right) \\Delta^{b_{i} - 4}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb9e4a20>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta^{{b_i}}}{{\\partial \\tau^{2}}{\\partial \\delta^{2}}} = b_{i} \\left(b_{i}^{3} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + b_{i}^{2} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 4 b_{i}^{2} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + b_{i}^{2} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 6 b_{i}^{2} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + 2 b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 b_{i} \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} - 3 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 12 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 b_{i} \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 11 b_{i} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + \\Delta^{3}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{2}\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 2 \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 2 \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 2 \\Delta^{2}{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} + 2 \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\tau^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 8 \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 6 \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\left(\\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{b_{i} - 4}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8dbac8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta^{{b_i}}}{{\\partial \\tau}{\\partial \\delta^{3}}} = b_{i} \\left(\\left(b_{i}^{3} - 6 b_{i}^{2} + 11 b_{i} - 6\\right) \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{3} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} + \\left(3 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + b_{i} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{2}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{2}{\\left (\\tau,\\delta \\right )} + 3 \\left(b_{i}^{2} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + b_{i}^{2} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 b_{i} \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )} + 2 \\frac{\\partial}{\\partial \\tau} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} + \\Delta^{3}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{3}\\partial \\tau}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 4}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xb8dbac8>"
       ]
      },
      {
       "latex": [
        "$$\\frac{\\partial{^{4}} \\Delta^{{b_i}}}{{}{\\partial \\delta^{4}}} = b_{i} \\left(6 \\left(b_{i}^{2} - 3 b_{i} + 2\\right) \\Delta{\\left (\\tau,\\delta \\right )} \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} \\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )} + \\left(b_{i}^{3} - 6 b_{i}^{2} + 11 b_{i} - 6\\right) \\left(\\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{4} + \\left(4 b_{i} \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} + 3 b_{i} \\left(\\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2} - 4 \\frac{\\partial}{\\partial \\delta} \\Delta{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{3}}{\\partial \\delta^{3}}  \\Delta{\\left (\\tau,\\delta \\right )} - 3 \\left(\\frac{\\partial^{2}}{\\partial \\delta^{2}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right)^{2}\\right) \\Delta^{2}{\\left (\\tau,\\delta \\right )} + \\Delta^{3}{\\left (\\tau,\\delta \\right )} \\frac{\\partial^{4}}{\\partial \\delta^{4}}  \\Delta{\\left (\\tau,\\delta \\right )}\\right) \\Delta^{b_{i} - 4}{\\left (\\tau,\\delta \\right )}$$"
       ],
       "metadata": {},
       "output_type": "display_data",
       "text": [
        "<IPython.core.display.Math at 0xc7a26d8>"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}