{"id":21394995,"url":"https://github.com/splines/fourier-analysis-basics","last_synced_at":"2025-07-13T18:33:06.198Z","repository":{"id":237271956,"uuid":"794176460","full_name":"Splines/fourier-analysis-basics","owner":"Splines","description":"Learn the basics of Fourier analysis inside a Jupyter notebook. Intended for people with a background in linear algebra.","archived":false,"fork":false,"pushed_at":"2024-06-14T11:07:14.000Z","size":2338,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-08T13:53:30.963Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=SB_8kS_kBMI","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Splines.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}},"created_at":"2024-04-30T15:48:21.000Z","updated_at":"2024-07-08T11:26:42.000Z","dependencies_parsed_at":"2024-04-30T16:57:49.448Z","dependency_job_id":"3ddf59e5-06fe-4bfa-b5da-b734a1327ec7","html_url":"https://github.com/Splines/fourier-analysis-basics","commit_stats":null,"previous_names":["splines/fourier-sage-playground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Splines%2Ffourier-analysis-basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Splines%2Ffourier-analysis-basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Splines%2Ffourier-analysis-basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Splines%2Ffourier-analysis-basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Splines","download_url":"https://codeload.github.com/Splines/fourier-analysis-basics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225908852,"owners_count":17543491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-22T14:17:45.464Z","updated_at":"2024-11-22T14:17:46.065Z","avatar_url":"https://github.com/Splines.png","language":"Jupyter Notebook","readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch2 align=\"center\"\u003e\u003cstrong\u003eBasics of Fourier Analysis\n    \u003cbr\u003e— The Linear Algebra behind sound\u003c/strong\u003e\u003c/h2\u003e\n    \u003cp\u003e\n        \u003ci\u003eA project by Dominic Plein (\u003ca href=\"https://youtube.com/@splience\"\u003e@Splience\u003c/a\u003e) \u0026 Felix Lentze\u003cbr\u003ein the course of a seminar on \u003ca href=\"https://matematiflo.github.io/SoSe_2024/CompAssistedMath2024.html\"\u003ecomputer-assisted maths\u003c/a\u003e.\u003c/i\u003e\n    \u003c/p\u003e\n    \u003ca href=\"https://youtu.be/SB_8kS_kBMI\"\u003e\n        \u003cimg src=\"https://github.com/Splines/fourier-analysis-basics/assets/37160523/6131d0e3-db50-4698-b8eb-5727899811bf\"\n        width=\"550px\" alt=\"Thumbnail of the linked YouTube video\"/\u003e\n    \u003c/a\u003e\u003cbr\u003e\n    \u003cstrong\u003e\u003ca href=\"./src/fourier.ipynb\"\u003eJupyter notebook\u003c/a\u003e\n    | \u003ca href=\"https://youtu.be/SB_8kS_kBMI\"\u003eYouTube Video\u003c/a\u003e\u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\n## Abstract\n\n**In this project, we will discuss what sound is, how to represent it mathematically \u0026 in a computer, and how to examine its frequency content using Fourier analysis. We will use SageMath along the way for the implementation and for interactive plots.** [SageMath](https://www.sagemath.org/) is a free open-source computer algebra system as superset of Python which bundles many great libraries like `numpy`, `scipy`, `matplotlib`, and more. In the frequency domain, we can manipulate the frequency spectrum of a sound as will be demonstrated by implementing a rudimentary low-pass filter to cut off high frequencies of a square wave signal.\n\nThis projected is intended for educational purposes, i.e. we don't focus on performance of our code (for that, see the FFT algorithm implemented in system-level languages like Rust or C++). Basic knowledge of linear algebra as well as Python are required. The key points are explained next to the code. The reader is encouraged to experiment with the code and the provided sound samples.\n\n\u003e [!TIP]\n\u003e Throughout your journey of exploring the amazing world of Fourier in this notebook, you might want to have **the amazing book [Linear algebra, signal proceessing, and wavelets. A unified approach](https://www.uio.no/studier/emner/matnat/math/nedlagte-emner/MAT-INF2360/v15/kompendium/) by Øyvind Ryan** open next to you. When we reference a theorem/definition from this book, we refer to the January 21, 2015 Python edition.\n\n\n## Installation of SageMath (via conda-forge)\n\n\u003e [!WARNING]  \n\u003e In order to execute the cells in the Jupyter notebook, you will have to install a SageMath kernel.\n\nSageMath offers a [great installation guide](https://doc.sagemath.org/html/en/installation/) for different OS. SageMath bundles a huge amount of different packages under one umbrella. This can make it a bit tricky to install. Luckily, for macOS and Linux (including WSL, the Windows Subsystem for Linux), we have Conda. [Conda](https://conda.org/) is a multi-platform package management ecosystem. Community-led distributions are available via [conda-forge](https://conda-forge.org/), including SageMath.\n\nSo, the only real thing you need is a working conda-forge installation. As [described here](https://doc.sagemath.org/html/en/installation/conda.html), you can install Miniforge, a conda-forge distribution. First, download it:\n\n```bash\ncurl -L -O \"https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh\"\n```\n\nThen, run the script to install it:\n\n```bash\nbash Miniforge3-$(uname)-$(uname -m).sh\n```\n\nAfter that, create a new conda environment containing SageMath. (Note that [mamba](https://mamba.readthedocs.io/en/latest/index.html) is a package manager that serves as a faster drop-in replacement for `conda`. It comes pre-installed with Miniforge.)\n\n```script\nmamba create -n sage sage python=3.11\n```\n\nThis will download many packages, so it might take a while. It's also very big (it will install ~350 packages corresponding to ~1GB in size). Also feel free to use another Python version if you prefer.\n\nAfter that, activate the new environment:\n\n```bash\nmamba activate sage\n```\n\nNow you can run `sage` to access the SageMath REPL that you can interact with in the terminal. But your commands won't get persisted, so a Jupyter Notebook might be a better choice. Read on if you want to use SageMath in Jupyter Notebooks inside VSCode.\n\n### Usage of Sage in Jupyter Notebooks in VSCode\n\nThe widespread editor [VSCode](https://code.visualstudio.com/) (Visual Studio Code) has great support for Jupyter notebooks via the [Jupyter extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) (more than 77 Mio. people have already installed it as of April 2024).\n\nThe Jupyter extension itself does _not_ provide a kernel for SageMath, but if you followed along with the installation above, you've already created a working conda environment. VSCode will recognize this and shows you [an option](https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_create-or-open-a-jupyter-notebook) in a Jupyter Notebook to select the SageMath kernel. And that's it, now you can work with SageMath in a Jupyter Notebook locally in VSCode 🎉\n\nIf SageMath does not appear in the kernel list, try to restart VSCode (`Ctrl + Shift + P` to open the command palette, then type in \"Reload\" and click on \"Reload Window\"). You may also want to refer to [the official guide](https://doc.sagemath.org/html/en/installation/launching.html#using-jupyter-notebook-through-visual-studio-code-vs-code-in-wsl). Rebooting your computer might also help.\n\n#### Tips to get the most out of SageMath in Jupyter Notebooks in VSCode\n\nYou might want to add\n\n```py\nfrom sage.all import *\n```\n\nat the beginning of the Jupyter notebook. This way, you will get proper IntelliSense including autocompletion. For example, write `ma` and press `Ctrl + Space` and you will see the available options, e.g. `matrix()`. Note that after first importing all modules, it might take a few seconds for IntelliSense to correctly work and recognize your commands.\n\nIf a cell outputs LaTeX code, but you rather see something like `\\(\\displaystyle \\left(\\begin{array}{rrr}` etc., you can change the cell output presentation to LaTeX by clicking on the three `...` next to a cell, then `Change Presentation` and choose `text/latex`. LaTeX in markdown cells should work out of the box.\n\nIf you prefer to use a JupyterNotebook in the browser, open the terminal (`Ctrl + J` in VSCode), activate sage via `mamba activate sage`, then run `sage -n jupyter`. Your browser will open with a Jupyter Notebook running SageMath and you will see your local files. But this shouldn't have any advantages over the Jupyter Notebook experience in VSCode.\n\n\n\n## License\n\n\u003cp xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dct=\"http://purl.org/dc/terms/\"\u003e\u003ca property=\"dct:title\" rel=\"cc:attributionURL\" href=\"https://github.com/Splines/fourier-analysis-basics\"\u003eThe basics of Fourier Analysis\u003c/a\u003e by \u003ca rel=\"cc:attributionURL dct:creator\" property=\"cc:attributionName\" href=\"https://github.com/splines\"\u003eDominic Plein\u003c/a\u003e \u0026 Felix Lentze is licensed under \u003ca href=\"https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1\" target=\"_blank\" rel=\"license noopener noreferrer\" style=\"display:inline-block;\"\u003eCC BY-SA 4.0\u003cimg style=\"height:22px!important;margin-left:3px;vertical-align:text-bottom;\" src=\"https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1\" alt=\"\"\u003e\u003cimg style=\"height:22px!important;margin-left:3px;vertical-align:text-bottom;\" src=\"https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1\" alt=\"\"\u003e\u003cimg style=\"height:22px!important;margin-left:3px;vertical-align:text-bottom;\" src=\"https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1\" alt=\"\"\u003e\u003c/a\u003e\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplines%2Ffourier-analysis-basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplines%2Ffourier-analysis-basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplines%2Ffourier-analysis-basics/lists"}