kangwonlee / kangwonlee/nmisp

Pedagogy: add classes mini-notebook under 06_python_advanced/

Open
#395 0 comments 0 reactions 0 assignees View on GitHub
pedagogy
Dominant language
Jupyter Notebook
Stars
12
Forks
76
PR merge metrics
No merged PRs in 30d

Description

## Goal

NMISP touches classes very briefly inside `00_introduction/20_python_review.ipynb` but doesn't dedicate space to teaching them. Several later-chapter topics would read more naturally with a class-based API (e.g. an `ODESolver` with `step()` / `solve()` methods, a `Polynomial` with arithmetic, a `Vector2D` for linear-algebra intro). Without a focused classes notebook, those expressions can't be introduced cleanly later.

## Scope

Create `06_python_advanced/40_classes.ipynb` covering:

- Defining a class, `__init__`, attributes
- Methods, including a couple of `__dunder__` examples (`__repr__`, `__add__`)
- Basic inheritance (one parent → one child) with one example
- Brief note on when to use a class vs. a function (don't oversell OOP)

Worked example: `Polynomial` (coefficients list, evaluate at `x`, add two polynomials, derivative). One exercise: extend with `__mul__` or evaluate at an array of `x`s.

Optional second example: `Vector2D` with `__add__`, `__sub__`, `dot`, `__repr__`. Foreshadows `40_linear_algebra_1/`.

## Why

- Without classes, later chapters either avoid OOP entirely (limiting expressiveness) or introduce it inline (interrupting the numerical topic).
- A short, dedicated notebook is the cheapest way to unblock that future flexibility.
- Counter-balance: keep it small. Don't try to teach everything about Python OOP; one example, one exercise, move on.

## Acceptance

- [ ] Notebook executes end-to-end.
- [ ] Polynomial class has at least `__init__`, `evaluate(x)`, `__add__`, `__repr__`.
- [ ] One exercise with a solution cell.
- [ ] Notebook stays short (~25–40 cells); resist scope creep.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading 00_introduction/20_python_review.ipynb and the surrounding notebooks in 06_python_advanced/. Create 06_python_advanced/40_classes.ipynb with the requested Polynomial class, one exercise with a solution, and roughly 25–40 cells. Run the notebook end-to-end; done means it executes cleanly and meets every listed acceptance item.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.