Files
cds-numerical-methods/Week 1/04 Runges Phenomenom.ipynb

279 lines
6.3 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"cell_type": "markdown",
"checksum": "4ec40081b048ce2f34f3f4fedbb0be10",
"grade": false,
"grade_id": "cell-98f724ece1aacb67",
"locked": true,
"schema_version": 3,
"solution": false,
"task": false
}
},
"source": [
"# CDS: Numerical Methods Assignments\n",
"\n",
"- See lecture notes and documentation on Brightspace for Python and Jupyter basics. If you are stuck, try to google or get in touch via Discord.\n",
"\n",
"- Solutions must be submitted via the Jupyter Hub.\n",
"\n",
"- Make sure you fill in any place that says `YOUR CODE HERE` or \"YOUR ANSWER HERE\".\n",
"\n",
"## Submission\n",
"\n",
"1. Name all team members in the the cell below\n",
"2. make sure everything runs as expected\n",
"3. **restart the kernel** (in the menubar, select Kernel$\\rightarrow$Restart)\n",
"4. **run all cells** (in the menubar, select Cell$\\rightarrow$Run All)\n",
"5. Check all outputs (Out[\\*]) for errors and **resolve them if necessary**\n",
"6. submit your solutions **in time (before the deadline)**"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"team_members = \"\""
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"cell_type": "markdown",
"checksum": "5f5bac1cd87e461d9f71bc953ede6e88",
"grade": false,
"grade_id": "cell-6332ff6a3f2e689c",
"locked": true,
"schema_version": 3,
"solution": false,
"task": false
}
},
"source": [
"## Runge's Phenomenom\n",
"\n",
"Use your own Lagrange interpolation routine to interpolate the function \n",
"\n",
"$$f(x) = \\frac{1}{1+25x^2}$$ \n",
"\n",
"between $x=-1$ and $x=+1$, using the $x_k$ below. Plot the results and briefly discuss their differences."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "f8cf534735416c308208b1e6ecd2876f",
"grade": true,
"grade_id": "cell-3f6954db97af64ac",
"locked": false,
"points": 0,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"# Import packages here ...\n",
"\n",
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "7a225be5c561586c3b856647471fcc8a",
"grade": true,
"grade_id": "cell-b2343ef4f99a9b76",
"locked": false,
"points": 0,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"# Paste your Lagrange interpolation routine here ...\n",
"\n",
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"cell_type": "markdown",
"checksum": "364ec951d2f6f2f29b57cc4f078f5b2a",
"grade": false,
"grade_id": "cell-f44830695dd3d257",
"locked": true,
"schema_version": 3,
"solution": false,
"task": false
}
},
"source": [
"### Task 1\n",
"\n",
"Use equidistant $x_k = \\frac{2k}{n} - 1$ with $k \\in \\{0, 1, \\dots, n \\}$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "8eb435d8d318786d191583d6f3fcd737",
"grade": true,
"grade_id": "cell-943d2b180794f480",
"locked": false,
"points": 4,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"cell_type": "markdown",
"checksum": "7dfe7433a2609135e3042be4f236a9fc",
"grade": false,
"grade_id": "cell-52109e0ec59901e0",
"locked": true,
"schema_version": 3,
"solution": false,
"task": false
}
},
"source": [
"### Task 2\n",
"\n",
"Use Chebychev nodes $x_k = \\operatorname{cos}\\left(\\frac{2k-1}{2n}\\pi \\right)$ with $k \\in \\{1, \\dots, n \\}$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "8b5b10ede0329670decb875bc2feecf0",
"grade": true,
"grade_id": "cell-3f5e14bdad9903fe",
"locked": false,
"points": 4,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false,
"nbgrader": {
"cell_type": "markdown",
"checksum": "177c1b4e396a12322b975a70a0d4fd83",
"grade": false,
"grade_id": "cell-48ed473fe29dd3b9",
"locked": true,
"schema_version": 3,
"solution": false,
"task": false
}
},
"source": [
"### Task 3\n",
"\n",
"Use $n$ randomly chosen points $x_k$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "4d58b33e15ef5873ab11f66d7c0241f8",
"grade": true,
"grade_id": "cell-644d6105d3263df1",
"locked": false,
"points": 4,
"schema_version": 3,
"solution": true,
"task": false
}
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}