Foundations and Exercises
Institute for Mathematical Science, Waseda University
git clone https://github.com/waseda-num-analysis-2026/materials
cd materials
git pull
💡 Not sure how? Just ask your AI — it can run these commands for you.
020/2nd/:
2nd.qmd |
slides (this file) |
2nd.html |
rendered slides — viewable in browser |
2nd-handout.qmd |
editable handout — customise it! |
2nd-handout.html |
rendered handout — viewable in browser |
020/python_guidelines/: Python Guidelines document & notebook.
2nd-handout.qmd into a thread → ask questions in the same thread.What is the radius of the circle whose area is \(2\) ?
\[\pi r^2 = 2 \quad\Longrightarrow\quad r = \sqrt{\dfrac{2}{\pi}}\]
\[10^{40} + 500 - 10^{40} = \;?\]
\[8.3 - 8 = \;?\]
\[\text{Error} = |67.1 - 67| = 0.1 \text{ million years} = 100{,}000 \text{ years}\]
\[\text{Error} = |100{,}037 - 37| = 100{,}000 \text{ years}\]
Let \(x\) be the true value and \(\hat{x}\) be its approximation.
Absolute Error (or simply, Error): \[ |x - \hat{x}| \]
Relative Error (for \(x \neq 0\)): \[ \left|\dfrac{x - \hat{x}}{x}\right| \quad\left(\;\approx \left|\dfrac{x - \hat{x}}{\hat{x}}\right|\;\right) \]
Repository: same as Ex 2.1 | Submit: 2nd-handout.qmd (your edited copy) | Deadline: Apr 30 (Wed), 23:59
While studying 2nd-handout.qmd, insert at least 3 Q&A blocks of your own — questions you actually had while reading, answered with the help of GitHub Copilot (or another AI) following the protocol in AI_TUTOR.md.
How to submit
materials/020/2nd-handout.qmd into the root of your Ex 2 repositoryAI_TUTOR.md § Student Prompt Cookbookgit push💡 The Q&A block format and an English example are at the top of 2nd-handout.qmd.
Repository: Ex 2 — GitHub Classroom | Edit: ex2-1.qmd | Deadline: Apr 24 (today), 23:59
Write two Python functions that take two real numbers and return the absolute error and the relative error, respectively:
abs_error(a, b) — \(|a - b|\)rel_error(a, b) — \(|a - b| / |a|\)where a is the true value and b is the approximate value.
Test your functions on at least 3 pairs of your own choice (e.g. compare math.pi with truncated decimals).
Repository: same as Ex 2.1 | Edit: ex2-2.qmd | Deadline: Apr 24 (today), 23:59
Consider \(\;f(x) = \dfrac{1}{1 - \sqrt{x}}\), which becomes numerically unstable as \(x \to 1\).
f1(x) exactly as given.f2(x).f1(x) and f2(x) for \(x = 0.9,\ 0.99,\ 0.999,\ 0.9999,\ 0.99999\).Hint. Rationalize the denominator: multiply numerator and denominator by \(1 + \sqrt{x}\).
Repository: same as Ex 2.1 | Edit: ex2-3.qmd | Deadline: Apr 30 (Wed), 23:59
Write a Python function solve_quadeq(a, b, c) that returns the two solutions of \(ax^2 + bx + c = 0\ (a \neq 0)\), avoiding cancellation as much as possible.
Apply your function to:
\[ a = 1,\ b = 10^{15},\ c = 10^{14} \qquad\text{and}\qquad a = 1,\ b = -10^{15},\ c = 10^{14} \]
Discuss in your notebook:
Accept the Ex 2 GitHub Classroom link once — one repository for all four parts
ex2-1.qmd, ex2-2.qmd, ex2-3.qmd + your copy of 2nd-handout.qmd for Ex 2.0 (all .qmd)git push — the last commit before each deadline is gradedRecord a 5-minute explanatory video for Ex 2.3 and paste its URL into ex2-3.qmd
Next class: "pair work" for Ex 2.3