Commit a32e43b2 authored by Éamonn Murray's avatar Éamonn Murray

Fix some text

parent 3442f025
......@@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
......@@ -72,9 +70,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"def constant_interp(xvals, yvals, t):\n",
......@@ -136,7 +132,7 @@
"source": [
"### _Task_\n",
"\n",
"- Modify the constant interpolation routine to use return the constant value given by the left value of the interval rather than the right.\n",
"- Modify the constant interpolation routine to return the constant value given by the left value of the interval rather than the right.\n",
"- A slightly better approach might be to take the function value from the nearest sampled x-value. How might you implement this?"
]
},
......@@ -162,9 +158,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"def linear_interp(xvals, yvals, t):\n",
......@@ -281,9 +275,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"def lpoly_interp(xvals, yvals, t):\n",
......@@ -492,9 +484,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"def spline_interp(xvals, yvals, x):\n",
......@@ -670,9 +660,11 @@
"xvals = np.linspace(0, 10, 1001)\n",
"# We use interp1d to generate an interpolating function which will return an interpolated value at any x.\n",
"interp_func = scipy.interpolate.interp1d(x_data, y_data, kind='cubic')\n",
"plt.plot(xvals, interp_func(xvals), 'r-', xplt, spline_interp(x_data, y_data, xplt), 'g-')\n",
"plt.plot(xvals, interp_func(xvals), 'r-', label=\"SciPy\")\n",
"plt.plot(xplt, spline_interp(x_data, y_data, xplt), 'g-', label=\"Our Function\")\n",
"plt.xlabel('x')\n",
"plt.ylabel('Spline Interpolated y')\n",
"plt.legend()\n",
"plt.show()"
]
},
......@@ -774,7 +766,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"version": "3.5.3"
}
},
"nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment