{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "
This is the code from Calculus in Context Section 10.4 to produce the coefficients of the power series for S, I, R.
" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "the_s_coeffs = [45400]\n", "the_i_coeffs = [2100]\n", "the_r_coeffs = [2500]\n", "for k in range(1,10):\n", " sumthing = 0\n", " for j in range(k):\n", " sumthing = sumthing + the_s_coeffs[j]*the_i_coeffs[k - j-1] \n", " the_s_coeffs.append(-.00001*sumthing/(k))\n", " the_i_coeffs.append(-the_s_coeffs[k]-(1/14)*the_i_coeffs[k-1]/(k))\n", " the_r_coeffs.append(((1/14)/(k))*the_i_coeffs[k-1]) \n", "print(the_s_coeffs)\n", "print(the_i_coeffs)\n", "print(the_r_coeffs)" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.0", "language": "", "name": "sagemath" }, "language": "python", "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }