{{ message }}

Instantly share code, notes, and snippets.

# 7shi/Bessel.ipynb

Last active Sep 24, 2018
Reverse Bessel Polynomial
 { "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import sympy as sb\n", "from IPython.display import display, Math\n", "sb.init_printing()\n", "\n", "plt.rcParams[\"font.size\"] = 12\n", "\n", "fac = sb.factorial\n", "s = sb.Symbol('s')\n", "ω = sb.Symbol('ω',real=True)\n", "\n", "N = 6" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/latex": [ "\$\$\\theta_{0}(s) = 1\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/latex": [ "\$\$\\theta_{1}(s) = s + 1\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/latex": [ "\$\$\\theta_{2}(s) = s^{2} + 3 s + 3\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/latex": [ "\$\$\\theta_{3}(s) = s^{3} + 6 s^{2} + 15 s + 15\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/latex": [ "\$\$\\theta_{4}(s) = s^{4} + 10 s^{3} + 45 s^{2} + 105 s + 105\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/latex": [ "\$\$\\theta_{5}(s) = s^{5} + 15 s^{4} + 105 s^{3} + 420 s^{2} + 945 s + 945\$\$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Reverse Bessel Polynomial\n", "def θn(n):\n", " y = 0\n", " for k in range(n+1):\n", " y += fac(n+k)/(fac(n-k)*fac(k)) * (s**(n-k)/2**k)\n", " return y\n", "\n", "θ = []\n", "for n in range(N):\n", " θ.append(θn(n))\n", " display(Math(r\"\\theta_{%d}(s) = %s\" % (n, sb.latex(θn(n)))))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }