Last active
September 24, 2018 12:47
-
-
Save 7shi/2a7181c7e432f8f08f12ed1ffce0abab to your computer and use it in GitHub Desktop.
Reverse Bessel Polynomial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$$\\theta_{1}(s) = s + 1$$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$$\\theta_{2}(s) = s^{2} + 3 s + 3$$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$$\\theta_{3}(s) = s^{3} + 6 s^{2} + 15 s + 15$$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$$\\theta_{4}(s) = s^{4} + 10 s^{3} + 45 s^{2} + 105 s + 105$$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"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": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References
print
output as LaTeX in jupyter notebook?