未验证 提交 05477287 编写于 作者: R Ryan Palo 提交者: GitHub

Update/rename maclaurin.ipynb to reflect the correct spelling of Maclaurin

上级 912e200e
......@@ -4,9 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Using a Maclauren Series to Estimate $e$\n",
"# Using a Maclaurin Series to Estimate $e$\n",
"\n",
"A [Maclauren series](https://mathworld.wolfram.com/MaclaurinSeries.html) is an infinite series of terms that can be used to approximate more complex functions quickly.\n",
"A [Maclaurin series](https://mathworld.wolfram.com/MaclaurinSeries.html) is an infinite series of terms that can be used to approximate more complex functions quickly.\n",
"\n",
"You're going to approximate $e^x$ by using the first few terms of the series. The series equation for $e^x$ is this:\n",
"\n",
......@@ -39,7 +39,7 @@
"outputs": [],
"source": [
"def e_x(x, terms=10):\n",
" \"\"\"Approximates $e^x$ using 'terms' terms of the Maclauren series\"\"\"\n",
" \"\"\"Approximates $e^x$ using a given number of terms of the Maclaurin series\"\"\"\n",
" n = np.arange(terms)\n",
" return np.sum((x ** n) / fac(n))"
]
......@@ -74,7 +74,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"N (terms)\tMaclauren\tError\n",
"N (terms)\tMaclaurin\tError\n",
"1\t\t1.000\t\t19.086\n",
"2\t\t4.000\t\t16.086\n",
"3\t\t8.500\t\t11.586\n",
......@@ -92,11 +92,11 @@
}
],
"source": [
"print(\"N (terms)\\tMaclauren\\tError\")\n",
"print(\"N (terms)\\tMaclaurin\\tError\")\n",
"\n",
"for n in range(1, 14):\n",
" maclauren = e_x(3, terms=n)\n",
" print(f\"{n}\\t\\t{maclauren:.03f}\\t\\t{e**3 - maclauren:.03f}\")"
" maclaurin = e_x(3, terms=n)\n",
" print(f\"{n}\\t\\t{maclaurin:.03f}\\t\\t{e**3 - maclaurin:.03f}\")"
]
},
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册