Fixed terms in Taylor series #307
This commit is contained in:
parent
3b6d8b6bef
commit
23b0c376a2
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -25,7 +25,7 @@
|
||||
"<IPython.core.display.HTML object>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -66,21 +66,21 @@
|
||||
"\n",
|
||||
"Now we can substitute these values into the equation.\n",
|
||||
"\n",
|
||||
"$$\\sin(x) = \\frac{0}{0!}(x)^0 + \\frac{1}{1!}(x)^1 + \\frac{0}{2!}(x)^2 + \\frac{-1}{3!}(x)^3 + \\frac{0}{4!}(x)^4 + \\frac{-1}{5!}(x)^5 + ... $$\n",
|
||||
"$$\\sin(x) = \\frac{0}{0!}(x)^0 + \\frac{1}{1!}(x)^1 + \\frac{0}{2!}(x)^2 + \\frac{-1}{3!}(x)^3 + \\frac{0}{4!}(x)^4 + \\frac{1}{5!}(x)^5 + ... $$\n",
|
||||
"\n",
|
||||
"And let's test this with some code:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"estimate of sin(.3) is 0.30452025\n",
|
||||
"estimate of sin(.3) is 0.29552025\n",
|
||||
"exact value of sin(.3) is 0.29552020666133955\n"
|
||||
]
|
||||
}
|
||||
@ -89,7 +89,7 @@
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"x = .3\n",
|
||||
"estimate = x + x**3/6 + x**5/120\n",
|
||||
"estimate = x - x**3/6 + x**5/120\n",
|
||||
"exact = np.sin(.3)\n",
|
||||
"\n",
|
||||
"print('estimate of sin(.3) is', estimate)\n",
|
||||
@ -120,7 +120,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.1"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
Loading…
Reference in New Issue
Block a user