# Homework¶

**Turning computational problems in:**

Before 5:00 pm on the date indicated, you must upload a single ”.tgz” or ”.zip” file to Canvas, containing all Matlab functions and scripts as separate ”.m” files, and all Python functions and scripts as ”.py” files. I will run your code, so if your codes have names that do not match the assignment or have capitalization/spelling errors, or if you use non-standard Matlab toolboxes or Python packages, your codes will not run and points will be deducted.

**Turning analytical problems in:**

Before 5:00 on the date indicated, you must upload a single ”.pdf” file to Canvas, containing all of your analytical work for each assignment.

**Homework grading:**

From each homework (where applicable) I will select two problems to grade closely: one analytical and one computational. These will account for 70% of the overall grade. The remaining problems will be awarded a

completiongrade for the remaining 30%.I will grade all analytical problems using the following rubric:

Proof/solution technique:(20% max) – the proof/solution technique should be clearly identifiable, with no missing components.

Logical ordering of steps/arguments:(20% max) – all steps/arguments should follow from previous statements, without “circular” or random ordering, and without any skipped steps.

Justification of steps:(30% max) – all steps/arguments in a should be sufficiently justified (quote major definitions or theorems, explainin sentencesany major steps).

Validity:(30% max) – the proof has no holes or errors, or the calculations contain no mistakes.I will grade all computational problems using the following rubric:

Formatting:(10% max)

- All Matlab scripts must begin with the
`clear`

command.- All files must be indented correctly/consistently.
- All file/function names
must matchthose specified in the assignment.

Commenting:(20% max)

- All files must include your name and a comment header indicating its purpose.
- Function comment headers must document all input and output arguments.
- Accurate commenting is expected
throughoutall files.

Completion/presentation:(20% max)

- All codes must run (even if the output is incorrect).
- All plots must have axis labels, titles, and legends (if multiple curves are plotted) with valid descriptions of the data.
- All printed outputs must be appropriately labeled, with
no extraneous output.

Efficiency/elegance:(20% max)

- Strive for elegance: use loops, functions and whole-array operations to streamline code.
- Strive for efficiency: pre-allocate data, avoid redundant computations or data allocation.
- The code should
not useextraneous packages (e.g. symbolic math toolbox for taking derivatives that are possible by hand).

Accuracy:(30% max) – codes should correctly implement the mathematical algorithms for the targeted problems.

**Late homework:**

Any homework turned in late will lose points based on the following schedule:

- 1 minute to 24 hours – 20%
- 24 hours to 48 hours – 50%
- over 48 hours – no credit

**Honor Code:**

I recommend that students work together to discuss proof strategies, code structure, etc., on homework in this course. However,

all work turned in for credit must represent your own individual effort, and must be in keeping with the SMU Honor Code.Examples of allowed/disallowed collaboration:

Proofs: You can discuss the basic strategy of any proof (e.g. proof by contradiction, important definitions from the book, etc.), including any “tricks” that may be required. However, all actual writing of the proof and all justification of steps must be done on your own, andmust notbe copied from another person (including from the internet).Codes: You can discuss the code structure, including types of functions that are needed, which algorithms to use, and how functions should interact with one another (e.g. input/output arguments). However, youmust write and debugall codes yourself, using your own personal variable/fuction names, comments, and implementation details.

## Assignments¶

- Homework 1:
`Mathematical Background`

(due Sep 7)- Written solutions:
`Written problems`

- Matlab solutions:
`prob5.m`

,`prob6.m`

- Python solutions:
`prob5.py`

,`prob6.py`

- Written solutions:
- Homework 2:
`Nonlinear Solvers`

(due Sep 21)- Written solutions:
`Written problems`

- Matlab solutions:
`newton.m`

,`picard.m`

,`fixed_point.m`

,`aitken_fp.m`

,`prob3.m`

,`prob4.m`

, (testing scripts:`test_picard.m`

and`test_fp.m`

) - Python solutions:
`newton.py`

,`picard.py`

,`fixed_point.py`

,`aitken_fp.py`

,`prob3.py`

,`prob4.py`

, (testing scripts:`test_picard.py`

and`test_fp.py`

)

- Written solutions:
- Homework 3:
`Interpolation Part I`

(due Oct 5)- Written solutions:
`Written problems`

- Matlab solutions:
`lagrange.m`

,`hermite.m (Lagrange form)`

,`hermite2.m (Newton form)`

,`prob3.m`

, (testing script:`test_interp.m`

) - Python solutions:
`lagrange.py`

,`hermite.py (Lagrange form)`

,`hermite2.py (Newton form)`

,`prob3.py`

, (testing script:`test_interp.py`

) **Note:**only one file for Hermite interpolation (Lagrange form*or*Newton form) is required, I provided both approaches in case you tried one but did not succeed.

- Written solutions:
- Homework 4:
`Interpolation Part II`

(due Oct 19)- Written solutions:
`Written problems`

- Matlab solutions:
`cubic_spline_evaluate.m`

,`cubic_spline_coefficients.m`

,`prob3.m`

(testing script:`test_spline.m`

) - Python solutions:
`cubic_spline.py`

,`prob3.py`

(testing script:`test_spline.py`

)

- Written solutions:
- Homework 5:
`Numerical Calculus`

(due Nov 16)- Written solutions:
`Written problems`

- Matlab solutions:
`richardson.m`

,`test_richardson.m`

,`lobatto5.m`

,`test_lobatto.m`

,`composite_quadrature.m`

- Python solutions:
`richardson.py`

,`test_richardson.py`

,`lobatto5.py`

,`test_lobatto.py`

,`composite_quadrature.py`

- Written solutions:
- Homework 5b (optional):
`Adaptive Quadrature`

(due Nov 16)- “Racing” scripts:
`race_lobatto.m`

,`race_lobatto.py`

- My adaptive Lobatto functions:
`adaptive_lobatto.m`

,`adaptive_lobatto.py`

- “Racing” scripts:
- Homework 6:
`Numerical ODEs`

(due Nov 30)- solutions:
`Written problems`

- solutions: