{"id":49848165,"url":"https://github.com/guyi2000/mmda","last_synced_at":"2026-05-14T13:07:44.118Z","repository":{"id":344008164,"uuid":"1179816182","full_name":"guyi2000/mmda","owner":"guyi2000","description":"Code for MMDA course (2026 spring)","archived":false,"fork":false,"pushed_at":"2026-04-23T17:39:10.000Z","size":16172,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T19:29:26.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guyi2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T12:11:10.000Z","updated_at":"2026-04-23T17:39:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/guyi2000/mmda","commit_stats":null,"previous_names":["guyi2000/mmda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guyi2000/mmda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyi2000%2Fmmda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyi2000%2Fmmda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyi2000%2Fmmda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyi2000%2Fmmda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guyi2000","download_url":"https://codeload.github.com/guyi2000/mmda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyi2000%2Fmmda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33026108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-14T13:07:34.699Z","updated_at":"2026-05-14T13:07:44.026Z","avatar_url":"https://github.com/guyi2000.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MMDA Recitation Code Repository\r\n\r\n\u003e Code repository for the **Mathematical Modeling and Data Analysis (MMDA)** recitation sessions at Tsinghua University.\r\n\r\n[![Python](https://img.shields.io/badge/python-3.12-blue)](https://www.python.org/) [![uv](https://img.shields.io/badge/package%20manager-uv-purple)](https://github.com/astral-sh/uv) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen)](https://pre-commit.com/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\r\n\r\n中文文档请见 [README_CN.md](README_CN.md)。\r\n\r\n## Overview\r\n\r\nThis repository contains code and notebooks used in the MMDA recitation sessions, covering topics such as numerical linear algebra, scientific computing, finite-volume methods, and finite-element methods with Python.\r\n\r\n- `pre_class.ipynb`: pre-class notes and warm-up tasks.\r\n- `recitation1.ipynb` to `recitation8.ipynb`: recitation notebooks for progressive practice.\r\n- `notebook/recitation5.ipynb`: finite-difference continuation and finite-volume prerequisites, including sparse Kronecker-form Poisson solvers.\r\n- `notebook/recitation6.ipynb`: Burgers equation (Godunov/FV), 1D FEM (hat + bubble basis), and heat diffusion on both structured and unstructured meshes.\r\n- `notebook/recitation7.ipynb`: Recitation 7 notebook.\r\n- `notebook/recitation8.ipynb`: Bayesian inference notebook (inverse source localization, card-shuffle simulation, and rejection sampling).\r\n- `src/lec2_cl1.py`: benchmark script comparing dense/sparse matrix construction and solving.\r\n- `src/generate_mesh.py`: generate the THU-shaped unstructured mesh (`out/thu_mesh.msh`) using Gmsh.\r\n\r\n## Repository Structure\r\n\r\n```cmd\r\nmmda/\r\n├── notebook/\r\n│   ├── pre_class.ipynb   # Pre-class notes and warm-up\r\n│   ├── recitation1.ipynb # Recitation 1: NumPy / SciPy \u0026 Linear Algebra\r\n│   ├── recitation2.ipynb # Recitation 2 notebook\r\n│   ├── recitation3.ipynb # Recitation 3 notebook\r\n│   ├── recitation4.ipynb # Recitation 4 notebook\r\n│   ├── recitation5.ipynb # Recitation 5: FD continuation \u0026 FV prerequisites\r\n│   ├── recitation6.ipynb # Recitation 6: FV continuation + FEM + heat diffusion\r\n│   ├── recitation7.ipynb # Recitation 7 notebook\r\n│   └── recitation8.ipynb # Recitation 8: Bayesian inference\r\n├── res/\r\n│   └── ...               # Static resources used by notebooks/scripts\r\n├── src/\r\n│   ├── generate_mesh.py   # Gmsh mesh generation for THU geometry\r\n│   ├── lec2_cl1.py        # Lecture/recitation experiment script\r\n│   ├── utils.py           # Utility functions (timing \u0026 memory analysis)\r\n│   └── __init__.py\r\n├── out/                   # Generated figures/animations/meshes from notebooks \u0026 scripts\r\n├── tmp.ipynb              # Temporary notebook for quick experiments\r\n├── LICENSE                # MIT License\r\n├── pyproject.toml         # Project configuration and dependencies\r\n└── uv.lock                # Locked dependency versions (uv)\r\n```\r\n\r\n## Getting Started\r\n\r\n### Prerequisites\r\n\r\n- Python 3.12\r\n- [uv](https://github.com/astral-sh/uv) (recommended package manager)\r\n\r\n### Installation\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/guyi2000/mmda.git\r\ncd mmda\r\n\r\n# Install dependencies with uv\r\nuv sync\r\n```\r\n\r\n### Running Notebooks\r\n\r\nOpen any `.ipynb` file in VS Code or JupyterLab and select the `.venv` kernel created by `uv`.\r\n\r\n### Running Scripts\r\n\r\n```bash\r\n# Run the experiment script\r\nuv run python src/lec2_cl1.py\r\n\r\n# Generate unstructured mesh used by recitation6\r\nuv run python src/generate_mesh.py\r\n```\r\n\r\nGenerated outputs are saved to the `out/` directory, including figures, GIF animations, and mesh files.\r\n\r\nTypical outputs from `recitation6.ipynb` include:\r\n\r\n- `out/heat_diffusion.gif`\r\n- `out/THU_FEM.gif`\r\n- `out/thu_mesh.msh`\r\n\r\n### Recitation 6 Workflow\r\n\r\nFor a clean run of `recitation6.ipynb`, use the following order:\r\n\r\n1. Generate the unstructured mesh:\r\n\r\n```bash\r\nuv run python src/generate_mesh.py\r\n```\r\n\r\n2. Open `notebook/recitation6.ipynb` and run cells from top to bottom.\r\n\r\n3. Check generated files under `out/`:\r\n\r\n- `thu_mesh.msh`\r\n- `heat_diffusion.gif`\r\n- `THU_FEM.gif`\r\n\r\n## Dependencies\r\n\r\n| Package                       | Purpose                               |\r\n| ----------------------------- | ------------------------------------- |\r\n| `numpy`                       | Numerical computing                   |\r\n| `scipy`                       | Scientific computing \u0026 linear algebra |\r\n| `sympy`                       | Symbolic mathematics                  |\r\n| `pandas`                      | Data handling                         |\r\n| `matplotlib` / `scienceplots` | Plotting                              |\r\n| `plotly`                      | Interactive visualization             |\r\n| `gmsh`                        | Unstructured mesh generation          |\r\n| `scikit-fem`                  | FEM assembly and solving              |\r\n| `threadpoolctl`               | Thread control for benchmarks         |\r\n| `ipykernel` / `ipywidgets`    | Jupyter support                       |\r\n\r\n## Code Quality\r\n\r\nThis project uses [pre-commit](https://pre-commit.com/) hooks to enforce code quality:\r\n\r\n```bash\r\n# Install hooks\r\nuv run pre-commit install\r\n\r\n# Run manually on all files\r\nuv run pre-commit run --all-files\r\n```\r\n\r\nHooks include: `uv-lock`, `ruff` (linting \u0026 formatting), `mypy` (type checking), `codespell` (spell checking), `toml-sort`, and standard file hygiene checks.\r\n\r\n## Contact\r\n\r\n顾燚 (Yi Gu) — [guy22@mails.tsinghua.edu.cn](mailto:guy22@mails.tsinghua.edu.cn)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyi2000%2Fmmda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguyi2000%2Fmmda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyi2000%2Fmmda/lists"}