├── .gitattributes ├── .github └── workflows │ ├── ExportNotebooks.yml │ └── KeepCacheFresh.yml ├── .gitignore ├── .vscode ├── extensions.json ├── settings.json └── tasks.json ├── Dockerfile ├── LICENSE.md ├── Procfile ├── README.md ├── Website maintenance.md ├── develop.jl ├── extra_outputs ├── CNAME └── index.html ├── netlify.toml ├── pluto-deployment-environment ├── Manifest.toml ├── PlutoDeployment.toml └── Project.toml ├── src ├── _includes │ ├── layout.jlhtml │ ├── md.jlmd │ └── welcome.md ├── assets │ ├── MIT_logo.svg │ ├── canvas_logo.svg │ ├── cute-one.png │ ├── discord_logo.svg │ ├── favicon.ico │ ├── favicon.svg │ ├── homepage │ │ ├── bg.afdesign │ │ ├── bg.svg │ │ └── swoosh.png │ ├── julia-logo-color.svg │ ├── julia-logo-dark.svg │ ├── mitx_logo.svg │ ├── piazza_logo.svg │ ├── scripts │ │ ├── search.js │ │ └── sidebar.js │ ├── staytuned.png │ ├── styles │ │ ├── homepage.css │ │ ├── index.css │ │ ├── layout.css │ │ ├── lecture_header.css │ │ ├── newdefault.css │ │ └── sidebar.css │ └── zoom_logo.svg ├── cheatsheets.md ├── climate_science │ ├── 2d_advection_diffusion.jl │ ├── advection_and_diffusion.jl │ ├── climate2_snowball_earth.jl │ ├── how_to_collaborate_on_software.jl │ ├── inverse_climate_model.jl │ ├── odes_and_parameterized_types.jl │ ├── optimization_with_JuMP.jl │ ├── our_first_climate_model.jl │ ├── predicting_the_weather.jl │ ├── predictthefuture.svg │ ├── resistors_and_stencils.jl │ └── time_stepping.jl ├── clips.md ├── data_science │ ├── discrete_and_continuous.jl │ ├── linearmodel_datascience.jl │ ├── optimization.jl │ ├── pca.jl │ ├── random_variables_as_types.jl │ ├── random_vars.jl │ ├── random_walks.jl │ ├── random_walks_II.jl │ ├── simulating_component_failure.jl │ └── testCSVwrite.csv ├── higham.jl ├── homework │ ├── hw0.jl │ ├── hw1.jl │ ├── hw10.jl │ ├── hw2.jl │ ├── hw3.jl │ ├── hw4.jl │ ├── hw5.jl │ ├── hw6.jl │ ├── hw7.jl │ ├── hw8.jl │ └── hw9.jl ├── images_abstractions │ ├── .gitignore │ ├── abstraction.jl │ ├── dynamicprograms.jl │ ├── images.jl │ ├── linear_transformation.jl │ ├── newton_method.jl │ ├── notes.pptx │ ├── seamcarving.jl │ ├── structure.jl │ ├── transformations2.jl │ ├── transformations_and_autodiff.jl │ └── transforming_images.jl ├── index.jlmd ├── installation.md ├── logistics.md ├── pluto_export_configuration.json ├── reviews.md ├── search.md ├── semesters.md ├── sidebar data.jl ├── structure.md └── week0 │ └── basic_syntax.jl └── tools └── update_notebook_packages.jl /.gitattributes: -------------------------------------------------------------------------------- 1 | page/* linguist-vendored 2 | * text=auto -------------------------------------------------------------------------------- /.github/workflows/ExportNotebooks.yml: -------------------------------------------------------------------------------- 1 | name: Fall 24 - Export Pluto notebooks & Deploy 2 | on: 3 | push: 4 | branches: 5 | - Fall24 6 | workflow_dispatch: 7 | concurrency: 8 | group: export 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | build-and-deploy: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout Fall 24 source 16 | uses: actions/checkout@v4 17 | 18 | - name: 🙌 Install Julia 19 | uses: julia-actions/setup-julia@v2 20 | with: 21 | version: "1.10.4" 22 | 23 | - name: ⏱ Cache notebook states 24 | uses: actions/cache@v4 25 | with: 26 | path: _cache 27 | key: ${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }} 28 | restore-keys: | 29 | ${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} 30 | 31 | - name: ⏱ Cache .julia 32 | uses: actions/cache@v4 33 | with: 34 | path: ~/.julia 35 | key: ${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }} 36 | restore-keys: | 37 | ${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} 38 | 39 | - name: 📅 Checkout Fall20, Spring21, Fall22, Fall23 output 40 | uses: actions/checkout@v4 41 | with: 42 | path: Fall23-output 43 | ref: Fall23-output 44 | 45 | - name: 🪴 Generate site 46 | run: | 47 | julia --project=pluto-deployment-environment -e ' 48 | import Pkg 49 | Pkg.instantiate() 50 | import PlutoPages 51 | 52 | PlutoPages.generate("."; html_report_path="generation_report.html") 53 | 54 | cp("./netlify.toml", "./_site/netlify.toml")' 55 | env: 56 | JULIA_PKG_SERVER: "" 57 | 58 | 59 | - name: 📰 Upload site generation report 60 | uses: actions/upload-artifact@v4 61 | if: always() 62 | with: 63 | path: generation_report.html 64 | 65 | - name: 🔀 Combine semesters into single site 66 | run: | 67 | mkdir www 68 | mv Fall23-output/Fall20/ www/Fall20 69 | mv Fall23-output/Spring21/ www/Spring21 70 | mv Fall23-output/Fall22/ www/Fall22 71 | mv Fall23-output/Fall23/ www/Fall23 72 | mv _site www/Fall24 73 | mv extra_outputs/* www 74 | 75 | - name: 🚀 Deploy to GitHub Pages 76 | uses: JamesIves/github-pages-deploy-action@v4 77 | with: 78 | token: ${{ secrets.GITHUB_TOKEN }} 79 | branch: Fall24-output 80 | folder: www 81 | -------------------------------------------------------------------------------- /.github/workflows/KeepCacheFresh.yml: -------------------------------------------------------------------------------- 1 | name: Keep caches fresh 2 | on: 3 | schedule: 4 | - cron: "5 4 1/4 * *" # every 4 days 5 | concurrency: 6 | group: export 7 | cancel-in-progress: false 8 | 9 | jobs: 10 | build-and-deploy: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout Fall 24 source 14 | uses: actions/checkout@v4 15 | 16 | - name: ⏱ Cache notebook states 17 | uses: actions/cache@v4 18 | with: 19 | path: _cache 20 | key: ${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }} 21 | restore-keys: | 22 | ${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} 23 | 24 | - name: ⏱ Cache .julia 25 | uses: actions/cache@v4 26 | with: 27 | path: ~/.julia 28 | key: ${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }} 29 | restore-keys: | 30 | ${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} 31 | 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | 4 | reduced_phil.png 5 | notebooks/week9/testCSVwrite.csv 6 | 7 | _cache 8 | _site 9 | generation_report.html 10 | src/week9/testCSVwrite.csv 11 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. 3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp 4 | 5 | // List of extensions which should be recommended for users of this workspace. 6 | "recommendations": [ 7 | "esbenp.prettier-vscode", 8 | "julialang.language-julia", 9 | ], 10 | // List of extensions recommended by VS Code that should not be recommended for users of this workspace. 11 | "unwantedRecommendations": [ 12 | 13 | ] 14 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.jlmd": "markdown", 4 | "*.jlhtml": "html", 5 | }, 6 | 7 | "prettier.printWidth": 160, 8 | "prettier.tabWidth": 4, 9 | "prettier.semi": false, 10 | "prettier.quoteProps": "consistent", 11 | "prettier.singleQuote": false, 12 | 13 | "editor.formatOnSave": false, 14 | "[javascript]": { 15 | "editor.defaultFormatter": "esbenp.prettier-vscode", 16 | "editor.formatOnSave": true 17 | }, 18 | "[css]": { 19 | "editor.defaultFormatter": "esbenp.prettier-vscode", 20 | "editor.formatOnSave": true 21 | } 22 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "PlutoPages: run development server", 8 | "type": "shell", 9 | "command": "julia develop.jl", 10 | "group": "build" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Hi there! 2 | 3 | # This Dockerfile does _not_ run the Pluto notebooks. You can _not_ use it to work on the homework exercises. Instead, take a look at our website to learn how to get started with Pluto: http://computationalthinking.mit.edu . If you want to run a Pluto Container (e.g. for homework) take a look here: https://github.com/JuliaPluto/docker-stacks 4 | 5 | # This is an internal Dockerfile for the Pluto "@bind server" for the course website. It runs all the sliders, buttons and camera inputs, so that you can interact with them directly on the website, without having to wait for binder or a local Pluto session. 6 | # Take a look at https://github.com/JuliaPluto/PlutoSliderServer.jl for more info. 7 | 8 | # -fonsi 9 | 10 | FROM julia:1.10.4 11 | 12 | # HTTP port 13 | EXPOSE 1234 14 | RUN apt-get update -y && apt-get upgrade -y 15 | # add a new user called "pluto" 16 | RUN useradd -ms /bin/bash pluto 17 | # set the current directory 18 | WORKDIR /home/pluto 19 | # run the rest of commands as pluto user 20 | USER pluto 21 | # copy the contents of the github repository into /home/pluto 22 | COPY --chown=pluto . ${HOME} 23 | 24 | 25 | # Initialize the julia project environment that will be used to run the bind server. 26 | RUN julia --project=${HOME}/pluto-deployment-environment -e "import Pkg; Pkg.instantiate(); Pkg.precompile()" 27 | 28 | # The "default command" for this docker thing. 29 | CMD ["julia", "--project=/home/pluto/pluto-deployment-environment", "-e", "import PlutoSliderServer; PlutoSliderServer.run_directory(\".\"; SliderServer_port=1234 , SliderServer_host=\"0.0.0.0\")"] -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The material in this repository is licensed as follows: 2 | 3 | - The **code** is under the [MIT license](https://opensource.org/licenses/MIT). 4 | 5 | - The **text** is under the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0). 6 | 7 | 8 | Copyright Alan Edelman, David P. Sanders and Fons van der Plas, 2024 -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: julia --project="pluto-deployment-environment" -e "import PlutoSliderServer; PlutoSliderServer.run_directory(\".\"; port=$PORT , host=\"0.0.0.0\")" 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to computational thinking for real-world problems 2 | 3 |

Go to course website :balloon:

4 | 5 | Welcome to **MIT 18.C25 aka 6.C25**, **Fall 2024** edition! 6 | _For older semesters, see: 7 | - Fall 2023: [source code](https://github.com/mitmath/18S191/tree/Fall23) and [website](https://computationalthinking.mit.edu/Fall24/semesters/) 8 | - Fall 2022: [source code](https://github.com/mitmath/18S191/tree/Fall22) and [website](https://computationalthinking.mit.edu/Fall24/semesters/) 9 | - Spring 2021: [source code](https://github.com/mitmath/18S191/tree/Fall24) and [website](https://computationalthinking.mit.edu/Fall24/semesters/) 10 | - Fall 2020: [source code](https://github.com/mitmath/18S191/tree/Fall20) and [website](https://computationalthinking.mit.edu/Fall24/semesters/) 11 | - Spring 2020: [website](https://computationalthinking.mit.edu/Fall24/semesters/) 12 | - Fall 2019: [source code](https://github.com/dpsanders/6.S083_fall_2019/tree/fall_2019) 13 | 14 | This is an introductory course on Computational Thinking. We use the [Julia programming language](http://www.julialang.org) to approach real-world problems in varied areas applying data analysis and computational and mathematical modeling. In this class you will learn computer science, software, algorithms, applications, and mathematics as an integrated whole. 15 | 16 | Topics include: 17 | 18 | - Image analysis 19 | - Machine Learning 20 | - Network theory 21 | - Climate modeling 22 | 23 | # Go to [computationalthinking.mit.edu](https://computationalthinking.mit.edu/) to learn more! 24 | -------------------------------------------------------------------------------- /Website maintenance.md: -------------------------------------------------------------------------------- 1 | # Website maintenance 2 | 3 | This document describes how the website works. 4 | 5 | # Overview 6 | 7 | This is the source code for the computational thinking website! It uses a site generation system inspired by [https://www.11ty.dev/](https://www.11ty.dev/), but there are only three template systems: 8 | - **`.jlhtml` files** are rendered by [HypertextLiteral.jl](https://github.com/JuliaPluto/HypertextLiteral.jl) 9 | - **`.jlmd` files** are rendered by [MarkdownLiteral.jl](https://github.com/JuliaPluto/MarkdownLiteral.jl) 10 | - **`.jl` files** are rendered by [PlutoSliderServer.jl](https://github.com/JuliaPluto/PlutoSliderServer.jl) 11 | 12 | The `/src/` folder is scanned for files, and all files are turned into HTML pages. 13 | 14 | Paths correspond to URLs. For example, `src/data_science/pca.jl` will become available at `https://computationalthinking.mit.edu/data_science/pca/`. For files called *"index"*, the URL will point to its parent, e.g. `src/docs/index.jlmd` becomes `https://computationalthinking.mit.edu/docs/`. Remember that changing URLs is very bad! You can't share this site with your friends if the links break. 15 | 16 | > **To add something to our website, just create a new file!** Fons will be happy to figure out the technical bits. 17 | 18 | You can generate & preview the website locally (more on this later), and we have a github action generating the website when we push to the `Fall23` branch. The result (in the `Fall23-output` branch) is deployed with GitHub Pages. 19 | 20 | # Content 21 | 22 | ## Literal templates 23 | We use *Julia* as our templating system! Because we use HypertextLiteral and MarkdownLiteral, you can write regular Markdown files and HTML files, but you can also include `$(interpolation)` to spice up your documents! For example: 24 | 25 | ```markdown 26 | # Hey there! 27 | 28 | This is some *text*. Here is a very big number: $(1 + 1). 29 | ``` 30 | 31 | Besides small inline values, you can also write big code blocks, with `$(begin ... end)`, and you can output HTML. Take a look at some of our files to learn more! 32 | 33 | ## Pluto notebooks 34 | 35 | Pluto notebooks will be rendered to HTML and included in the page. What you see is what you get! 36 | 37 | On a separate system, we are running a PlutoSliderServer that is synchronized to the `Fall23` brach. This makes our notebooks interactive! 38 | 39 | Notebook outputs are **cached** (for a long time) by the file hash. This means that a notebook file will only ever run once, which makes it much faster to work on the website. If you need to re-run your notebook, add a space somewhere in the code :) 40 | 41 | ## `.css`, `.html`, `.gif`, etc 42 | 43 | Web assets go through the system unchanged. 44 | 45 | # Front matter 46 | 47 | Like many SSG systems, we use [*front matter*](https://www.11ty.dev/docs/data-frontmatter/) to add metadata to pages. In `.jlmd` files, this is done with a front matter block, e.g.: 48 | ```markdown 49 | --- 50 | title: "🌼 How to install" 51 | description: "Instructions to install Pluto.jl" 52 | tags: ["docs", "introduction"] 53 | layout: "md.jlmd" 54 | --- 55 | 56 | # Let's install Pluto 57 | 58 | here is how you do it 59 | ``` 60 | 61 | Every page **should probably** include: 62 | - *`title`*: Will be used in the sidebar, on Google, in the window header, and on social media. 63 | - *`description`*: Will be used on hover, on Google, and on social media. 64 | - *`tags`*: List of *tags* that are used to create collections out of pages. Our sidebar uses collections to know which pages to list. (more details in `sidebar data.jl`) 65 | - *`layout`*: The name of a layout file in `src/_includes`. For basic Markdown or HTML, you probably want `md.jlmd`. For Pluto, you should use `layout.jlhtml`. 66 | 67 | ## How to write front matter 68 | For `.jlmd` files, see the example above. 69 | 70 | For `.jl` notebooks, use the [Frontmatter GUI](https://github.com/fonsp/Pluto.jl/pull/2104) built into Pluto. 71 | 72 | For `.jlhtml`, we still need to figure something out 😄. 73 | 74 | # Running locally 75 | 76 | ## Developing *content, styles, etc.* 77 | 78 | Open this repository in VS Code, and install the recommended extensions. 79 | 80 | To start running the development server, open the VS Code *command palette* (press `Cmd+Shift+P`), and search for **`Tasks: Run Task`**, then **`PlutoPages: run development server`**. The first run can take some time, as it builds up the notebook outputs cache. Leave it running. 81 | 82 | This will start two things in parallel: the PlutoPages.jl development server (which generates the static website), and a static file server (with LiveServer.jl). It will open two tabs in your browser: one is the generation dashboard (PlutoPages.jl), the other is the current site preview (LiveServer.jl). 83 | 84 | Whenever you edit a file, PlutoPages will automatically regenerate! Refresh your browser tab. If it does not pick up the change, go to the generation dashboard and click the "Read input files again" button. 85 | 86 | This workflow is recommended for writing static content, styles, and for site maintenance. But for writing Pluto notebooks, it's best to prepare the notebook first, and then run the site (because it re-runs the entire notebook on any change). 87 | -------------------------------------------------------------------------------- /develop.jl: -------------------------------------------------------------------------------- 1 | cd(@__DIR__) 2 | 3 | @assert VERSION >= v"1.6.0" 4 | 5 | import Pkg 6 | Pkg.activate("./pluto-deployment-environment") 7 | Pkg.instantiate() 8 | import PlutoPages 9 | 10 | PlutoPages.develop(@__DIR__) 11 | -------------------------------------------------------------------------------- /extra_outputs/CNAME: -------------------------------------------------------------------------------- 1 | computationalthinking.mit.edu -------------------------------------------------------------------------------- /extra_outputs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [[headers]] 2 | for = "/*" 3 | [headers.values] 4 | Access-Control-Allow-Origin = "*" 5 | -------------------------------------------------------------------------------- /pluto-deployment-environment/PlutoDeployment.toml: -------------------------------------------------------------------------------- 1 | [Export] 2 | baked_state = false 3 | baked_notebookfile = false 4 | offer_binder = true 5 | slider_server_url="https://computationalthinking-sliderserver-droplet.plutojl.org" 6 | ignore_cache = [ 7 | "index.jl", 8 | ] 9 | create_index = false 10 | exclude = [ 11 | # these are in the repo but not used on the website 12 | "*/linear_transformation.jl", 13 | "*/OLD_linear_transformation.jl", 14 | "*/simulating_component_failure_live.jl", 15 | "*/discrete_and_continuous_old.jl", 16 | "*/pascal.jl", 17 | "*/snowballearth_original.jl", 18 | "tools/*", 19 | "PlutoPages.jl", 20 | ] 21 | 22 | [SliderServer] 23 | port = 8080 24 | host = "0.0.0.0" 25 | exclude=[ 26 | # these are in the repo but not used on the website 27 | "*/linear_transformation.jl", 28 | "*/OLD_linear_transformation.jl", 29 | "*/simulating_component_failure_live.jl", 30 | "*/discrete_and_continuous_old.jl", 31 | "*/pascal.jl", 32 | "*/snowballearth_original.jl", 33 | "tools/*", 34 | "PlutoPages.jl", 35 | 36 | # not interactive 37 | "*/basic_syntax.jl", 38 | "*/structure.jl", 39 | "*/how_to_collaborate_on_software.jl", 40 | 41 | # don't run homeworks 42 | "*/hw*.jl", 43 | ] 44 | -------------------------------------------------------------------------------- /pluto-deployment-environment/Project.toml: -------------------------------------------------------------------------------- 1 | [deps] 2 | BetterFileWatching = "c9fd44ac-77b5-486c-9482-9798bd063cc6" 3 | CommonMark = "a80b9123-70ca-4bc0-993e-6e3bcb318db6" 4 | Deno_jll = "04572ae6-984a-583e-9378-9577a1c2574d" 5 | Gumbo = "708ec375-b3d6-5a57-a7ce-8257bf98657a" 6 | HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" 7 | JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 8 | LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637" 9 | Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" 10 | MarkdownLiteral = "736d6165-7244-6769-4267-6b50796e6954" 11 | Memoize = "c03570c3-d221-55d1-a50c-7939bbd78826" 12 | Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 13 | Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781" 14 | PlutoHooks = "0ff47ea0-7a50-410d-8455-4348d5de0774" 15 | PlutoLinks = "0ff47ea0-7a50-410d-8455-4348d5de0420" 16 | PlutoPages = "d5dc3dd1-4774-47c7-8860-0a1ad9e34b8c" 17 | PlutoSliderServer = "2fc8631c-6f24-4c5b-bca7-cbb509c42db4" 18 | PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 19 | ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c" 20 | ThreadsX = "ac1d9e8a-700a-412c-b207-f0111f4b6c0d" 21 | URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" 22 | Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 23 | YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" 24 | -------------------------------------------------------------------------------- /src/_includes/layout.jlhtml: -------------------------------------------------------------------------------- 1 | $(begin 2 | import Pluto 3 | "The contents of `` from a Pluto HTML export." 4 | const pluto_head = let 5 | default = Pluto.generate_html(; 6 | pluto_cdn_root=Pluto.PLUTO_VERSION < v"0.19" ? "https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@9ca70c36/frontend/" : nothing) 7 | m = match(r"(.*)"s, default) 8 | reduce([ 9 | # r""s 10 | r"" 11 | r"" 12 | r"" 13 | r"" 14 | ]; init=m[1]) do s,r 15 | replace(s, r => "") 16 | end |> HTML 17 | end 18 | 19 | f(x,y) = get(page.output.frontmatter, x, y) 20 | 21 | function section_number(frontmatter) 22 | ch = get(frontmatter, "chapter", nothing) 23 | se = get(frontmatter, "section", nothing) 24 | 25 | isnothing(ch) || isnothing(se) ? nothing : "$(ch).$(se)" 26 | end 27 | 28 | nothing 29 | end) 30 | 31 | 32 | $(f("title", splitext(basename(page.input.relative_path))[1])) — Interactive Computational Thinking — MIT 33 | $(let d = f("description", nothing) 34 | if d !== nothing 35 | @htl("""""") 36 | end 37 | end) 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | $(pluto_head) 60 | 61 | 62 | 63 |
64 | 65 | 162 |
163 | $(any(contains("lecture"), f("tags", String[])) ? @htl(""" 164 |
165 |

Section $(f("chapter", "-")).$(f("section", "-"))

166 |

$( 167 | f("title", basename(page.input.relative_path)) 168 | )

169 | 170 |
171 | 172 |

Lecture Video

173 |
174 | 175 |
176 |
177 |
178 | """) : nothing) 179 | $(content) 180 |
181 |
182 | 183 | 184 | -------------------------------------------------------------------------------- /src/_includes/md.jlmd: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "layout.jlhtml" 3 | --- 4 | 5 |
6 |
7 | $(content) 8 |
9 |
-------------------------------------------------------------------------------- /src/_includes/welcome.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "layout.jlhtml" 3 | --- 4 | 5 | 6 | 7 |
17 |

MIT students: Sign up for the Fall 2024 edition of this class!

Register for 18C25, 6C25, etc:
"Julia: Solving Real-World Problems with Computation" (catalog link)

22 |

Counts for course 6 and course 18 majors, etc.

25 | 26 | 29 | 30 | 31 | 35 | 36 |
37 |
38 |

Highlights

39 |
40 |
41 |
42 |

Real-world problems

43 |

We will take applications such as climate change and show how you can participate in the big open source community looking to find solutions to challenging problems with exposure to github and parallel computing.

44 |
45 |
46 | An interactive lecture about climate economics. You can see the user moving the global CO2 emissions in one graph, and a second graph with global temperatures over 200 years responds. 47 |
48 |
49 |
50 |
51 |

Corgi in the washing machine

52 |

You will learn mathematical ideas by immersion into the mathematical process, performing experiments, seeing the connections, and seeing just how much fun math can be.

53 |
54 |
55 | An image of prof. Philip the Corgi, but the whole image is swirled and twisted using a mathematical transformation. Overlaying grid lines are also twisted, showing the non-linearity of the transformation. 56 |
57 |
58 |
59 |
60 |

Revolutionary interactivity

61 |

Our course material is built using real code, and instead of a book, we have a series of interactive notebooks. On our website, you can play with sliders, buttons and images to interact with our simulations. You can even go further, and modify and run any code on our website!

62 |
63 |
64 | An interactive lecture about the Newton method. A parabolic function is graphed, and we use sliders to control the number of iterations of the Newton method. Each iteration shows a tangent, demonstrating the algorithm. 65 |
66 |
67 |
68 |
69 |

Learning Julia

70 |

In literature it’s not enough to just know the technicalities of grammar. In music it’s not enough to learn the scales. The goal is to communicate experiences and emotions. For a computer scientist, it’s not enough to write a working program, the program should be written with beautiful high level abstractions that speak to your audience. This class will show you how.

71 |
72 |
73 | A snippet of Julia code defining a new type called Sphere, with fields 'position', 'radius' and 'index of refration'. 74 |
75 |
76 |
77 |
78 |
79 |

Why is this course different?

80 | 83 |

We believe many classes cover what we call the vertices — specific topics in computer science, math, or an application. 84 | A student is left to figure out the edges, meaning the intellectual connections between the topics on their own as they mature. 85 | Some classes have you learn a math topic and you can then for homework implement an algorithm or application. The goal 86 | for this class, is to accelerate the process by which a student can participate in the exciting world of software development 87 | be it the big open source universe or privately, by seeing how math with CS abstractions can allow for applications that can 88 | be part of a big huge ecosystem rather than a one-off homework. 89 |
90 | … and have more fun in the process! 91 |

92 |
93 |
94 |

Subjects

95 |
$( 96 | let 97 | sidebar_data = Base.include(@__MODULE__, joinpath(@__DIR__, "..", "sidebar data.jl")) 98 | sections = sidebar_data["main"] 99 | 100 | [ 101 | @htl(""" 102 | $([ 103 | let 104 | input = other_page.input 105 | output = other_page.output 106 | 107 | name = get(output.frontmatter, "title", basename(input.relative_path)) 108 | desc = get(output.frontmatter, "description", nothing) 109 | tags = get(output.frontmatter, "tags", String[]) 110 | 111 | image = get(output.frontmatter, "image", nothing) 112 | 113 | class = [ 114 | "no-decoration", 115 | ("tag_$(replace(x, " "=>"_"))" for x in tags)..., 116 | ] 117 | 118 | image === nothing || isempty(image) ? nothing : @htl(""" 119 |

$(name)

120 | 121 |
""") 122 | end for other_page in pages 123 | ]) 124 | """) 125 | for (section_name, pages) in sections 126 | ] 127 | end 128 | )
129 |
130 |
131 |

Three fields, one course

132 |
133 |
134 |
135 |

Computer Science

136 |
    137 |
  • visualization
  • 138 |
  • structure, abstraction
  • 139 |
  • type systems
  • 140 |
  • multiple dispatch
  • 141 |
  • dynamic dispatch
  • 142 |
  • two-language problem
  • 143 |
  • expression problem
  • 144 |
  • functional programming
  • 145 |
  • arrays
  • 146 |
  • matrices
  • 147 |
  • dataframes
  • 148 |
  • git, github
  • 149 |
  • version control
  • 150 |
  • collaboration
  • 151 |
  • devops
  • 152 |
  • language design
  • 153 |
  • constraint solvers
  • 154 |
  • mathematical programming solvers
  • 155 |
  • heuristics
  • 156 |
  • DSLs
  • 157 |
158 |
159 |
160 |

Mathematics

161 |
    162 |
  • matrices
  • 163 |
  • stencils
  • 164 |
  • univariate/multivariate functions
  • 165 |
  • vector calculus
  • 166 |
  • matrix calculus
  • 167 |
  • sequence convergence
  • 168 |
  • principal component analysis
  • 169 |
  • dimensionality reduction
  • 170 |
  • matrix rank
  • 171 |
  • projections, rotations
  • 172 |
  • eigenvalues
  • 173 |
  • singular value decomposition
  • 174 |
  • outliers, noise
  • 175 |
  • data bulk, data center
  • 176 |
  • statistics
  • 177 |
  • correlation
  • 178 |
  • random sampling
  • 179 |
  • probability density function
  • 180 |
  • monte carlo methods
  • 181 |
  • random walks
  • 182 |
  • continuous limit
  • 183 |
  • ordinary differential equations
  • 184 |
  • curve fitting
  • 185 |
  • partial differential equations
  • 186 |
  • finite differences
  • 187 |
  • discretization
  • 188 |
  • bifurcations
  • 189 |
  • hysteresis
  • 190 |
  • optimization
  • 191 |
  • gradient descent
  • 192 |
  • global optimization
  • 193 |
  • constrained optimization
  • 194 |
  • nonlinear optimization
  • 195 |
  • inverse modeling
  • 196 |
197 |
198 |
199 |

Applications

200 |
    201 |
  • social science
  • 202 |
  • epidemic modelling
  • 203 |
  • agent based modelling
  • 204 |
  • climate economics
  • 205 |
  • climate science
  • 206 |
  • weather forecasting
  • 207 |
  • ocean/atmosphere models
  • 208 |
  • optimisation
  • 209 |
  • path finding
  • 210 |
  • image data
  • 211 |
  • image filtering
  • 212 |
  • seam carving
  • 213 |
  • data analysis
  • 214 |
  • model fitting
  • 215 |
  • random data
  • 216 |
217 |
218 |
219 |
220 |
221 |
222 |

Details

223 |
224 |

See also the course repository github.com/mitmath/computational-thinking.

225 |
226 |

227 |
228 |

What people are saying about the course!

229 |
230 |

Meet our staff

231 |

Lecturers: Alan Edelman, David P. Sanders, Charles E. Leiserson

232 |

Technical lead: Fons van der Plas

233 |

Assistants: Bola Malek, Logan Kilpatrick

234 |

Guest lecturers: Henri F. Drake, Fons van der Plas, more to be announced

235 |

Get the T-shirt

236 |

There is a MIT Computational Thinking t-shirt available for those who really enjoyed the course, you can find it on the Julia Language's Bonfire Shop.

237 |

Introduction video from Fall 2020

238 | 239 |
240 |

How to cite

241 |

If you use or are inspired by any material, would you be so kind to prominently display

242 |
Some material on this website is based on:
Computational Thinking, a live online Julia/Pluto textbook. (computationalthinking.mit.edu)
243 |
244 |
245 | 249 |
250 |
-------------------------------------------------------------------------------- /src/assets/MIT_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/assets/cute-one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/cute-one.png -------------------------------------------------------------------------------- /src/assets/discord_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 24 | 25 | -------------------------------------------------------------------------------- /src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/favicon.ico -------------------------------------------------------------------------------- /src/assets/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/assets/homepage/bg.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/homepage/bg.afdesign -------------------------------------------------------------------------------- /src/assets/homepage/bg.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/homepage/swoosh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/homepage/swoosh.png -------------------------------------------------------------------------------- /src/assets/julia-logo-color.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/assets/julia-logo-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/assets/mitx_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 14 | 17 | 20 | 22 | 24 | 26 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/assets/piazza_logo.svg: -------------------------------------------------------------------------------- 1 | 12 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/assets/scripts/search.js: -------------------------------------------------------------------------------- 1 | const root_href = document.head.querySelector("link[rel='root']").getAttribute("href") 2 | 3 | const minby = (arr, fn) => arr.reduce((a, b) => (fn(a) < fn(b) ? a : b)) 4 | const maxby = (arr, fn) => arr.reduce((a, b) => (fn(a) > fn(b) ? a : b)) 5 | const range = (length) => [...Array(length).keys()] 6 | 7 | const sortby = (arr, fn) => arr.sort((a, b) => fn(a) - fn(b)) 8 | 9 | const setup_search_index = async () => { 10 | const search_data_href = document.head.querySelector("link[rel='pp-search-data']").getAttribute("href") 11 | console.log(search_data_href) 12 | 13 | const search_data = await (await fetch(search_data_href)).json() 14 | window.search_data = search_data 15 | 16 | console.log(search_data) 17 | 18 | // create a search bar powered by lunr 19 | // const search_bar = document.createElement('div') 20 | // search_bar.id = 'search-bar' 21 | // search_bar.innerHTML = ` 22 | // 23 | //
24 | // ` 25 | // document.body.appendChild(search_bar) 26 | 27 | // create a search index 28 | const before = Date.now() 29 | const search_index = window.lunr(function () { 30 | this.ref("url") 31 | 32 | this.field("title", { boost: 10 }) 33 | this.field("tags", { boost: 5 }) 34 | this.field("text") 35 | this.metadataWhitelist = ["position"] 36 | search_data.forEach(function (doc) { 37 | this.add(doc) 38 | }, this) 39 | }) 40 | const after = Date.now() 41 | console.info(`lunr: Indexing ${search_data.length} documents took ${after - before}ms`) 42 | window.search_index = search_index 43 | 44 | return { search_data, search_index } 45 | } 46 | 47 | const excerpt_length = 200 48 | const excerpt_padding = 50 49 | 50 | const init_search = async () => { 51 | const query = new URLSearchParams(window.location.search).get("q") 52 | console.warn({ query }) 53 | 54 | document.querySelector(".search-bar.big input").value = query 55 | 56 | const { search_data, search_index } = await setup_search_index() 57 | 58 | if (query) { 59 | const results = search_index.search(query) 60 | console.log(results) 61 | 62 | const search_results = document.getElementById("search-results") 63 | 64 | if (results.length !== 0) { 65 | search_results.innerHTML = "" 66 | results.forEach((result) => { 67 | const { url, title, tags, text } = search_data.find((doc) => doc.url === result.ref) 68 | const result_div = document.createElement("a") 69 | result_div.classList.add("search-result") 70 | result_div.innerHTML = ` 71 |

72 |

73 |

74 | ` 75 | console.log(root_href) 76 | result_div.querySelector(".title").innerText = title 77 | result_div.href = new URL(url, new URL(root_href, window.location.href)).href 78 | result_div.querySelector(".tags").innerText = tags.join(", ") 79 | result_div.querySelector(".snippet").innerText = text.substring(0, excerpt_length) + "..." 80 | 81 | const text_match_positions = Object.values(result?.matchData?.metadata ?? {}) 82 | .flatMap((z) => z?.text?.position ?? []) 83 | .sort(([a, _a], [b, _b]) => a - b) 84 | const title_match_positions = Object.values(result?.matchData?.metadata ?? {}) 85 | .flatMap((z) => z?.title?.position ?? []) 86 | .sort(([a, _a], [b, _b]) => a - b) 87 | 88 | console.error(title_match_positions) 89 | if (title_match_positions.length > 0) { 90 | const strong_el = document.createElement("strong") 91 | strong_el.innerText = title 92 | result_div.querySelector(".title").innerHTML = `` 93 | result_div.querySelector(".title").appendChild(strong_el) 94 | } 95 | 96 | if (text_match_positions.length > 0) { 97 | // console.log(text_match_positions) 98 | // console.log(find_longest_run(text_match_positions, 50)) 99 | // console.log(find_longest_run(text_match_positions, 100)) 100 | // console.log(find_longest_run(text_match_positions, 200)) 101 | // console.log(find_longest_run(text_match_positions, 300)) 102 | // console.log(find_longest_run(text_match_positions, 400)) 103 | 104 | const [start_index, num_matches] = find_longest_run(text_match_positions, excerpt_length) 105 | 106 | const excerpt_start = text_match_positions[start_index][0] 107 | const excerpt_end = excerpt_start + excerpt_length 108 | 109 | const highlighted_ranges = text_match_positions.slice(start_index, start_index + num_matches) 110 | 111 | const elements = highlighted_ranges.flatMap(([h_start, h_length], i) => { 112 | const h_end = h_start + h_length 113 | const word = text.slice(h_start, h_end) 114 | const filler = text.slice(h_end, highlighted_ranges[i + 1]?.[0] ?? excerpt_end) 115 | const word_el = document.createElement("strong") 116 | word_el.innerText = word 117 | return [word_el, filler] 118 | }) 119 | 120 | const snippet_p = result_div.querySelector(".snippet") 121 | snippet_p.innerHTML = `` 122 | ;["...", text.slice(excerpt_start - excerpt_padding, excerpt_start).trimStart(), ...elements, "..."].forEach((el) => snippet_p.append(el)) 123 | } 124 | 125 | // text_match_positions.slice(start_index, start_index + num_matches).forEach(([start, length]) => { 126 | 127 | search_results.appendChild(result_div) 128 | }) 129 | } else { 130 | search_results.innerText = `No results found for "${query}"` 131 | } 132 | } 133 | } 134 | 135 | const count = (arr, fn) => arr.reduce((a, b) => fn(a) + fn(b), 0) 136 | 137 | const find_longest_run = (/** @type{Array<[number, number]>} */ positions, max_dist) => { 138 | const legal_run_size = (start_index) => 139 | positions.slice(start_index).filter(([start, length]) => start + length < positions[start_index][0] + max_dist).length 140 | 141 | console.warn(range(positions.length).map(legal_run_size)) 142 | 143 | const best_start = maxby(range(positions.length), legal_run_size) 144 | const best_length = legal_run_size(best_start) 145 | return [best_start, best_length] 146 | } 147 | 148 | window.init_search = init_search 149 | -------------------------------------------------------------------------------- /src/assets/scripts/sidebar.js: -------------------------------------------------------------------------------- 1 | const sidebar = document.querySelector("#pages-sidebar") 2 | const layout = document.querySelector("#pages-layout") 3 | const navtoggle = document.querySelector("#toggle-nav") 4 | 5 | document.querySelector("#toggle-nav").addEventListener("click", function (e) { 6 | console.log(e) 7 | layout.classList.toggle("pages_show_sidebar") 8 | e.stopPropagation() 9 | }) 10 | 11 | window.addEventListener("click", function (e) { 12 | if (!sidebar.contains(e.target) && !navtoggle.contains(e.target)) { 13 | layout.classList.remove("pages_show_sidebar") 14 | } 15 | }) 16 | 17 | document.querySelectorAll(".track-chooser select").forEach((trackSelect) => { 18 | const ontrack = () => { 19 | let track = trackSelect.value 20 | 21 | localStorage.setItem("chosen track", track) 22 | 23 | let lectures_homeworks = Array.from(sidebar.querySelectorAll(".lecture,.homework")) 24 | 25 | lectures_homeworks.forEach((el) => { 26 | let intrack = track === "" || el.classList.contains(`tag_track_${track}`) || el.classList.contains(`tag_welcome`) 27 | el.classList.toggle("not_in_track", !intrack) 28 | }) 29 | } 30 | 31 | trackSelect.value = localStorage.getItem("chosen track") 32 | ontrack() 33 | trackSelect.addEventListener("change", ontrack) 34 | }) 35 | -------------------------------------------------------------------------------- /src/assets/staytuned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/staytuned.png -------------------------------------------------------------------------------- /src/assets/styles/homepage.css: -------------------------------------------------------------------------------- 1 | @import url("newdefault.css"); 2 | 3 | body { 4 | background: url("../homepage/bg.svg"); 5 | background-color: hsl(231deg 14% 57%); 6 | background-size: cover; 7 | backdrop-filter: blur(3vw); 8 | } 9 | main h1 { 10 | font-family: "Vollkorn", serif; 11 | font-weight: 800; 12 | font-style: italic; 13 | margin-block-end: 0.5em; 14 | font-size: 3rem; 15 | margin-block-start: 0; 16 | border-bottom: 5px solid #74747414; 17 | letter-spacing: -0.2px; 18 | color: #424250; 19 | padding: 0px 10px; 20 | text-shadow: 7px 5px 0px #e5dbb8; 21 | } 22 | 23 | a { 24 | text-decoration: none; 25 | /* background: #f3f3ff; */ 26 | /* border: 3px solid; */ 27 | color: black; 28 | /* border-bottom: 0.2em solid rgba(0, 0, 0, 0.3); */ 29 | } 30 | .homepage a:not(.no-decoration) { 31 | background-position: 0 0.83em; 32 | background-repeat: repeat-x; 33 | background-size: 2px 8px; 34 | background-image: linear-gradient(to bottom, rgba(165, 213, 235, 0.3) 33%, rgba(165, 213, 235, 0.3)); 35 | /* text-shadow: 2px 2px white, 2px -2px white, -2px 2px white, -2px -2px white; */ 36 | transition: background-position 50ms linear, background-size 50ms linear; 37 | } 38 | 39 | a:hover { 40 | background-position: 0 0em; 41 | background-size: 2px auto; 42 | } 43 | 44 | div.banner { 45 | min-height: 20rem; 46 | display: grid; 47 | place-items: center; 48 | } 49 | 50 | div.banner h1 { 51 | transform: perspective(187px) rotate3d(0, 2, 0, 0deg); 52 | font-family: "Alegreya", sans-serif; 53 | background: #000000ad; 54 | padding: 0.2em 0.5em; 55 | margin: 0px 10px; 56 | border-radius: 0.4em; 57 | transition: transform 200ms ease-in-out; 58 | color: #ffffffc7; 59 | font-style: normal; 60 | border: none; 61 | backdrop-filter: blur(6px); 62 | /* flex: 1 1 auto; */ 63 | /* display: block; */ 64 | } 65 | div.banner h1 strong { 66 | color: white; 67 | } 68 | 69 | div.banner:hover h1 { 70 | /* transform: perspective(187px) rotate3d(0, 2, 0, 3deg) scale(1.05); */ 71 | } 72 | 73 | #title { 74 | background-image: url("../homepage/swoosh.png"); 75 | 76 | background-size: cover; 77 | image-rendering: pixelated; 78 | } 79 | 80 | img.logo { 81 | position: absolute; 82 | top: 5px; 83 | left: 5px; 84 | z-index: 10; 85 | height: 2rem; 86 | background: #ffffff96; 87 | padding: 3px; 88 | } 89 | 90 | .twocols { 91 | column-count: 2; 92 | color: #fffffff7; 93 | background: linear-gradient(155deg, #7c7e87, #5a594a); 94 | } 95 | 96 | main { 97 | /* background: white; */ 98 | padding: 1em; 99 | max-width: 86rem; 100 | z-index: -1; 101 | margin: 3em auto 0 auto; 102 | } 103 | main > div { 104 | z-index: 4; 105 | background: white; 106 | padding: 2rem; 107 | margin-block-end: 15rem; 108 | border-radius: 1rem; 109 | box-shadow: 0px 6px 7px #1c12120d; 110 | 111 | max-width: 700px; 112 | margin-left: auto; 113 | margin-right: auto; 114 | } 115 | 116 | main > div.wide { 117 | max-width: unset; 118 | } 119 | 120 | main > div:last-of-type { 121 | margin-block-end: 0px; 122 | } 123 | main > div > *:last-child, 124 | main > div > .contain > *:last-child { 125 | margin-block-end: 0px; 126 | margin-bottom: 0em; 127 | } 128 | main thingy { 129 | background: #ff00005e; 130 | width: 300vw; 131 | border-radius: 50%; 132 | height: 60vh; 133 | display: block; 134 | /* position: unset; */ 135 | z-index: -4; 136 | /* transform: translate(10px, -64px); */ 137 | /* transform: rotate(11deg); */ 138 | } 139 | .asdf { 140 | position: absolute; 141 | transform: translate(-); 142 | overflow: hidden; 143 | max-width: 100vw; 144 | } 145 | .contain { 146 | max-width: 700px; 147 | margin-left: auto; 148 | margin-right: auto; 149 | } 150 | 151 | blockquote { 152 | border-left: 0.6em solid #b97777; 153 | padding: 0.5em 1em; 154 | max-width: 30em; 155 | font-style: italic; 156 | background: #f9f9f9; 157 | font-size: 1rem; 158 | margin: 0 auto; 159 | } 160 | 161 | blockquote.banner { 162 | margin-top: -46px; 163 | font-style: unset; 164 | font-size: 1rem; 165 | border-radius: 0.5em; 166 | box-shadow: 0px 3px 17px #0000001a; 167 | } 168 | 169 | .pillars { 170 | display: flex; 171 | flex-direction: row; 172 | justify-content: space-between; 173 | overflow-x: auto; 174 | } 175 | 176 | .pillars > div { 177 | color: white; 178 | padding: 1em; 179 | background: #434366; 180 | min-height: 300px; 181 | flex: 1 1 33%; 182 | margin: 0px 10px; 183 | } 184 | 185 | .scrolly { 186 | /* max-height: 20em; */ 187 | /* overflow-y: auto; */ 188 | } 189 | .pillars > div ul { 190 | padding-left: 0.6rem; 191 | } 192 | .pillars > div li { 193 | list-style: "- "; 194 | margin-bottom: 0.3rem; 195 | margin-right: 0.5rem; 196 | } 197 | .pillars > div li::marker { 198 | color: rgba(255, 255, 255, 0.4); 199 | } 200 | 201 | .subjects { 202 | display: grid; 203 | grid-template-columns: repeat(3, auto); 204 | grid-gap: 1rem; 205 | /* display: flex; */ 206 | /* flex-wrap: wrap; */ 207 | } 208 | 209 | @media (max-width: 1350px) { 210 | .subjects { 211 | grid-template-columns: repeat(2, auto); 212 | } 213 | } 214 | @media (max-width: 850px) { 215 | .subjects { 216 | grid-template-columns: repeat(1, auto); 217 | } 218 | } 219 | 220 | @media (min-width: 1250px) { 221 | .subjectscontainer { 222 | display: flex; 223 | flex-direction: row; 224 | margin-block-start: 15rem; 225 | } 226 | 227 | .subjectscontainer h1 { 228 | flex-shrink: 0; 229 | position: sticky; 230 | top: 100px; 231 | align-self: flex-start; 232 | margin-block-start: 0px; 233 | /* padding-right: 0; */ 234 | margin-right: 1em; 235 | } 236 | } 237 | 238 | .subjects > a { 239 | display: block; 240 | border: 7px solid #c19d1c1f; 241 | min-height: 200px; 242 | min-width: min(90vw, 188px); 243 | padding: 1em; 244 | border-radius: 1em; 245 | transition: transform 100ms ease-in-out; 246 | /* width: 27%; */ 247 | box-shadow: 0px 6px 7px #1c12120d; 248 | } 249 | 250 | .subjects > a:hover { 251 | transform: scale(1.05); 252 | } 253 | 254 | .subjects > a img { 255 | max-width: 100%; 256 | width: 100%; 257 | } 258 | section { 259 | display: flex; 260 | flex-direction: row; 261 | background: linear-gradient(145deg, #a6b8ef, #daeaff); 262 | padding: 1em; 263 | background-repeat: repeat-x; 264 | border-radius: 1em; 265 | margin-bottom: 2em; 266 | } 267 | 268 | .shadow, 269 | section { 270 | box-shadow: 0px 6px 9px #0606060f; 271 | padding: 1rem; 272 | border-radius: 1rem; 273 | } 274 | 275 | @media (max-width: 500px) { 276 | section { 277 | flex-direction: column; 278 | } 279 | } 280 | 281 | section > div { 282 | flex: 1 1 60%; 283 | } 284 | 285 | section > div.content { 286 | margin-right: 1em; 287 | } 288 | section > div.preview { 289 | flex: 0 1 40%; 290 | } 291 | 292 | section > div.preview > img { 293 | width: 100%; 294 | } 295 | 296 | .github-logo { 297 | width: 1em; 298 | } 299 | 300 | .homepage, 301 | .banner { 302 | color: #3c3c3c; 303 | } 304 | -------------------------------------------------------------------------------- /src/assets/styles/index.css: -------------------------------------------------------------------------------- 1 | /* a minimalist set of CSS resets */ 2 | 3 | @import url("https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.css"); 4 | @import url("lecture_header.css"); 5 | @import url("newdefault.css"); 6 | 7 | /* @import url('https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.18.0/frontend/vollkorn.css'); */ 8 | /* @import url('https://fonts.googleapis.com/css2?family=Jaldi:wght@400;700&display=swap'); */ 9 | /* @import url('https://fonts.googleapis.com/css2?family=Jaldi:wght@400;700&family=Work+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&family=Yantramanav:wght@400;500;700;900&display=swap'); */ 10 | 11 | *, 12 | *:before, 13 | *:after { 14 | box-sizing: inherit; 15 | } 16 | 17 | :root { 18 | --system-fonts: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", 19 | "Segoe UI Symbol", system-ui, sans-serif; 20 | --system-fonts-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 21 | 22 | --fg: #000; 23 | --faded-1: #858585; 24 | --faded-2: rgb(161, 161, 161); 25 | --sidebar-accent-1: #c89393; 26 | --search-bg: hsl(78deg 10% 85%); 27 | --search-bg-accent: #f4f4f5; 28 | 29 | --track-bg: hsl(56 50% 94% / 1); 30 | --track-bg-accent: #a3987c; 31 | } 32 | 33 | @media (prefers-color-scheme: dark) { 34 | :root { 35 | --fg: #ddd; 36 | --faded-1: #b3b3b3; 37 | --faded-2: #999999; 38 | 39 | --sidebar-accent-1: #d0a493; 40 | --search-bg: #363b33; 41 | --search-bg-accent: #4d6542; 42 | 43 | --track-bg: #545346; 44 | --track-bg-accent: #dad1b9; 45 | } 46 | } 47 | 48 | /* adjust typography defaults */ 49 | body { 50 | margin: 0; 51 | padding: 0; 52 | /* font-family: Noto; */ 53 | /* font-family: sans-serif; */ 54 | /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; */ 55 | width: 100vw; 56 | overflow-x: hidden; 57 | background: hsl(235deg 19% 16%); 58 | color: var(--pluto-output-color); 59 | 60 | /* background: url(bg.svg); */ 61 | /* background-color: hsl(231deg 14% 57%); */ 62 | /* background-size: cover; */ 63 | word-break: break-word; 64 | } 65 | 66 | .pages-markdown p, 67 | .pages-markdown ol { 68 | line-height: 1.5; 69 | } 70 | 71 | .pages-markdown h1, 72 | .pages-markdown h2 { 73 | font-weight: 800; 74 | } 75 | 76 | .pages-markdown h1, 77 | .pages-markdown h2, 78 | .pages-markdown h3, 79 | .pages-markdown h4, 80 | .pages-markdown h5, 81 | .pages-markdown h6 { 82 | color: var(--pluto-output-h-color); 83 | } 84 | 85 | pre { 86 | tab-size: 4; 87 | white-space: pre-wrap; 88 | word-break: break-word; 89 | } 90 | 91 | pre, 92 | code { 93 | font-family: var(--system-fonts-mono); 94 | } 95 | 96 | /* images and videos max out at full width */ 97 | img, 98 | video { 99 | height: auto; 100 | max-width: 100%; 101 | } 102 | 103 | a { 104 | font-weight: 500; 105 | text-decoration: none; 106 | } 107 | .pages-markdown a, 108 | .pages-markdown a:visited { 109 | color: #4674bc; 110 | } 111 | a:hover { 112 | text-decoration: underline; 113 | } 114 | h1 a, 115 | h2 a, 116 | h3 a { 117 | font-weight: inherit; 118 | } 119 | 120 | a.arrow::after { 121 | content: " →"; 122 | } 123 | card-text > a.arrow { 124 | margin-top: auto; 125 | } 126 | 127 | /* SIDEBAR LOGO */ 128 | 129 | a.pluto_home_link img { 130 | height: 1.2em; 131 | width: 1.2em; 132 | } 133 | a.pluto_home_link { 134 | font-size: 1.7em; 135 | font-weight: 800; 136 | color: inherit; 137 | padding: 0.3em; 138 | display: flex; 139 | flex-direction: row; 140 | align-items: center; 141 | gap: 0.5ch; 142 | } 143 | 144 | .sidebar-about .logos { 145 | display: flex; 146 | flex-direction: row; 147 | gap: 1em; 148 | padding: 1em; 149 | align-items: center; 150 | } 151 | 152 | .sidebar-about .logos picture { 153 | flex: 1 1 auto; 154 | min-width: 0; 155 | height: auto; 156 | object-fit: contain; 157 | } 158 | 159 | .sidebar-about .course-numbers { 160 | opacity: 0.6; 161 | } 162 | .sidebar-about .course-numbers > span { 163 | font-family: var(--system-fonts-mono); 164 | font-size: 0.9em; 165 | } 166 | .sidebar-about .course-numbers::before { 167 | /* content: " | "; */ 168 | } 169 | 170 | .semester-details, 171 | .authors { 172 | border-radius: var(--border-radius); 173 | padding: var(--child-padding); 174 | } 175 | .semester-details > a { 176 | font-weight: 700; 177 | } 178 | 179 | #pages-sidebar h1 { 180 | font-size: 1.4rem; 181 | margin-block-end: 0px; 182 | margin: 0; /* line-height: 1; */ 183 | } 184 | 185 | #pages-sidebar h2 { 186 | font-size: 1rem; 187 | font-weight: 500; 188 | font-style: italic; 189 | opacity: 0.8; 190 | margin-block-start: 0.2em; 191 | } 192 | 193 | .authors { 194 | color: var(--faded-2); 195 | } 196 | .authors { 197 | color: var(--faded-2); 198 | } 199 | #pages-sidebar .authors > a { 200 | color: var(--fg); 201 | } 202 | 203 | .search-result strong { 204 | --bg-color: #73731e94; 205 | background: var(--bg-color); 206 | outline: 0.15em solid var(--bg-color); 207 | border-radius: 0.1em; 208 | } 209 | 210 | #pages-sidebar .search-bar form { 211 | display: flex; 212 | flex-direction: row; 213 | } 214 | #pages-sidebar .search-bar input[type="search"] { 215 | flex: 1 1 auto; 216 | min-width: 0px; 217 | } 218 | 219 | a.search-result, 220 | a.search-result:visited { 221 | color: inherit; 222 | display: block; 223 | text-decoration: none; 224 | background: var(--search-bg); 225 | padding: 0.7rem; 226 | margin: 2rem 1rem 2rem 0rem; 227 | --br: 0.4em; 228 | border-radius: var(--br); 229 | position: relative; 230 | } 231 | 232 | .search-result h3 { 233 | margin-block-start: 0; 234 | } 235 | 236 | .search-result .tags { 237 | opacity: 0.6; 238 | font-family: var(--system-fonts-mono); 239 | } 240 | 241 | a.search-result::before { 242 | content: ""; 243 | display: block; 244 | position: absolute; 245 | z-index: -1; 246 | --off: -3px; 247 | top: var(--off); 248 | right: var(--off); 249 | left: var(--off); 250 | bottom: var(--off); 251 | background: var(--search-bg-accent); 252 | transform: rotate(356.9deg) translate(0px, 0px); 253 | border-radius: var(--br); 254 | } 255 | 256 | .student-feedback .card { 257 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); 258 | margin: 1rem 0rem; 259 | border-radius: 0.4rem; 260 | padding: 0.2rem 1rem; 261 | } 262 | 263 | @media (prefers-color-scheme: dark) { 264 | .student-feedback .card { 265 | background: #4b4b4b; 266 | } 267 | } 268 | .student-feedback .card-container { 269 | padding: 4px 16px; 270 | } 271 | .student-feedback .card-container::after, 272 | .student-feedback .row::after { 273 | content: ""; 274 | clear: both; 275 | display: table; 276 | } 277 | .student-feedback .semester { 278 | opacity: 0.6; 279 | } 280 | .student-feedback .feedback { 281 | /* margin-top: 0.5em; */ 282 | } 283 | 284 | .student-feedback { 285 | margin-bottom: 4rem; 286 | } 287 | 288 | blockquote.twitter-tweet { 289 | margin: 0rem; 290 | } 291 | 292 | /* modify Pluto's styles to avoid a visual glitch. This will make the header always display fixed at the top. */ 293 | 294 | body:not(.asdfsdfa) pluto-editor:not(.asdffdas) header#pluto-nav { 295 | position: fixed; 296 | top: 0; 297 | left: 56px; 298 | right: 56px; 299 | z-index: 1998; 300 | width: auto; 301 | border-radius: 0 0 10px 10px; 302 | } 303 | 304 | /* Make space for the Pluto header */ 305 | body.binder:not(.offer_binder) { 306 | padding-top: 60px; 307 | } 308 | 309 | /* Another strategy: leave the header in place but make the export menu hidden when it is not opened. */ 310 | /* 311 | header.show_export aside#export { 312 | visibility: initial; 313 | } 314 | 315 | aside#export { 316 | visibility: hidden; 317 | } */ 318 | -------------------------------------------------------------------------------- /src/assets/styles/layout.css: -------------------------------------------------------------------------------- 1 | /* COLOR */ 2 | 3 | #pages-layout { 4 | /* --bg-color: set by pluto */ 5 | --sidebar-bg: #fafafa; 6 | --sidebar-color: rgb(82, 82, 82); 7 | --sidebar-li-active-bg: rgb(235, 235, 235); 8 | --sidebar-li-hover-bg: rgb(247, 240, 190); 9 | } 10 | @media (prefers-color-scheme: dark) { 11 | #pages-layout { 12 | --sidebar-bg: #303030; 13 | --sidebar-color: rgb(255, 255, 255); 14 | --sidebar-li-active-bg: rgb(82, 82, 82); 15 | --sidebar-li-hover-bg: rgb(108, 94, 70); 16 | } 17 | } 18 | 19 | /* LAYOUT */ 20 | 21 | #pages-layout { 22 | display: flex; 23 | flex-direction: row; 24 | min-height: 100vh; 25 | align-items: stretch; 26 | } 27 | 28 | #pages-sidebar { 29 | font-family: system-ui, sans-serif; 30 | flex: 0 0 auto; 31 | width: 15rem; 32 | font-weight: 400; 33 | z-index: 1900; 34 | } 35 | 36 | #pages-content { 37 | display: block; 38 | flex: 1 1 auto; 39 | min-width: 0; 40 | } 41 | 42 | #pages-sidebar > div { 43 | margin: 1rem; 44 | margin-right: 0; 45 | padding: 0.5rem; 46 | /* padding-bottom: 2rem; */ 47 | border-radius: 1rem; 48 | background: var(--sidebar-bg); 49 | color: var(--sidebar-color); 50 | } 51 | 52 | #toggle-nav { 53 | display: none; 54 | cursor: pointer; 55 | } 56 | 57 | /* SIDEBAR COLLAPSING */ 58 | 59 | #pages-content::after { 60 | content: ""; 61 | z-index: 23400; 62 | touch-action: none; 63 | pointer-events: none; 64 | position: fixed; 65 | top: 0; 66 | left: 0; 67 | right: 0; 68 | bottom: 0; 69 | transition: background-color 0.2s ease-out; 70 | } 71 | 72 | @media screen and (max-width: 768px) { 73 | #pages-layout { 74 | flex-direction: column; 75 | } 76 | #toggle-nav { 77 | display: inline-flex; 78 | align-self: start; 79 | border: none; 80 | background: none; 81 | } 82 | #toggle-nav::after { 83 | --size: 40px; 84 | content: " "; 85 | display: inline-block; 86 | width: var(--size); 87 | height: var(--size); 88 | background-image: url(https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/menu-outline.svg); 89 | background-size: var(--size) var(--size); 90 | filter: var(--image-filters); 91 | } 92 | #pages-sidebar { 93 | position: fixed; 94 | top: 0; 95 | bottom: 0; 96 | right: 100%; 97 | overflow-y: auto; 98 | transition: transform 300ms cubic-bezier(0.18, 0.89, 0.45, 1.12); 99 | } 100 | @media (prefers-reduced-motion) { 101 | #pages-sidebar { 102 | transition: none; 103 | } 104 | } 105 | 106 | .pages_show_sidebar #pages-sidebar { 107 | transform: translateX(100%); 108 | z-index: 23401; 109 | } 110 | .pages_show_sidebar #pages-content::after { 111 | display: block; 112 | background-color: rgba(0, 0, 0, 0.5); 113 | } 114 | } 115 | 116 | /* SIDEBAR */ 117 | 118 | #pages-sidebar { 119 | --child-padding: 0.2em 0.6em; 120 | --border-radius: 0.5em; 121 | } 122 | 123 | #pages-sidebar > div > ul { 124 | margin-block-start: 0px; 125 | margin-block-end: 0px; 126 | } 127 | 128 | #pages-sidebar li, 129 | #pages-sidebar ul { 130 | padding: 0px; 131 | list-style-type: none; 132 | } 133 | 134 | #pages-sidebar a { 135 | color: unset; 136 | text-decoration: none; 137 | } 138 | 139 | #pages-sidebar li li a, 140 | #pages-sidebar li h3 { 141 | border-radius: var(--border-radius); 142 | padding: var(--child-padding); 143 | } 144 | 145 | #pages-sidebar li h3 { 146 | color: var(--sidebar-accent-1); 147 | font-variant-caps: all-petite-caps; 148 | margin-block-start: 3rem; 149 | margin-block-end: 0; 150 | } 151 | 152 | #pages-sidebar li hr { 153 | margin: 3rem 1rem; 154 | /* border-color: red; */ 155 | border-style: solid; 156 | opacity: 0.2; 157 | } 158 | 159 | #pages-sidebar li:first-of-type h3 { 160 | margin-block-start: 0; 161 | } 162 | 163 | #pages-sidebar li, 164 | #pages-sidebar ul { 165 | display: flex; 166 | flex-direction: column; 167 | align-items: stretch; 168 | } 169 | 170 | #pages-sidebar li li.homework { 171 | padding-left: 1ch; 172 | /* background: yellow; */ 173 | } 174 | 175 | #pages-sidebar li li a { 176 | margin: 0.2em 0; 177 | } 178 | 179 | #pages-sidebar li li.homework a { 180 | /* background: #ffb60012; */ 181 | margin: 0.4em 0px; 182 | outline: 3px dashed #92929278; 183 | outline-offset: -1px; 184 | } 185 | 186 | /* #pages-sidebar li li.homework a::before { 187 | content: "👉 "; 188 | } */ 189 | 190 | #pages-sidebar li li span.entry-number { 191 | opacity: 0.6; 192 | } 193 | #pages-sidebar li li.homework span.entry-number { 194 | display: block; 195 | } 196 | 197 | #pages-sidebar li li.active a { 198 | background-color: var(--sidebar-li-active-bg); 199 | } 200 | #pages-sidebar li li:hover a { 201 | background-color: var(--sidebar-li-hover-bg); 202 | } 203 | #pages-sidebar li li.not_in_track { 204 | opacity: 0.4; 205 | } 206 | 207 | /* TRACK CHOOSER */ 208 | 209 | .track-chooser { 210 | margin-top: 3em; 211 | padding: 0.5em; 212 | border: 3px solid var(--track-bg-accent); 213 | background: var(--track-bg); 214 | color: var(--fg); 215 | border-radius: 0.3em; 216 | display: flex; 217 | flex-direction: column; 218 | align-items: center; 219 | } 220 | 221 | .track-chooser h2:not(#asdf) { 222 | font-weight: 900; 223 | font-family: sans-serif; 224 | font-style: normal; 225 | font-size: 1.2rem; 226 | margin-block-end: 0.3em; 227 | margin-block-start: 0; 228 | } 229 | 230 | .track-chooser label { 231 | display: contents; 232 | } 233 | 234 | .track-chooser select { 235 | max-width: 100%; 236 | } 237 | 238 | /* SIDEBAR LOGO */ 239 | 240 | #pages-sidebar .home_link img { 241 | height: 1.2em; 242 | width: 1.2em; 243 | } 244 | #pages-sidebar a.home_link { 245 | font-size: 1.7rem; 246 | padding: 0.3em; 247 | font-weight: 800; 248 | display: flex; 249 | flex-direction: row; 250 | align-items: center; 251 | gap: 0.5ch; 252 | } 253 | 254 | /* Markdown content */ 255 | 256 | .pages-markdown main { 257 | max-width: 700px; 258 | margin-left: auto; 259 | margin-right: auto; 260 | margin-top: 5rem; 261 | } 262 | -------------------------------------------------------------------------------- /src/assets/styles/lecture_header.css: -------------------------------------------------------------------------------- 1 | .lecture-header { 2 | background: #282936; 3 | color: white; 4 | padding: 1rem; 5 | /* min-height: 500px; */ 6 | /* width: 100%; */ 7 | display: block; 8 | border-radius: 1rem; 9 | margin: 1rem; 10 | } 11 | 12 | .lecture-header * { 13 | color: white; 14 | } 15 | 16 | .lecture-header, 17 | .lecture-header h1 { 18 | font-family: Vollkorn, serif; 19 | font-weight: 700; 20 | font-feature-settings: "lnum", "pnum"; 21 | } 22 | 23 | .lecture-header .number { 24 | font-style: italic; 25 | font-size: 1.5rem; 26 | opacity: 0.8; 27 | } 28 | 29 | .lecture-header h1 { 30 | text-align: center; 31 | font-size: 2rem; 32 | } 33 | .lecture-header .video > div { 34 | display: flex; 35 | justify-content: center; 36 | overflow: hidden; 37 | max-width: 400px; 38 | margin: 0 auto; 39 | } 40 | .lecture-header .video iframe, 41 | .lecture-header .video lite-youtube { 42 | /* max-width: 400px; */ 43 | aspect-ratio: 16/9; 44 | flex: 1 1 auto; 45 | } 46 | -------------------------------------------------------------------------------- /src/assets/styles/newdefault.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,500;0,700;1,500;1,700&display=swap"); 2 | @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"); 3 | @import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"); 4 | @import url("https://fonts.googleapis.com/css2?family=Vollkorn:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"); 5 | 6 | html { 7 | box-sizing: border-box; 8 | font-size: 17px; 9 | /* color: #3c3c3c; */ 10 | } 11 | 12 | body { 13 | /* background: #f1e7e7; */ 14 | font-family: "Open Sans", sans-serif; 15 | overflow-wrap: break-word; 16 | } 17 | main h1 { 18 | font-family: "Vollkorn", serif; 19 | font-weight: 800; 20 | font-style: italic; 21 | margin-block-end: 0.5em; 22 | font-size: 2.5rem; 23 | margin-block-start: 0; 24 | letter-spacing: -0.2px; 25 | } 26 | -------------------------------------------------------------------------------- /src/assets/styles/sidebar.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/assets/styles/sidebar.css -------------------------------------------------------------------------------- /src/assets/zoom_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 239 | 240 | -------------------------------------------------------------------------------- /src/cheatsheets.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Cheatsheets" 3 | tags: ["welcome"] 4 | order: 7 5 | layout: "md.jlmd" 6 | --- 7 | 8 | # Cheatsheets 9 | 10 | - [Getting Started with Julia - live]($(root_url)/week0/basic_syntax/). 11 | - [Fastrack to Julia](https://juliadocs.github.io/Julia-Cheat-Sheet/) cheatsheet. 12 | - [MATLAB-Julia-Python comparative cheatsheet](https://cheatsheets.quantecon.org/) by [QuantEcon group](https://quantecon.org) 13 | - [Plots.jl cheatsheet](https://github.com/sswatson/cheatsheets/blob/master/plotsjl-cheatsheet.pdf) 14 | -------------------------------------------------------------------------------- /src/climate_science/resistors_and_stencils.jl: -------------------------------------------------------------------------------- 1 | ### A Pluto.jl notebook ### 2 | # v0.19.45 3 | 4 | #> [frontmatter] 5 | #> chapter = 3 6 | #> video = "https://www.youtube.com/watch?v=DdTWgBlDgr0" 7 | #> image = "https://user-images.githubusercontent.com/6933510/136200635-33c007ff-89f6-48dc-b1d3-eb56fd16003e.gif" 8 | #> section = 8 9 | #> order = 8 10 | #> title = "Resistors, stencils and climate models" 11 | #> layout = "layout.jlhtml" 12 | #> youtube_id = "DdTWgBlDgr0" 13 | #> description = "" 14 | #> tags = ["lecture", "module3", "PDE", "differential equation", "ghost cell", "boundary condition", "climate", "modeling", "track_climate", "track_math", "stencil"] 15 | 16 | using Markdown 17 | using InteractiveUtils 18 | 19 | # ╔═╡ 89b4bb1b-0d49-4cf2-9013-3d320711577f 20 | using PlutoUI, OffsetArrays 21 | 22 | # ╔═╡ 7e939280-ccb3-4d64-8799-82630fbb7811 23 | TableOfContents() 24 | 25 | # ╔═╡ 8b3da08b-d900-4736-955a-d25f8c7b70a9 26 | md""" 27 | Julia 28 | * `CartesianIndex` 29 | * `OffsetArray` from `OffsetArrays` 30 | """ 31 | 32 | # ╔═╡ 1945c286-c9a3-41f0-b3dc-e3a7c10334ab 33 | md""" 34 | # Resistors, Equilibrium, and Poisson's equation. (17:48 minute video) 35 | """ 36 | 37 | # ╔═╡ 87ff0226-a249-419d-bd86-62331be6a538 38 | md""" 39 | This video is really about the interaction of the discrete and the continuous. 40 | We set up a grid of resistor problem, and we show that solving this problem is the discretized version of solving a partial differential equation 41 | known as Poisson's equation. 42 | 43 | There are some references to fall 2020 which date this lecture, including 44 | a reference to the Biden/Trump election, and a reference to John Urschel's lecture 45 | which some of you might want to check out: 46 | 47 | [John Urschel's video](https://youtu.be/rRCGNvMdLEY) 48 | """ 49 | 50 | # ╔═╡ a4d5fe96-5fed-4c26-b3ad-7637246cbb87 51 | html""" 52 | 53 | 54 | 55 | 56 | 57 | """ 58 | 59 | # ╔═╡ ea8801ad-275e-4cb8-b383-e2d80fb920ec 60 | md""" 61 | # Stencils (first 2.5 minutes or so) 62 | 63 | Don't miss the fun video effects! 64 | """ 65 | 66 | # ╔═╡ c9c62724-4c0e-4858-9419-828289ec1f45 67 | html""" 68 | 69 | 70 | 71 | 72 | 73 | """ 74 | 75 | # ╔═╡ d0c01582-8499-4458-894c-cb23cf31094f 76 | md""" 77 | In the remainder of this notebook, we will show how to set up ghost cells in Julia so as to be able to apply a stencil. 78 | """ 79 | 80 | # ╔═╡ b1148b31-fb3b-434d-984f-dfc439c0e5c7 81 | md""" 82 | # Cartesian Indices 83 | """ 84 | 85 | # ╔═╡ fff37e11-d618-4271-b48c-12b7d1ef8472 86 | md""" 87 | Grab a 6x7 matrix that we'd like to apply a stencil to. 88 | """ 89 | 90 | # ╔═╡ afa4a77e-28fc-11eb-1ab0-bbba1b653e46 91 | data = rand(1:9,6,7) 92 | 93 | # ╔═╡ 17b7f5e6-83d5-43e0-8b56-93e67e3af747 94 | md""" 95 | A "Cartesian index" lets you access an element with one index variable: 96 | """ 97 | 98 | # ╔═╡ e970a572-12f6-4b72-8a60-5cd70e1b7260 99 | i = CartesianIndex(2,3) 100 | 101 | # ╔═╡ 2a0c666f-f3fa-49ab-8ffc-45323e7cba15 102 | data[i] 103 | 104 | # ╔═╡ af8c6b1e-5f72-4547-bd9f-1a1fc7264dc8 105 | md""" 106 | Obtain all the Cartesian Indices of your data matrix. 107 | """ 108 | 109 | # ╔═╡ 0019e726-28fd-11eb-0e86-31ec28b3c1a9 110 | I = CartesianIndices(data) 111 | 112 | # ╔═╡ 681c3d00-2f1e-4a84-b67e-c14fffbe2549 113 | Dump(I) 114 | 115 | # ╔═╡ e4e51762-7010-4afe-9599-3746acbe9143 116 | md""" 117 | # Offset Arrays 118 | """ 119 | 120 | # ╔═╡ 4d03b75f-e43a-484b-8020-43244b7700d5 121 | md""" 122 | An offset array lets you index in ways other than the standard 1:m, 1:n 123 | """ 124 | 125 | # ╔═╡ 5fb6e7b6-2901-11eb-0e94-aba290fd0bae 126 | A = OffsetArray(zeros(Int,8,9), 0:7 ,0:8) 127 | 128 | # ╔═╡ 87c260a2-2901-11eb-1060-b1e4b6b5b02b 129 | for i ∈ I 130 | A[i] = data[i] # copy data 131 | end 132 | 133 | # ╔═╡ a5c7693a-2901-11eb-1083-0da8138a73c2 134 | A 135 | 136 | # ╔═╡ f2903f3f-9697-4cac-af87-b2cfee362638 137 | A[1,1] 138 | 139 | # ╔═╡ 4fb21151-fc95-40e2-b2b7-7d0a05c5a60a 140 | A[0,0] 141 | 142 | # ╔═╡ 52c8ec62-0d04-4945-a08f-3dd1cffd5395 143 | A[I].=data[I] 144 | 145 | # ╔═╡ 423f22c0-336a-4640-bbd2-2649e6021de6 146 | md""" 147 | # Neighborhood: a 3x3 window built from Cartesian Indices 148 | """ 149 | 150 | # ╔═╡ b6fde83c-2901-11eb-0e3b-4b3766579cc8 151 | neighborhood = CartesianIndices((-1:1, -1:1)) 152 | 153 | # ╔═╡ 0eacc41c-89f7-4c11-b727-1769a6e7f5d5 154 | md""" 155 | Grab all the neighborhoods of `A`. 156 | """ 157 | 158 | # ╔═╡ babe3c24-2901-11eb-2d30-51256eb97e11 159 | [ A[i.+neighborhood] for i ∈ I] 160 | 161 | # ╔═╡ 7bd3671d-e59d-4d04-a60c-4524b2057972 162 | md""" 163 | # Stencil 164 | """ 165 | 166 | # ╔═╡ e6bd9dea-2901-11eb-1100-ad10705f41cc 167 | stencil = [ 0 -1 0 168 | -1 4 -1 169 | 0 -1 0] 170 | 171 | # ╔═╡ fe4f6df0-2901-11eb-1945-27e3f041ed1f 172 | [ sum(A[i.+neighborhood].*stencil) for i ∈ I] 173 | 174 | # ╔═╡ 48374720-6c79-4c2b-8b81-86565cbf19a2 175 | md""" 176 | Notice the result is the same size as the original data, and the stencil 177 | "worked" on the edges. 178 | """ 179 | 180 | # ╔═╡ a7615570-0826-4ef1-80b2-da21c0c640b6 181 | md""" 182 | # Other boundary conditions. 183 | We just saw 0 boundary conditions, what about periodic or zero derivative? 184 | """ 185 | 186 | # ╔═╡ 77c06ce6-2902-11eb-30a7-51f210dbd723 187 | begin 188 | B = copy(A) 189 | 190 | B[0,:] = B[6,:] ## periodic 191 | B[7,:] = B[1,:] 192 | B[:,0] = B[:,7] 193 | B[:,8] = B[:,1] 194 | 195 | 196 | # B[0,:] = B[1,:] ## zero derivative 197 | # B[7,:] = B[7:] 198 | # B[:,0] = B[:,1] 199 | # B[:,8] = B[:,7] 200 | 201 | B 202 | end 203 | 204 | # ╔═╡ 4f342744-2902-11eb-1401-55e770d9d751 205 | 206 | for i∈I 207 | B[i] = sum(A[i.+neighborhood].*stencil) 208 | end 209 | 210 | 211 | # ╔═╡ 6223e374-2902-11eb-3bb2-4d2d0d352801 212 | B 213 | 214 | # ╔═╡ e107dc1b-ee6d-46ea-9ce3-2a7ff79739dd 215 | md""" 216 | # Climate Models in the Real World 217 | """ 218 | 219 | # ╔═╡ f9c4c5d5-6c5f-4443-8a92-bdaddf1d5cb9 220 | md""" 221 | (play from t=28:122,330:1200) 222 | """ 223 | 224 | # ╔═╡ 9ac4218a-b71f-448c-a375-3969e15dfb86 225 | html""" 226 | 227 | 228 | 229 | 230 | 231 | 232 | """ 233 | 234 | # ╔═╡ 00000000-0000-0000-0000-000000000001 235 | PLUTO_PROJECT_TOML_CONTENTS = """ 236 | [deps] 237 | OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" 238 | PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 239 | 240 | [compat] 241 | OffsetArrays = "~1.14.1" 242 | PlutoUI = "~0.7.59" 243 | """ 244 | 245 | # ╔═╡ 00000000-0000-0000-0000-000000000002 246 | PLUTO_MANIFEST_TOML_CONTENTS = """ 247 | # This file is machine-generated - editing it directly is not advised 248 | 249 | [[AbstractPlutoDingetjes]] 250 | deps = ["Pkg"] 251 | git-tree-sha1 = "6e1d2a35f2f90a4bc7c2ed98079b2ba09c35b83a" 252 | uuid = "6e696c72-6542-2067-7265-42206c756150" 253 | version = "1.3.2" 254 | 255 | [[ArgTools]] 256 | uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" 257 | version = "1.1.1" 258 | 259 | [[Artifacts]] 260 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 261 | 262 | [[Base64]] 263 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 264 | 265 | [[ColorTypes]] 266 | deps = ["FixedPointNumbers", "Random"] 267 | git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" 268 | uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" 269 | version = "0.11.5" 270 | 271 | [[CompilerSupportLibraries_jll]] 272 | deps = ["Artifacts", "Libdl"] 273 | uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" 274 | version = "1.1.1+0" 275 | 276 | [[Dates]] 277 | deps = ["Printf"] 278 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 279 | 280 | [[Downloads]] 281 | deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] 282 | uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" 283 | version = "1.6.0" 284 | 285 | [[FileWatching]] 286 | uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" 287 | 288 | [[FixedPointNumbers]] 289 | deps = ["Statistics"] 290 | git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" 291 | uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" 292 | version = "0.8.5" 293 | 294 | [[Hyperscript]] 295 | deps = ["Test"] 296 | git-tree-sha1 = "179267cfa5e712760cd43dcae385d7ea90cc25a4" 297 | uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91" 298 | version = "0.0.5" 299 | 300 | [[HypertextLiteral]] 301 | deps = ["Tricks"] 302 | git-tree-sha1 = "7134810b1afce04bbc1045ca1985fbe81ce17653" 303 | uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" 304 | version = "0.9.5" 305 | 306 | [[IOCapture]] 307 | deps = ["Logging", "Random"] 308 | git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" 309 | uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" 310 | version = "0.2.5" 311 | 312 | [[InteractiveUtils]] 313 | deps = ["Markdown"] 314 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 315 | 316 | [[JSON]] 317 | deps = ["Dates", "Mmap", "Parsers", "Unicode"] 318 | git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" 319 | uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 320 | version = "0.21.4" 321 | 322 | [[LibCURL]] 323 | deps = ["LibCURL_jll", "MozillaCACerts_jll"] 324 | uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" 325 | version = "0.6.4" 326 | 327 | [[LibCURL_jll]] 328 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] 329 | uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" 330 | version = "8.4.0+0" 331 | 332 | [[LibGit2]] 333 | deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] 334 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 335 | 336 | [[LibGit2_jll]] 337 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] 338 | uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" 339 | version = "1.6.4+0" 340 | 341 | [[LibSSH2_jll]] 342 | deps = ["Artifacts", "Libdl", "MbedTLS_jll"] 343 | uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" 344 | version = "1.11.0+1" 345 | 346 | [[Libdl]] 347 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 348 | 349 | [[LinearAlgebra]] 350 | deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] 351 | uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 352 | 353 | [[Logging]] 354 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 355 | 356 | [[MIMEs]] 357 | git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb" 358 | uuid = "6c6e2e6c-3030-632d-7369-2d6c69616d65" 359 | version = "0.1.4" 360 | 361 | [[Markdown]] 362 | deps = ["Base64"] 363 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 364 | 365 | [[MbedTLS_jll]] 366 | deps = ["Artifacts", "Libdl"] 367 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 368 | version = "2.28.2+1" 369 | 370 | [[Mmap]] 371 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 372 | 373 | [[MozillaCACerts_jll]] 374 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 375 | version = "2023.1.10" 376 | 377 | [[NetworkOptions]] 378 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 379 | version = "1.2.0" 380 | 381 | [[OffsetArrays]] 382 | git-tree-sha1 = "1a27764e945a152f7ca7efa04de513d473e9542e" 383 | uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" 384 | version = "1.14.1" 385 | 386 | [OffsetArrays.extensions] 387 | OffsetArraysAdaptExt = "Adapt" 388 | 389 | [OffsetArrays.weakdeps] 390 | Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" 391 | 392 | [[OpenBLAS_jll]] 393 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] 394 | uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" 395 | version = "0.3.23+4" 396 | 397 | [[Parsers]] 398 | deps = ["Dates", "PrecompileTools", "UUIDs"] 399 | git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" 400 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 401 | version = "2.8.1" 402 | 403 | [[Pkg]] 404 | deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] 405 | uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 406 | version = "1.10.0" 407 | 408 | [[PlutoUI]] 409 | deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] 410 | git-tree-sha1 = "ab55ee1510ad2af0ff674dbcced5e94921f867a9" 411 | uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 412 | version = "0.7.59" 413 | 414 | [[PrecompileTools]] 415 | deps = ["Preferences"] 416 | git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" 417 | uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" 418 | version = "1.2.1" 419 | 420 | [[Preferences]] 421 | deps = ["TOML"] 422 | git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" 423 | uuid = "21216c6a-2e73-6563-6e65-726566657250" 424 | version = "1.4.3" 425 | 426 | [[Printf]] 427 | deps = ["Unicode"] 428 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 429 | 430 | [[REPL]] 431 | deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] 432 | uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" 433 | 434 | [[Random]] 435 | deps = ["SHA"] 436 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 437 | 438 | [[Reexport]] 439 | git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" 440 | uuid = "189a3867-3050-52da-a836-e630ba90ab69" 441 | version = "1.2.2" 442 | 443 | [[SHA]] 444 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 445 | version = "0.7.0" 446 | 447 | [[Serialization]] 448 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 449 | 450 | [[Sockets]] 451 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 452 | 453 | [[SparseArrays]] 454 | deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] 455 | uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 456 | version = "1.10.0" 457 | 458 | [[Statistics]] 459 | deps = ["LinearAlgebra", "SparseArrays"] 460 | uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 461 | version = "1.10.0" 462 | 463 | [[SuiteSparse_jll]] 464 | deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] 465 | uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" 466 | version = "7.2.1+1" 467 | 468 | [[TOML]] 469 | deps = ["Dates"] 470 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 471 | version = "1.0.3" 472 | 473 | [[Tar]] 474 | deps = ["ArgTools", "SHA"] 475 | uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" 476 | version = "1.10.0" 477 | 478 | [[Test]] 479 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 480 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 481 | 482 | [[Tricks]] 483 | git-tree-sha1 = "eae1bb484cd63b36999ee58be2de6c178105112f" 484 | uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" 485 | version = "0.1.8" 486 | 487 | [[URIs]] 488 | git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" 489 | uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" 490 | version = "1.5.1" 491 | 492 | [[UUIDs]] 493 | deps = ["Random", "SHA"] 494 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 495 | 496 | [[Unicode]] 497 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 498 | 499 | [[Zlib_jll]] 500 | deps = ["Libdl"] 501 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 502 | version = "1.2.13+1" 503 | 504 | [[libblastrampoline_jll]] 505 | deps = ["Artifacts", "Libdl"] 506 | uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" 507 | version = "5.8.0+1" 508 | 509 | [[nghttp2_jll]] 510 | deps = ["Artifacts", "Libdl"] 511 | uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" 512 | version = "1.52.0+1" 513 | 514 | [[p7zip_jll]] 515 | deps = ["Artifacts", "Libdl"] 516 | uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" 517 | version = "17.4.0+2" 518 | """ 519 | 520 | # ╔═╡ Cell order: 521 | # ╠═89b4bb1b-0d49-4cf2-9013-3d320711577f 522 | # ╠═7e939280-ccb3-4d64-8799-82630fbb7811 523 | # ╟─8b3da08b-d900-4736-955a-d25f8c7b70a9 524 | # ╟─1945c286-c9a3-41f0-b3dc-e3a7c10334ab 525 | # ╟─87ff0226-a249-419d-bd86-62331be6a538 526 | # ╟─a4d5fe96-5fed-4c26-b3ad-7637246cbb87 527 | # ╟─ea8801ad-275e-4cb8-b383-e2d80fb920ec 528 | # ╟─c9c62724-4c0e-4858-9419-828289ec1f45 529 | # ╟─d0c01582-8499-4458-894c-cb23cf31094f 530 | # ╟─b1148b31-fb3b-434d-984f-dfc439c0e5c7 531 | # ╟─fff37e11-d618-4271-b48c-12b7d1ef8472 532 | # ╠═afa4a77e-28fc-11eb-1ab0-bbba1b653e46 533 | # ╟─17b7f5e6-83d5-43e0-8b56-93e67e3af747 534 | # ╠═e970a572-12f6-4b72-8a60-5cd70e1b7260 535 | # ╠═2a0c666f-f3fa-49ab-8ffc-45323e7cba15 536 | # ╟─af8c6b1e-5f72-4547-bd9f-1a1fc7264dc8 537 | # ╠═0019e726-28fd-11eb-0e86-31ec28b3c1a9 538 | # ╠═681c3d00-2f1e-4a84-b67e-c14fffbe2549 539 | # ╟─e4e51762-7010-4afe-9599-3746acbe9143 540 | # ╟─4d03b75f-e43a-484b-8020-43244b7700d5 541 | # ╠═5fb6e7b6-2901-11eb-0e94-aba290fd0bae 542 | # ╠═87c260a2-2901-11eb-1060-b1e4b6b5b02b 543 | # ╠═a5c7693a-2901-11eb-1083-0da8138a73c2 544 | # ╠═f2903f3f-9697-4cac-af87-b2cfee362638 545 | # ╠═4fb21151-fc95-40e2-b2b7-7d0a05c5a60a 546 | # ╠═52c8ec62-0d04-4945-a08f-3dd1cffd5395 547 | # ╟─423f22c0-336a-4640-bbd2-2649e6021de6 548 | # ╠═b6fde83c-2901-11eb-0e3b-4b3766579cc8 549 | # ╟─0eacc41c-89f7-4c11-b727-1769a6e7f5d5 550 | # ╠═babe3c24-2901-11eb-2d30-51256eb97e11 551 | # ╟─7bd3671d-e59d-4d04-a60c-4524b2057972 552 | # ╠═e6bd9dea-2901-11eb-1100-ad10705f41cc 553 | # ╠═fe4f6df0-2901-11eb-1945-27e3f041ed1f 554 | # ╟─48374720-6c79-4c2b-8b81-86565cbf19a2 555 | # ╟─a7615570-0826-4ef1-80b2-da21c0c640b6 556 | # ╠═77c06ce6-2902-11eb-30a7-51f210dbd723 557 | # ╠═4f342744-2902-11eb-1401-55e770d9d751 558 | # ╠═6223e374-2902-11eb-3bb2-4d2d0d352801 559 | # ╟─e107dc1b-ee6d-46ea-9ce3-2a7ff79739dd 560 | # ╟─f9c4c5d5-6c5f-4443-8a92-bdaddf1d5cb9 561 | # ╟─9ac4218a-b71f-448c-a375-3969e15dfb86 562 | # ╟─00000000-0000-0000-0000-000000000001 563 | # ╟─00000000-0000-0000-0000-000000000002 564 | -------------------------------------------------------------------------------- /src/clips.md: -------------------------------------------------------------------------------- 1 | # Submit A Short Clip 2 | 3 | Did you have a favorite (or many favorite) 1-2 minute clips from one of the lectures in this course? Consider sending them to us and that way we can share them on Twitter so more people can get exposure to computational thinking. Use [this form](https://forms.gle/2Um6Sg8G83EdYEfB9) to upload clips. 4 | -------------------------------------------------------------------------------- /src/data_science/testCSVwrite.csv: -------------------------------------------------------------------------------- 1 | °F,°C 2 | -2,-18.888888811111112 3 | 6,-14.444444366666668 4 | 10,-12.222222144444446 5 | 13,-10.55555547777778 6 | 14,-9.999999922222223 7 | 26,-3.333333255555557 8 | 50,10.000000077777777 9 | 67,19.44444452222222 10 | 80,26.66666674444444 11 | 86,30.000000077777777 12 | -------------------------------------------------------------------------------- /src/homework/hw0.jl: -------------------------------------------------------------------------------- 1 | ### A Pluto.jl notebook ### 2 | # v0.19.45 3 | 4 | using Markdown 5 | using InteractiveUtils 6 | 7 | # This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). 8 | macro bind(def, element) 9 | quote 10 | local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end 11 | local el = $(esc(element)) 12 | global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el) 13 | el 14 | end 15 | end 16 | 17 | # ╔═╡ d6ee91ea-e750-11ea-1260-31ebf3ec6a9b 18 | using Compose 19 | 20 | # ╔═╡ 5acd58e0-e856-11ea-2d3d-8329889fe16f 21 | using PlutoUI 22 | 23 | # ╔═╡ fafae38e-e852-11ea-1208-732b4744e4c2 24 | md"_Homework 0, version 4_" 25 | 26 | # ╔═╡ a2181260-e6cd-11ea-2a69-8d9d31d1ef0e 27 | md""" 28 | # Homework 0: Getting up and running 29 | 30 | First of all, **_welcome to the course!_** We are excited to teach you about real world applications of scientific computing, using the same tools that we work with ourselves. 31 | 32 | This first homework is a little mic-check. We'd like all MIT students to **submit this zeroth homework assignment**. It will not affect your grade, but it will help us get everything running smoothly when the course starts. If you're stuck or don't have much time, just fill in your name and ID and submit 🙂 33 | """ 34 | 35 | # ╔═╡ 31a8fbf8-e6ce-11ea-2c66-4b4d02b41995 36 | md"""## Homework Logistics 37 | Homeworks are in the form of [Pluto notebooks](https://plutojl.org). Your must complete them and submit them on Canvas (if you are an MIT student.). If you are not an MIT student, we encourage you to [join Discord](https://discord.gg/Z5qnVf8) and find someone to cross-grade. 38 | 39 | HW0 is for you to get your system set up correctly and to test our grading software. You must submit it but it will not count towards your grade. 40 | """ 41 | 42 | # ╔═╡ f9d7250a-706f-11eb-104d-3f07c59f7174 43 | md"## Requirements of this HW0 44 | 45 | - Install Julia and set up Pluto 46 | - Do the required Exercise 0. 47 | 48 | That’s it, but if you like you can do the _OPTIONAL_ exercises that follow." 49 | 50 | # ╔═╡ 430a260e-6cbb-11eb-34af-31366543c9dc 51 | md"""# Installation 52 | Before being able to run this notebook successfully locally, you will need to [set up Julia and Pluto.](/Spring21/installation/) 53 | 54 | One you have Julia and Pluto installed, you can click the button at the top right of this page and follow the instructions to edit this notebook locally and submit. 55 | """ 56 | 57 | # ╔═╡ a05d2bc8-7024-11eb-08cb-196543bbb8fd 58 | md"## (Required) Exercise 0 - _Making a basic function_ 59 | 60 | Computing the square of a number is easy -- you just multiply it with itself. 61 | 62 | ##### Algorithm: 63 | 64 | Given: $x$ 65 | 66 | Output: $x^2$ 67 | 68 | 1. Multiply `x` by `x`" 69 | 70 | # ╔═╡ e02f7ea6-7024-11eb-3672-fd59a6cff79b 71 | function basic_square(x) 72 | return 1 # this is wrong, write your code here! 73 | end 74 | 75 | # ╔═╡ 6acef56c-7025-11eb-2524-819c30a75d39 76 | let 77 | result = basic_square(5) 78 | if !(result isa Number) 79 | md""" 80 | !!! warning "Not a number" 81 | `basic_square` did not return a number. Did you forget to write `return`? 82 | """ 83 | elseif abs(result - 5*5) < 0.01 84 | md""" 85 | !!! correct 86 | Well done! 87 | """ 88 | else 89 | md""" 90 | !!! warning "Incorrect" 91 | Keep working on it! 92 | """ 93 | end 94 | end 95 | 96 | # ╔═╡ 348cea34-7025-11eb-3def-41bbc16c7512 97 | md"That's all that's required for this week. Please submit the notebook. We just wanted to make sure that you're up and running. 98 | 99 | If you want to explore further, we have included a few optional exercises below." 100 | 101 | # ╔═╡ 339c2d5c-e6ce-11ea-32f9-714b3628909c 102 | md"## (Optional) Exercise 1 - _Square root by Newton's method_ 103 | 104 | Computing the square of a number is easy -- you already did it. 105 | 106 | But how does one compute the square root of a number? 107 | 108 | ##### Algorithm: 109 | 110 | Given: $x$ 111 | 112 | Output: $\sqrt{x}$ 113 | 114 | 1. Take a guess `a` 115 | 1. Divide `x` by `a` 116 | 1. Set a = the average of `x/a` and `a`. (The square root must be between these two numbers. Why?) 117 | 1. Repeat until `x/a` is roughly equal to `a`. Return `a` as the square root. 118 | 119 | In general, you will never get to the point where `x/a` is _exactly_ equal to `a`. So if our algorithm keeps going until `x/a == a`, then it will get stuck. 120 | 121 | So instead, the algorithm takes a parameter `error_margin`, which is used to decide when `x/a` and `a` are close enough to halt. 122 | " 123 | 124 | # ╔═╡ 56866718-e6ce-11ea-0804-d108af4e5653 125 | md"### Exercise 1.1 126 | 127 | Step 3 in the algorithm sets the new guess to be the average of `x/a` and the old guess `a`. 128 | 129 | This is because the square root must be between the numbers `x/a` and `a`. Why? 130 | " 131 | 132 | # ╔═╡ bccf0e88-e754-11ea-3ab8-0170c2d44628 133 | ex_1_1 = md""" 134 | your answer here 135 | """ 136 | 137 | # you might need to wait until all other cells in this notebook have completed running. 138 | # scroll down the page to see what's up 139 | 140 | # ╔═╡ e7abd366-e7a6-11ea-30d7-1b6194614d0a 141 | if !(@isdefined ex_1_1) 142 | md"""Do not change the name of the variable - write you answer as `ex_1_1 = "..."`""" 143 | end 144 | 145 | # ╔═╡ d62f223c-e754-11ea-2470-e72a605a9d7e 146 | md"### Exercise 1.2 147 | 148 | Write a function newton_sqrt(x) which implements the above algorithm." 149 | 150 | # ╔═╡ 4896bf0c-e754-11ea-19dc-1380bb356ab6 151 | function newton_sqrt(x, error_margin=0.01, a=x / 2) # a=x/2 is the default value of `a` 152 | return x # this is wrong, write your code here! 153 | end 154 | 155 | # ╔═╡ 7a01a508-e78a-11ea-11da-999d38785348 156 | newton_sqrt(2) 157 | 158 | # ╔═╡ 682db9f8-e7b1-11ea-3949-6b683ca8b47b 159 | let 160 | result = newton_sqrt(2, 0.01) 161 | if !(result isa Number) 162 | md""" 163 | !!! warning "Not a number" 164 | `newton_sqrt` did not return a number. Did you forget to write `return`? 165 | """ 166 | elseif abs(result - sqrt(2)) < 0.01 167 | md""" 168 | !!! correct 169 | Well done! 170 | """ 171 | else 172 | md""" 173 | !!! warning "Incorrect" 174 | Keep working on it! 175 | """ 176 | end 177 | end 178 | 179 | # ╔═╡ 088cc652-e7a8-11ea-0ca7-f744f6f3afdd 180 | md""" 181 | !!! hint 182 | `abs(r - s)` is the distance between `r` and `s` 183 | """ 184 | 185 | # ╔═╡ c18dce7a-e7a7-11ea-0a1a-f944d46754e5 186 | md""" 187 | !!! hint 188 | If you're stuck, feel free to cheat, this is homework 0 after all 🙃 189 | 190 | Julia has a function called `sqrt` 191 | """ 192 | 193 | # ╔═╡ 5e24d95c-e6ce-11ea-24be-bb19e1e14657 194 | md"## (Optional) Exercise 2 - _Sierpinksi's triangle_ 195 | 196 | Sierpinski's triangle is defined _recursively_: 197 | 198 | - Sierpinski's triangle of complexity N is a figure in the form of a triangle which is made of 3 triangular figures which are themselves Sierpinski's triangles of complexity N-1. 199 | 200 | - A Sierpinski's triangle of complexity 0 is a simple solid equilateral triangle 201 | " 202 | 203 | # ╔═╡ 6b8883f6-e7b3-11ea-155e-6f62117e123b 204 | md"To draw Sierpinski's triangle, we are going to use an external package, [_Compose.jl_](https://giovineitalia.github.io/Compose.jl/latest/tutorial). Let's import it! 205 | 206 | A package contains a coherent set of functionality that you can often use a black box according to its specification. There are [lots of Julia packages](https://juliahub.com/ui/Home). 207 | " 208 | 209 | # ╔═╡ dbc4da6a-e7b4-11ea-3b70-6f2abfcab992 210 | md"Just like the definition above, our `sierpinksi` function is _recursive_: it calls itself." 211 | 212 | # ╔═╡ 02b9c9d6-e752-11ea-0f32-91b7b6481684 213 | complexity = 3 214 | 215 | # ╔═╡ 1eb79812-e7b5-11ea-1c10-63b24803dd8a 216 | if complexity == 3 217 | md""" 218 | Try changing the value of **`complexity` to `5`** in the cell above. 219 | 220 | Hit `Shift+Enter` to affect the change. 221 | """ 222 | else 223 | md""" 224 | **Great!** As you can see, all the cells in this notebook are linked together by the variables they define and use. Just like a spreadsheet! 225 | """ 226 | end 227 | 228 | # ╔═╡ d7e8202c-e7b5-11ea-30d3-adcd6867d5f5 229 | md"### Exercise 2.1 230 | 231 | As you can see, the total area covered by triangles is lower when the complexity is higher." 232 | 233 | # ╔═╡ f22222b4-e7b5-11ea-0ea0-8fa368d2a014 234 | md""" 235 | Can you write a function that computes the _area of `sierpinski(n)`_, as a fraction of the area of `sierpinski(0)`? 236 | 237 | So: 238 | ``` 239 | area_sierpinski(0) = 1.0 240 | area_sierpinski(1) = 0.?? 241 | ... 242 | ``` 243 | """ 244 | 245 | # ╔═╡ ca8d2f72-e7b6-11ea-1893-f1e6d0a20dc7 246 | function area_sierpinski(n) 247 | return 1.0 248 | end 249 | 250 | # ╔═╡ 71c78614-e7bc-11ea-0959-c7a91a10d481 251 | if area_sierpinski(0) == 1.0 && area_sierpinski(1) == 3 / 4 252 | md""" 253 | !!! correct 254 | Well done! 255 | """ 256 | else 257 | md""" 258 | !!! warning "Incorrect" 259 | Keep working on it! 260 | """ 261 | end 262 | 263 | # ╔═╡ c21096c0-e856-11ea-3dc5-a5b0cbf29335 264 | md"**Let's try it out below:**" 265 | 266 | # ╔═╡ 52533e00-e856-11ea-08a7-25e556fb1127 267 | md"Complexity = $(@bind n Slider(0:6, show_value=true))" 268 | 269 | # ╔═╡ c1ecad86-e7bc-11ea-1201-23ee380181a1 270 | md""" 271 | !!! hint 272 | Can you write `area_sierpinksi(n)` as a function of `area_sierpinski(n-1)`? 273 | """ 274 | 275 | # ╔═╡ a60a492a-e7bc-11ea-0f0b-75d81ce46a01 276 | md"That's it for now, see you next week!" 277 | 278 | # ╔═╡ dfdeab34-e751-11ea-0f90-2fa9bbdccb1e 279 | triangle() = compose(context(), polygon([(1, 1), (0, 1), (1 / 2, 0)])) 280 | 281 | # ╔═╡ b923d394-e750-11ea-1971-595e09ab35b5 282 | # It does not matter which order you define the building blocks (functions) of the 283 | # program in. The best way to organize code is the one that promotes understanding. 284 | 285 | function place_in_3_corners(t) 286 | # Uses the Compose library to place 3 copies of t 287 | # in the 3 corners of a triangle. 288 | # treat this function as a black box, 289 | # or learn how it works from the Compose documentation here https://giovineitalia.github.io/Compose.jl/latest/tutorial/#Compose-is-declarative-1 290 | compose(context(), 291 | (context(1 / 4, 0, 1 / 2, 1 / 2), t), 292 | (context(0, 1 / 2, 1 / 2, 1 / 2), t), 293 | (context(1 / 2, 1 / 2, 1 / 2, 1 / 2), t)) 294 | end 295 | 296 | # ╔═╡ e2848b9a-e703-11ea-24f9-b9131434a84b 297 | function sierpinski(n) 298 | if n == 0 299 | triangle() 300 | else 301 | t = sierpinski(n - 1) # recursively construct a smaller sierpinski's triangle 302 | place_in_3_corners(t) # place it in the 3 corners of a triangle 303 | end 304 | end 305 | 306 | # ╔═╡ 9664ac52-e750-11ea-171c-e7d57741a68c 307 | sierpinski(complexity) 308 | 309 | # ╔═╡ df0a4068-e7b2-11ea-2475-81b237d492b3 310 | sierpinski.(0:6) 311 | 312 | # ╔═╡ 147ed7b0-e856-11ea-0d0e-7ff0d527e352 313 | md""" 314 | 315 | Sierpinski's triangle of complexity $(n) 316 | 317 | $(sierpinski(n)) 318 | 319 | has area **$(area_sierpinski(n))** 320 | 321 | """ 322 | 323 | # ╔═╡ 00000000-0000-0000-0000-000000000001 324 | PLUTO_PROJECT_TOML_CONTENTS = """ 325 | [deps] 326 | Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b" 327 | PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 328 | 329 | [compat] 330 | Compose = "~0.9.5" 331 | PlutoUI = "~0.7.59" 332 | """ 333 | 334 | # ╔═╡ 00000000-0000-0000-0000-000000000002 335 | PLUTO_MANIFEST_TOML_CONTENTS = """ 336 | # This file is machine-generated - editing it directly is not advised 337 | 338 | julia_version = "1.10.4" 339 | manifest_format = "2.0" 340 | project_hash = "1c5ad9d2656875a70d19aa7116f049204f6fecf1" 341 | 342 | [[deps.AbstractPlutoDingetjes]] 343 | deps = ["Pkg"] 344 | git-tree-sha1 = "6e1d2a35f2f90a4bc7c2ed98079b2ba09c35b83a" 345 | uuid = "6e696c72-6542-2067-7265-42206c756150" 346 | version = "1.3.2" 347 | 348 | [[deps.ArgTools]] 349 | uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" 350 | version = "1.1.1" 351 | 352 | [[deps.Artifacts]] 353 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 354 | 355 | [[deps.Base64]] 356 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 357 | 358 | [[deps.ColorTypes]] 359 | deps = ["FixedPointNumbers", "Random"] 360 | git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" 361 | uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" 362 | version = "0.11.5" 363 | 364 | [[deps.Colors]] 365 | deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] 366 | git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0" 367 | uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" 368 | version = "0.12.11" 369 | 370 | [[deps.Compat]] 371 | deps = ["TOML", "UUIDs"] 372 | git-tree-sha1 = "b1c55339b7c6c350ee89f2c1604299660525b248" 373 | uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" 374 | version = "4.15.0" 375 | weakdeps = ["Dates", "LinearAlgebra"] 376 | 377 | [deps.Compat.extensions] 378 | CompatLinearAlgebraExt = "LinearAlgebra" 379 | 380 | [[deps.CompilerSupportLibraries_jll]] 381 | deps = ["Artifacts", "Libdl"] 382 | uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" 383 | version = "1.1.1+0" 384 | 385 | [[deps.Compose]] 386 | deps = ["Base64", "Colors", "DataStructures", "Dates", "IterTools", "JSON", "LinearAlgebra", "Measures", "Printf", "Random", "Requires", "Statistics", "UUIDs"] 387 | git-tree-sha1 = "bf6570a34c850f99407b494757f5d7ad233a7257" 388 | uuid = "a81c6b42-2e10-5240-aca2-a61377ecd94b" 389 | version = "0.9.5" 390 | 391 | [[deps.DataStructures]] 392 | deps = ["Compat", "InteractiveUtils", "OrderedCollections"] 393 | git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82" 394 | uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" 395 | version = "0.18.20" 396 | 397 | [[deps.Dates]] 398 | deps = ["Printf"] 399 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 400 | 401 | [[deps.Downloads]] 402 | deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] 403 | uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" 404 | version = "1.6.0" 405 | 406 | [[deps.FileWatching]] 407 | uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" 408 | 409 | [[deps.FixedPointNumbers]] 410 | deps = ["Statistics"] 411 | git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" 412 | uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" 413 | version = "0.8.5" 414 | 415 | [[deps.Hyperscript]] 416 | deps = ["Test"] 417 | git-tree-sha1 = "179267cfa5e712760cd43dcae385d7ea90cc25a4" 418 | uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91" 419 | version = "0.0.5" 420 | 421 | [[deps.HypertextLiteral]] 422 | deps = ["Tricks"] 423 | git-tree-sha1 = "7134810b1afce04bbc1045ca1985fbe81ce17653" 424 | uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" 425 | version = "0.9.5" 426 | 427 | [[deps.IOCapture]] 428 | deps = ["Logging", "Random"] 429 | git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" 430 | uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" 431 | version = "0.2.5" 432 | 433 | [[deps.InteractiveUtils]] 434 | deps = ["Markdown"] 435 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 436 | 437 | [[deps.IterTools]] 438 | git-tree-sha1 = "42d5f897009e7ff2cf88db414a389e5ed1bdd023" 439 | uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" 440 | version = "1.10.0" 441 | 442 | [[deps.JSON]] 443 | deps = ["Dates", "Mmap", "Parsers", "Unicode"] 444 | git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" 445 | uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 446 | version = "0.21.4" 447 | 448 | [[deps.LibCURL]] 449 | deps = ["LibCURL_jll", "MozillaCACerts_jll"] 450 | uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" 451 | version = "0.6.4" 452 | 453 | [[deps.LibCURL_jll]] 454 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] 455 | uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" 456 | version = "8.4.0+0" 457 | 458 | [[deps.LibGit2]] 459 | deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] 460 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 461 | 462 | [[deps.LibGit2_jll]] 463 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] 464 | uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" 465 | version = "1.6.4+0" 466 | 467 | [[deps.LibSSH2_jll]] 468 | deps = ["Artifacts", "Libdl", "MbedTLS_jll"] 469 | uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" 470 | version = "1.11.0+1" 471 | 472 | [[deps.Libdl]] 473 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 474 | 475 | [[deps.LinearAlgebra]] 476 | deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] 477 | uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 478 | 479 | [[deps.Logging]] 480 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 481 | 482 | [[deps.MIMEs]] 483 | git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb" 484 | uuid = "6c6e2e6c-3030-632d-7369-2d6c69616d65" 485 | version = "0.1.4" 486 | 487 | [[deps.Markdown]] 488 | deps = ["Base64"] 489 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 490 | 491 | [[deps.MbedTLS_jll]] 492 | deps = ["Artifacts", "Libdl"] 493 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 494 | version = "2.28.2+1" 495 | 496 | [[deps.Measures]] 497 | git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" 498 | uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e" 499 | version = "0.3.2" 500 | 501 | [[deps.Mmap]] 502 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 503 | 504 | [[deps.MozillaCACerts_jll]] 505 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 506 | version = "2023.1.10" 507 | 508 | [[deps.NetworkOptions]] 509 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 510 | version = "1.2.0" 511 | 512 | [[deps.OpenBLAS_jll]] 513 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] 514 | uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" 515 | version = "0.3.23+4" 516 | 517 | [[deps.OrderedCollections]] 518 | git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" 519 | uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" 520 | version = "1.6.3" 521 | 522 | [[deps.Parsers]] 523 | deps = ["Dates", "PrecompileTools", "UUIDs"] 524 | git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" 525 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 526 | version = "2.8.1" 527 | 528 | [[deps.Pkg]] 529 | deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] 530 | uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 531 | version = "1.10.0" 532 | 533 | [[deps.PlutoUI]] 534 | deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] 535 | git-tree-sha1 = "ab55ee1510ad2af0ff674dbcced5e94921f867a9" 536 | uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 537 | version = "0.7.59" 538 | 539 | [[deps.PrecompileTools]] 540 | deps = ["Preferences"] 541 | git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" 542 | uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" 543 | version = "1.2.1" 544 | 545 | [[deps.Preferences]] 546 | deps = ["TOML"] 547 | git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" 548 | uuid = "21216c6a-2e73-6563-6e65-726566657250" 549 | version = "1.4.3" 550 | 551 | [[deps.Printf]] 552 | deps = ["Unicode"] 553 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 554 | 555 | [[deps.REPL]] 556 | deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] 557 | uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" 558 | 559 | [[deps.Random]] 560 | deps = ["SHA"] 561 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 562 | 563 | [[deps.Reexport]] 564 | git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" 565 | uuid = "189a3867-3050-52da-a836-e630ba90ab69" 566 | version = "1.2.2" 567 | 568 | [[deps.Requires]] 569 | deps = ["UUIDs"] 570 | git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" 571 | uuid = "ae029012-a4dd-5104-9daa-d747884805df" 572 | version = "1.3.0" 573 | 574 | [[deps.SHA]] 575 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 576 | version = "0.7.0" 577 | 578 | [[deps.Serialization]] 579 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 580 | 581 | [[deps.Sockets]] 582 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 583 | 584 | [[deps.SparseArrays]] 585 | deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] 586 | uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 587 | version = "1.10.0" 588 | 589 | [[deps.Statistics]] 590 | deps = ["LinearAlgebra", "SparseArrays"] 591 | uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 592 | version = "1.10.0" 593 | 594 | [[deps.SuiteSparse_jll]] 595 | deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] 596 | uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" 597 | version = "7.2.1+1" 598 | 599 | [[deps.TOML]] 600 | deps = ["Dates"] 601 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 602 | version = "1.0.3" 603 | 604 | [[deps.Tar]] 605 | deps = ["ArgTools", "SHA"] 606 | uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" 607 | version = "1.10.0" 608 | 609 | [[deps.Test]] 610 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 611 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 612 | 613 | [[deps.Tricks]] 614 | git-tree-sha1 = "eae1bb484cd63b36999ee58be2de6c178105112f" 615 | uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" 616 | version = "0.1.8" 617 | 618 | [[deps.URIs]] 619 | git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" 620 | uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" 621 | version = "1.5.1" 622 | 623 | [[deps.UUIDs]] 624 | deps = ["Random", "SHA"] 625 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 626 | 627 | [[deps.Unicode]] 628 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 629 | 630 | [[deps.Zlib_jll]] 631 | deps = ["Libdl"] 632 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 633 | version = "1.2.13+1" 634 | 635 | [[deps.libblastrampoline_jll]] 636 | deps = ["Artifacts", "Libdl"] 637 | uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" 638 | version = "5.8.0+1" 639 | 640 | [[deps.nghttp2_jll]] 641 | deps = ["Artifacts", "Libdl"] 642 | uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" 643 | version = "1.52.0+1" 644 | 645 | [[deps.p7zip_jll]] 646 | deps = ["Artifacts", "Libdl"] 647 | uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" 648 | version = "17.4.0+2" 649 | """ 650 | 651 | # ╔═╡ Cell order: 652 | # ╟─fafae38e-e852-11ea-1208-732b4744e4c2 653 | # ╟─a2181260-e6cd-11ea-2a69-8d9d31d1ef0e 654 | # ╟─31a8fbf8-e6ce-11ea-2c66-4b4d02b41995 655 | # ╟─f9d7250a-706f-11eb-104d-3f07c59f7174 656 | # ╟─430a260e-6cbb-11eb-34af-31366543c9dc 657 | # ╟─a05d2bc8-7024-11eb-08cb-196543bbb8fd 658 | # ╠═e02f7ea6-7024-11eb-3672-fd59a6cff79b 659 | # ╟─6acef56c-7025-11eb-2524-819c30a75d39 660 | # ╟─348cea34-7025-11eb-3def-41bbc16c7512 661 | # ╟─339c2d5c-e6ce-11ea-32f9-714b3628909c 662 | # ╟─56866718-e6ce-11ea-0804-d108af4e5653 663 | # ╠═bccf0e88-e754-11ea-3ab8-0170c2d44628 664 | # ╟─e7abd366-e7a6-11ea-30d7-1b6194614d0a 665 | # ╟─d62f223c-e754-11ea-2470-e72a605a9d7e 666 | # ╠═4896bf0c-e754-11ea-19dc-1380bb356ab6 667 | # ╠═7a01a508-e78a-11ea-11da-999d38785348 668 | # ╟─682db9f8-e7b1-11ea-3949-6b683ca8b47b 669 | # ╟─088cc652-e7a8-11ea-0ca7-f744f6f3afdd 670 | # ╟─c18dce7a-e7a7-11ea-0a1a-f944d46754e5 671 | # ╟─5e24d95c-e6ce-11ea-24be-bb19e1e14657 672 | # ╟─6b8883f6-e7b3-11ea-155e-6f62117e123b 673 | # ╠═d6ee91ea-e750-11ea-1260-31ebf3ec6a9b 674 | # ╠═5acd58e0-e856-11ea-2d3d-8329889fe16f 675 | # ╟─dbc4da6a-e7b4-11ea-3b70-6f2abfcab992 676 | # ╠═e2848b9a-e703-11ea-24f9-b9131434a84b 677 | # ╠═9664ac52-e750-11ea-171c-e7d57741a68c 678 | # ╠═02b9c9d6-e752-11ea-0f32-91b7b6481684 679 | # ╟─1eb79812-e7b5-11ea-1c10-63b24803dd8a 680 | # ╟─d7e8202c-e7b5-11ea-30d3-adcd6867d5f5 681 | # ╠═df0a4068-e7b2-11ea-2475-81b237d492b3 682 | # ╟─f22222b4-e7b5-11ea-0ea0-8fa368d2a014 683 | # ╠═ca8d2f72-e7b6-11ea-1893-f1e6d0a20dc7 684 | # ╟─71c78614-e7bc-11ea-0959-c7a91a10d481 685 | # ╟─c21096c0-e856-11ea-3dc5-a5b0cbf29335 686 | # ╟─52533e00-e856-11ea-08a7-25e556fb1127 687 | # ╟─147ed7b0-e856-11ea-0d0e-7ff0d527e352 688 | # ╟─c1ecad86-e7bc-11ea-1201-23ee380181a1 689 | # ╟─a60a492a-e7bc-11ea-0f0b-75d81ce46a01 690 | # ╟─dfdeab34-e751-11ea-0f90-2fa9bbdccb1e 691 | # ╟─b923d394-e750-11ea-1971-595e09ab35b5 692 | # ╟─00000000-0000-0000-0000-000000000001 693 | # ╟─00000000-0000-0000-0000-000000000002 694 | -------------------------------------------------------------------------------- /src/images_abstractions/.gitignore: -------------------------------------------------------------------------------- 1 | *.png 2 | *.jpg -------------------------------------------------------------------------------- /src/images_abstractions/linear_transformation.jl: -------------------------------------------------------------------------------- 1 | ### A Pluto.jl notebook ### 2 | # v0.19.45 3 | 4 | using Markdown 5 | using InteractiveUtils 6 | 7 | # This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). 8 | macro bind(def, element) 9 | quote 10 | local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end 11 | local el = $(esc(element)) 12 | global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el) 13 | el 14 | end 15 | end 16 | 17 | # ╔═╡ 6b473b2d-4326-46b4-af38-07b61de287fc 18 | begin 19 | using Colors, ColorVectorSpace, ImageShow, FileIO, ImageIO 20 | using PlutoUI 21 | using HypertextLiteral 22 | using LinearAlgebra 23 | end 24 | 25 | # ╔═╡ 2e8c4a48-d535-44ac-a1f1-4cb26c4aece6 26 | 27 | 28 | # ╔═╡ 60532aa0-740c-11eb-0402-af8ff117f042 29 | md"Show grid lines $(@bind show_grid CheckBox(default=true))" 30 | 31 | # ╔═╡ 35904b8e-7a28-4dbc-bbf9-b45da448452c 32 | let 33 | 34 | range = -2:.1:2 35 | md""" 36 | 37 | a $(@bind a Slider(range; default=1.0, show_value=true)) 38 | 39 | b $(@bind b Slider(range; default=0.0, show_value=true)) 40 | 41 | c $(@bind c Slider(range; default=0.0, show_value=true)) 42 | 43 | d $(@bind d Slider(range; default=1.0, show_value=true)) 44 | 45 | **Re-run this cell to reset to identity transformation** 46 | """ 47 | end 48 | 49 | # ╔═╡ f085296d-48b1-4db6-bb87-db863bb54049 50 | A = [ 51 | a b 52 | c d 53 | ] 54 | 55 | # ╔═╡ d1757b2c-7400-11eb-1406-d937294d5388 56 | md"**_Det(A)_ = $a * $d - $c * $b = $(det(A))**" 57 | 58 | # ╔═╡ c536dafb-4206-4689-ad6d-6935385d8fdf 59 | md""" 60 | ## Appendix 61 | """ 62 | 63 | # ╔═╡ fb509fb4-9608-421d-9c40-a4375f459b3f 64 | det_A = det(A) 65 | 66 | # ╔═╡ 0ec60f6e-7627-11eb-17e5-f965a81f3545 67 | if det_A != 0 68 | invA = inv(A) 69 | end 70 | 71 | # ╔═╡ 40655bcc-6d1e-4d1e-9726-41eab98d8472 72 | img_sources = [ 73 | "https://user-images.githubusercontent.com/6933510/108605549-fb28e180-73b4-11eb-8520-7e29db0cc965.png" => "Corgis", 74 | "https://user-images.githubusercontent.com/6933510/108883855-39690f80-7606-11eb-8eb1-e595c6c8d829.png" => "Arrows", 75 | "https://images.squarespace-cdn.com/content/v1/5cb62a904d546e33119fa495/1589302981165-HHQ2A4JI07C43294HVPD/ke17ZwdGBToddI8pDm48kA7bHnZXCqgRu4g0_U7hbNpZw-zPPgdn4jUwVcJE1ZvWQUxwkmyExglNqGp0IvTJZamWLI2zvYWH8K3-s_4yszcp2ryTI0HqTOaaUohrI8PISCdr-3EAHMyS8K84wLA7X0UZoBreocI4zSJRMe1GOxcKMshLAGzx4R3EDFOm1kBS/fluffy+corgi?format=2500w" => "Alan" 76 | ] 77 | 78 | # ╔═╡ c0c90fec-0e55-4be3-8ea2-88b8705ee258 79 | md""" 80 | ### Choose an image: 81 | 82 | $(@bind img_source Select(img_sources)) 83 | """ 84 | 85 | # ╔═╡ 4fcb4ac1-1ad1-406e-8776-4675c0fdbb43 86 | img_original = load(download(img_source)); 87 | 88 | # ╔═╡ 52a8009e-761c-11eb-2dc9-dbccdc5e7886 89 | typeof(img_original) 90 | 91 | # ╔═╡ 7d0096ad-d89a-4ade-9679-6ee95f7d2044 92 | function trygetpixel(img::AbstractMatrix, x::Float64, y::Float64) 93 | rows, cols = size(img) 94 | 95 | "The linear map [-1,1] ↦ [0,1]" 96 | f = t -> (t - -1.0)/(1.0 - -1.0) 97 | 98 | i = floor(Int, rows * f(-y)) 99 | j = floor(Int, cols * f(x * (rows / cols))) 100 | 101 | if 1 < i ≤ rows && 1 < j ≤ cols 102 | img[i,j] 103 | else 104 | zero(eltype(img)) 105 | end 106 | end 107 | 108 | # ╔═╡ 83d45d42-7406-11eb-2a9c-e75efe62b12c 109 | function with_gridlines(img::Array{<:Any,2}; n=8) 110 | 111 | sep_i = size(img, 1) ÷ n 112 | sep_j = size(img, 2) ÷ n 113 | 114 | result = copy(img) 115 | # stroke = zero(eltype(img))#RGBA(RGB(1,1,1), 0.75) 116 | 117 | stroke = RGBA(1, 1, 1, 0.75) 118 | 119 | result[1:sep_i:end, :] .= stroke 120 | result[:, 1:sep_j:end] .= stroke 121 | 122 | # a second time, to create a line 2 pixels wide 123 | result[2:sep_i:end, :] .= stroke 124 | result[:, 2:sep_j:end] .= stroke 125 | 126 | return result 127 | end 128 | 129 | # ╔═╡ 55898e88-36a0-4f49-897f-e0850bd2b0df 130 | img = if show_grid 131 | with_gridlines(img_original) 132 | else 133 | img_original 134 | end; 135 | 136 | # ╔═╡ 8e0505be-359b-4459-9de3-f87ec7b60c23 137 | [ 138 | if det_A == 0 139 | RGB(1.0, 1.0, 1.0) 140 | else 141 | in_x, in_y = invA*[out_x, out_y] 142 | trygetpixel(img, in_x, in_y) 143 | end 144 | 145 | for out_y in LinRange(2, -2, 300), 146 | out_x in LinRange(-2, 2, 300) 147 | ] 148 | 149 | # ╔═╡ 00000000-0000-0000-0000-000000000001 150 | PLUTO_PROJECT_TOML_CONTENTS = """ 151 | [deps] 152 | ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4" 153 | Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" 154 | FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" 155 | HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" 156 | ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19" 157 | ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31" 158 | LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 159 | PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 160 | 161 | [compat] 162 | ColorVectorSpace = "~0.10.0" 163 | Colors = "~0.12.11" 164 | FileIO = "~1.16.3" 165 | HypertextLiteral = "~0.9.5" 166 | ImageIO = "~0.6.8" 167 | ImageShow = "~0.3.8" 168 | PlutoUI = "~0.7.59" 169 | """ 170 | 171 | # ╔═╡ 00000000-0000-0000-0000-000000000002 172 | PLUTO_MANIFEST_TOML_CONTENTS = """ 173 | # This file is machine-generated - editing it directly is not advised 174 | 175 | [[AbstractPlutoDingetjes]] 176 | deps = ["Pkg"] 177 | git-tree-sha1 = "6e1d2a35f2f90a4bc7c2ed98079b2ba09c35b83a" 178 | uuid = "6e696c72-6542-2067-7265-42206c756150" 179 | version = "1.3.2" 180 | 181 | [[ArgTools]] 182 | uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" 183 | version = "1.1.1" 184 | 185 | [[Artifacts]] 186 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 187 | 188 | [[AxisArrays]] 189 | deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] 190 | git-tree-sha1 = "16351be62963a67ac4083f748fdb3cca58bfd52f" 191 | uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" 192 | version = "0.4.7" 193 | 194 | [[Base64]] 195 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 196 | 197 | [[CEnum]] 198 | git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc" 199 | uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" 200 | version = "0.5.0" 201 | 202 | [[ColorSchemes]] 203 | deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] 204 | git-tree-sha1 = "b5278586822443594ff615963b0c09755771b3e0" 205 | uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" 206 | version = "3.26.0" 207 | 208 | [[ColorTypes]] 209 | deps = ["FixedPointNumbers", "Random"] 210 | git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" 211 | uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" 212 | version = "0.11.5" 213 | 214 | [[ColorVectorSpace]] 215 | deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] 216 | git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" 217 | uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" 218 | version = "0.10.0" 219 | 220 | [ColorVectorSpace.extensions] 221 | SpecialFunctionsExt = "SpecialFunctions" 222 | 223 | [ColorVectorSpace.weakdeps] 224 | SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" 225 | 226 | [[Colors]] 227 | deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] 228 | git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0" 229 | uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" 230 | version = "0.12.11" 231 | 232 | [[Compat]] 233 | deps = ["TOML", "UUIDs"] 234 | git-tree-sha1 = "b1c55339b7c6c350ee89f2c1604299660525b248" 235 | uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" 236 | version = "4.15.0" 237 | weakdeps = ["Dates", "LinearAlgebra"] 238 | 239 | [Compat.extensions] 240 | CompatLinearAlgebraExt = "LinearAlgebra" 241 | 242 | [[CompilerSupportLibraries_jll]] 243 | deps = ["Artifacts", "Libdl"] 244 | uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" 245 | version = "1.1.1+0" 246 | 247 | [[DataStructures]] 248 | deps = ["Compat", "InteractiveUtils", "OrderedCollections"] 249 | git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82" 250 | uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" 251 | version = "0.18.20" 252 | 253 | [[Dates]] 254 | deps = ["Printf"] 255 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 256 | 257 | [[Distributed]] 258 | deps = ["Random", "Serialization", "Sockets"] 259 | uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" 260 | 261 | [[DocStringExtensions]] 262 | deps = ["LibGit2"] 263 | git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" 264 | uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" 265 | version = "0.9.3" 266 | 267 | [[Downloads]] 268 | deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] 269 | uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" 270 | version = "1.6.0" 271 | 272 | [[FileIO]] 273 | deps = ["Pkg", "Requires", "UUIDs"] 274 | git-tree-sha1 = "82d8afa92ecf4b52d78d869f038ebfb881267322" 275 | uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" 276 | version = "1.16.3" 277 | 278 | [[FileWatching]] 279 | uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" 280 | 281 | [[FixedPointNumbers]] 282 | deps = ["Statistics"] 283 | git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" 284 | uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" 285 | version = "0.8.5" 286 | 287 | [[Hyperscript]] 288 | deps = ["Test"] 289 | git-tree-sha1 = "179267cfa5e712760cd43dcae385d7ea90cc25a4" 290 | uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91" 291 | version = "0.0.5" 292 | 293 | [[HypertextLiteral]] 294 | deps = ["Tricks"] 295 | git-tree-sha1 = "7134810b1afce04bbc1045ca1985fbe81ce17653" 296 | uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" 297 | version = "0.9.5" 298 | 299 | [[IOCapture]] 300 | deps = ["Logging", "Random"] 301 | git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" 302 | uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" 303 | version = "0.2.5" 304 | 305 | [[ImageAxes]] 306 | deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"] 307 | git-tree-sha1 = "2e4520d67b0cef90865b3ef727594d2a58e0e1f8" 308 | uuid = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac" 309 | version = "0.6.11" 310 | 311 | [[ImageBase]] 312 | deps = ["ImageCore", "Reexport"] 313 | git-tree-sha1 = "eb49b82c172811fd2c86759fa0553a2221feb909" 314 | uuid = "c817782e-172a-44cc-b673-b171935fbb9e" 315 | version = "0.1.7" 316 | 317 | [[ImageCore]] 318 | deps = ["ColorVectorSpace", "Colors", "FixedPointNumbers", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "PrecompileTools", "Reexport"] 319 | git-tree-sha1 = "b2a7eaa169c13f5bcae8131a83bc30eff8f71be0" 320 | uuid = "a09fc81d-aa75-5fe9-8630-4744c3626534" 321 | version = "0.10.2" 322 | 323 | [[ImageIO]] 324 | deps = ["FileIO", "IndirectArrays", "JpegTurbo", "LazyModules", "Netpbm", "OpenEXR", "PNGFiles", "QOI", "Sixel", "TiffImages", "UUIDs"] 325 | git-tree-sha1 = "437abb322a41d527c197fa800455f79d414f0a3c" 326 | uuid = "82e4d734-157c-48bb-816b-45c225c6df19" 327 | version = "0.6.8" 328 | 329 | [[ImageMetadata]] 330 | deps = ["AxisArrays", "ImageAxes", "ImageBase", "ImageCore"] 331 | git-tree-sha1 = "355e2b974f2e3212a75dfb60519de21361ad3cb7" 332 | uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49" 333 | version = "0.9.9" 334 | 335 | [[ImageShow]] 336 | deps = ["Base64", "ColorSchemes", "FileIO", "ImageBase", "ImageCore", "OffsetArrays", "StackViews"] 337 | git-tree-sha1 = "3b5344bcdbdc11ad58f3b1956709b5b9345355de" 338 | uuid = "4e3cecfd-b093-5904-9786-8bbb286a6a31" 339 | version = "0.3.8" 340 | 341 | [[Imath_jll]] 342 | deps = ["Artifacts", "JLLWrappers", "Libdl"] 343 | git-tree-sha1 = "0936ba688c6d201805a83da835b55c61a180db52" 344 | uuid = "905a6f67-0a94-5f89-b386-d35d92009cd1" 345 | version = "3.1.11+0" 346 | 347 | [[IndirectArrays]] 348 | git-tree-sha1 = "012e604e1c7458645cb8b436f8fba789a51b257f" 349 | uuid = "9b13fd28-a010-5f03-acff-a1bbcff69959" 350 | version = "1.0.0" 351 | 352 | [[Inflate]] 353 | git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" 354 | uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" 355 | version = "0.1.5" 356 | 357 | [[InteractiveUtils]] 358 | deps = ["Markdown"] 359 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 360 | 361 | [[IntervalSets]] 362 | git-tree-sha1 = "dba9ddf07f77f60450fe5d2e2beb9854d9a49bd0" 363 | uuid = "8197267c-284f-5f27-9208-e0e47529a953" 364 | version = "0.7.10" 365 | 366 | [IntervalSets.extensions] 367 | IntervalSetsRandomExt = "Random" 368 | IntervalSetsRecipesBaseExt = "RecipesBase" 369 | IntervalSetsStatisticsExt = "Statistics" 370 | 371 | [IntervalSets.weakdeps] 372 | Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 373 | RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" 374 | Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 375 | 376 | [[IterTools]] 377 | git-tree-sha1 = "42d5f897009e7ff2cf88db414a389e5ed1bdd023" 378 | uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" 379 | version = "1.10.0" 380 | 381 | [[JLLWrappers]] 382 | deps = ["Artifacts", "Preferences"] 383 | git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" 384 | uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" 385 | version = "1.5.0" 386 | 387 | [[JSON]] 388 | deps = ["Dates", "Mmap", "Parsers", "Unicode"] 389 | git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" 390 | uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 391 | version = "0.21.4" 392 | 393 | [[JpegTurbo]] 394 | deps = ["CEnum", "FileIO", "ImageCore", "JpegTurbo_jll", "TOML"] 395 | git-tree-sha1 = "fa6d0bcff8583bac20f1ffa708c3913ca605c611" 396 | uuid = "b835a17e-a41a-41e7-81f0-2f016b05efe0" 397 | version = "0.1.5" 398 | 399 | [[JpegTurbo_jll]] 400 | deps = ["Artifacts", "JLLWrappers", "Libdl"] 401 | git-tree-sha1 = "c84a835e1a09b289ffcd2271bf2a337bbdda6637" 402 | uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" 403 | version = "3.0.3+0" 404 | 405 | [[LazyModules]] 406 | git-tree-sha1 = "a560dd966b386ac9ae60bdd3a3d3a326062d3c3e" 407 | uuid = "8cdb02fc-e678-4876-92c5-9defec4f444e" 408 | version = "0.3.1" 409 | 410 | [[LibCURL]] 411 | deps = ["LibCURL_jll", "MozillaCACerts_jll"] 412 | uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" 413 | version = "0.6.4" 414 | 415 | [[LibCURL_jll]] 416 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] 417 | uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" 418 | version = "8.4.0+0" 419 | 420 | [[LibGit2]] 421 | deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] 422 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 423 | 424 | [[LibGit2_jll]] 425 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] 426 | uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" 427 | version = "1.6.4+0" 428 | 429 | [[LibSSH2_jll]] 430 | deps = ["Artifacts", "Libdl", "MbedTLS_jll"] 431 | uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" 432 | version = "1.11.0+1" 433 | 434 | [[Libdl]] 435 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 436 | 437 | [[LinearAlgebra]] 438 | deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] 439 | uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 440 | 441 | [[Logging]] 442 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 443 | 444 | [[MIMEs]] 445 | git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb" 446 | uuid = "6c6e2e6c-3030-632d-7369-2d6c69616d65" 447 | version = "0.1.4" 448 | 449 | [[MacroTools]] 450 | deps = ["Markdown", "Random"] 451 | git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" 452 | uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" 453 | version = "0.5.13" 454 | 455 | [[MappedArrays]] 456 | git-tree-sha1 = "2dab0221fe2b0f2cb6754eaa743cc266339f527e" 457 | uuid = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900" 458 | version = "0.4.2" 459 | 460 | [[Markdown]] 461 | deps = ["Base64"] 462 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 463 | 464 | [[MbedTLS_jll]] 465 | deps = ["Artifacts", "Libdl"] 466 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 467 | version = "2.28.2+1" 468 | 469 | [[Mmap]] 470 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 471 | 472 | [[MosaicViews]] 473 | deps = ["MappedArrays", "OffsetArrays", "PaddedViews", "StackViews"] 474 | git-tree-sha1 = "7b86a5d4d70a9f5cdf2dacb3cbe6d251d1a61dbe" 475 | uuid = "e94cdb99-869f-56ef-bcf0-1ae2bcbe0389" 476 | version = "0.3.4" 477 | 478 | [[MozillaCACerts_jll]] 479 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 480 | version = "2023.1.10" 481 | 482 | [[Netpbm]] 483 | deps = ["FileIO", "ImageCore", "ImageMetadata"] 484 | git-tree-sha1 = "d92b107dbb887293622df7697a2223f9f8176fcd" 485 | uuid = "f09324ee-3d7c-5217-9330-fc30815ba969" 486 | version = "1.1.1" 487 | 488 | [[NetworkOptions]] 489 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 490 | version = "1.2.0" 491 | 492 | [[OffsetArrays]] 493 | git-tree-sha1 = "1a27764e945a152f7ca7efa04de513d473e9542e" 494 | uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" 495 | version = "1.14.1" 496 | 497 | [OffsetArrays.extensions] 498 | OffsetArraysAdaptExt = "Adapt" 499 | 500 | [OffsetArrays.weakdeps] 501 | Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" 502 | 503 | [[OpenBLAS_jll]] 504 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] 505 | uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" 506 | version = "0.3.23+4" 507 | 508 | [[OpenEXR]] 509 | deps = ["Colors", "FileIO", "OpenEXR_jll"] 510 | git-tree-sha1 = "327f53360fdb54df7ecd01e96ef1983536d1e633" 511 | uuid = "52e1d378-f018-4a11-a4be-720524705ac7" 512 | version = "0.3.2" 513 | 514 | [[OpenEXR_jll]] 515 | deps = ["Artifacts", "Imath_jll", "JLLWrappers", "Libdl", "Zlib_jll"] 516 | git-tree-sha1 = "8292dd5c8a38257111ada2174000a33745b06d4e" 517 | uuid = "18a262bb-aa17-5467-a713-aee519bc75cb" 518 | version = "3.2.4+0" 519 | 520 | [[OrderedCollections]] 521 | git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" 522 | uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" 523 | version = "1.6.3" 524 | 525 | [[PNGFiles]] 526 | deps = ["Base64", "CEnum", "ImageCore", "IndirectArrays", "OffsetArrays", "libpng_jll"] 527 | git-tree-sha1 = "67186a2bc9a90f9f85ff3cc8277868961fb57cbd" 528 | uuid = "f57f5aa1-a3ce-4bc8-8ab9-96f992907883" 529 | version = "0.4.3" 530 | 531 | [[PaddedViews]] 532 | deps = ["OffsetArrays"] 533 | git-tree-sha1 = "0fac6313486baae819364c52b4f483450a9d793f" 534 | uuid = "5432bcbf-9aad-5242-b902-cca2824c8663" 535 | version = "0.5.12" 536 | 537 | [[Parsers]] 538 | deps = ["Dates", "PrecompileTools", "UUIDs"] 539 | git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" 540 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 541 | version = "2.8.1" 542 | 543 | [[Pkg]] 544 | deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] 545 | uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 546 | version = "1.10.0" 547 | 548 | [[PkgVersion]] 549 | deps = ["Pkg"] 550 | git-tree-sha1 = "f9501cc0430a26bc3d156ae1b5b0c1b47af4d6da" 551 | uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688" 552 | version = "0.3.3" 553 | 554 | [[PlutoUI]] 555 | deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] 556 | git-tree-sha1 = "ab55ee1510ad2af0ff674dbcced5e94921f867a9" 557 | uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8" 558 | version = "0.7.59" 559 | 560 | [[PrecompileTools]] 561 | deps = ["Preferences"] 562 | git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" 563 | uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" 564 | version = "1.2.1" 565 | 566 | [[Preferences]] 567 | deps = ["TOML"] 568 | git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" 569 | uuid = "21216c6a-2e73-6563-6e65-726566657250" 570 | version = "1.4.3" 571 | 572 | [[Printf]] 573 | deps = ["Unicode"] 574 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 575 | 576 | [[ProgressMeter]] 577 | deps = ["Distributed", "Printf"] 578 | git-tree-sha1 = "8f6bc219586aef8baf0ff9a5fe16ee9c70cb65e4" 579 | uuid = "92933f4c-e287-5a05-a399-4b506db050ca" 580 | version = "1.10.2" 581 | 582 | [[QOI]] 583 | deps = ["ColorTypes", "FileIO", "FixedPointNumbers"] 584 | git-tree-sha1 = "18e8f4d1426e965c7b532ddd260599e1510d26ce" 585 | uuid = "4b34888f-f399-49d4-9bb3-47ed5cae4e65" 586 | version = "1.0.0" 587 | 588 | [[REPL]] 589 | deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] 590 | uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" 591 | 592 | [[Random]] 593 | deps = ["SHA"] 594 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 595 | 596 | [[RangeArrays]] 597 | git-tree-sha1 = "b9039e93773ddcfc828f12aadf7115b4b4d225f5" 598 | uuid = "b3c3ace0-ae52-54e7-9d0b-2c1406fd6b9d" 599 | version = "0.3.2" 600 | 601 | [[Reexport]] 602 | git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" 603 | uuid = "189a3867-3050-52da-a836-e630ba90ab69" 604 | version = "1.2.2" 605 | 606 | [[Requires]] 607 | deps = ["UUIDs"] 608 | git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" 609 | uuid = "ae029012-a4dd-5104-9daa-d747884805df" 610 | version = "1.3.0" 611 | 612 | [[SHA]] 613 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 614 | version = "0.7.0" 615 | 616 | [[SIMD]] 617 | deps = ["PrecompileTools"] 618 | git-tree-sha1 = "2803cab51702db743f3fda07dd1745aadfbf43bd" 619 | uuid = "fdea26ae-647d-5447-a871-4b548cad5224" 620 | version = "3.5.0" 621 | 622 | [[Serialization]] 623 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 624 | 625 | [[SimpleTraits]] 626 | deps = ["InteractiveUtils", "MacroTools"] 627 | git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" 628 | uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" 629 | version = "0.9.4" 630 | 631 | [[Sixel]] 632 | deps = ["Dates", "FileIO", "ImageCore", "IndirectArrays", "OffsetArrays", "REPL", "libsixel_jll"] 633 | git-tree-sha1 = "2da10356e31327c7096832eb9cd86307a50b1eb6" 634 | uuid = "45858cf5-a6b0-47a3-bbea-62219f50df47" 635 | version = "0.1.3" 636 | 637 | [[Sockets]] 638 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 639 | 640 | [[SparseArrays]] 641 | deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] 642 | uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 643 | version = "1.10.0" 644 | 645 | [[StackViews]] 646 | deps = ["OffsetArrays"] 647 | git-tree-sha1 = "46e589465204cd0c08b4bd97385e4fa79a0c770c" 648 | uuid = "cae243ae-269e-4f55-b966-ac2d0dc13c15" 649 | version = "0.1.1" 650 | 651 | [[Statistics]] 652 | deps = ["LinearAlgebra", "SparseArrays"] 653 | uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 654 | version = "1.10.0" 655 | 656 | [[SuiteSparse_jll]] 657 | deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] 658 | uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" 659 | version = "7.2.1+1" 660 | 661 | [[TOML]] 662 | deps = ["Dates"] 663 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 664 | version = "1.0.3" 665 | 666 | [[Tar]] 667 | deps = ["ArgTools", "SHA"] 668 | uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" 669 | version = "1.10.0" 670 | 671 | [[TensorCore]] 672 | deps = ["LinearAlgebra"] 673 | git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6" 674 | uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50" 675 | version = "0.1.1" 676 | 677 | [[Test]] 678 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 679 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 680 | 681 | [[TiffImages]] 682 | deps = ["ColorTypes", "DataStructures", "DocStringExtensions", "FileIO", "FixedPointNumbers", "IndirectArrays", "Inflate", "Mmap", "OffsetArrays", "PkgVersion", "ProgressMeter", "SIMD", "UUIDs"] 683 | git-tree-sha1 = "bc7fd5c91041f44636b2c134041f7e5263ce58ae" 684 | uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69" 685 | version = "0.10.0" 686 | 687 | [[Tricks]] 688 | git-tree-sha1 = "eae1bb484cd63b36999ee58be2de6c178105112f" 689 | uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" 690 | version = "0.1.8" 691 | 692 | [[URIs]] 693 | git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" 694 | uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" 695 | version = "1.5.1" 696 | 697 | [[UUIDs]] 698 | deps = ["Random", "SHA"] 699 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 700 | 701 | [[Unicode]] 702 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 703 | 704 | [[Zlib_jll]] 705 | deps = ["Libdl"] 706 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 707 | version = "1.2.13+1" 708 | 709 | [[libblastrampoline_jll]] 710 | deps = ["Artifacts", "Libdl"] 711 | uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" 712 | version = "5.8.0+1" 713 | 714 | [[libpng_jll]] 715 | deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] 716 | git-tree-sha1 = "d7015d2e18a5fd9a4f47de711837e980519781a4" 717 | uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f" 718 | version = "1.6.43+1" 719 | 720 | [[libsixel_jll]] 721 | deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Pkg", "libpng_jll"] 722 | git-tree-sha1 = "d4f63314c8aa1e48cd22aa0c17ed76cd1ae48c3c" 723 | uuid = "075b6546-f08a-558a-be8f-8157d0f608a5" 724 | version = "1.10.3+0" 725 | 726 | [[nghttp2_jll]] 727 | deps = ["Artifacts", "Libdl"] 728 | uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" 729 | version = "1.52.0+1" 730 | 731 | [[p7zip_jll]] 732 | deps = ["Artifacts", "Libdl"] 733 | uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" 734 | version = "17.4.0+2" 735 | """ 736 | 737 | # ╔═╡ Cell order: 738 | # ╠═6b473b2d-4326-46b4-af38-07b61de287fc 739 | # ╟─2e8c4a48-d535-44ac-a1f1-4cb26c4aece6 740 | # ╟─c0c90fec-0e55-4be3-8ea2-88b8705ee258 741 | # ╟─60532aa0-740c-11eb-0402-af8ff117f042 742 | # ╠═8e0505be-359b-4459-9de3-f87ec7b60c23 743 | # ╠═35904b8e-7a28-4dbc-bbf9-b45da448452c 744 | # ╟─f085296d-48b1-4db6-bb87-db863bb54049 745 | # ╟─d1757b2c-7400-11eb-1406-d937294d5388 746 | # ╟─c536dafb-4206-4689-ad6d-6935385d8fdf 747 | # ╟─fb509fb4-9608-421d-9c40-a4375f459b3f 748 | # ╟─0ec60f6e-7627-11eb-17e5-f965a81f3545 749 | # ╟─40655bcc-6d1e-4d1e-9726-41eab98d8472 750 | # ╠═4fcb4ac1-1ad1-406e-8776-4675c0fdbb43 751 | # ╠═52a8009e-761c-11eb-2dc9-dbccdc5e7886 752 | # ╠═55898e88-36a0-4f49-897f-e0850bd2b0df 753 | # ╠═7d0096ad-d89a-4ade-9679-6ee95f7d2044 754 | # ╠═83d45d42-7406-11eb-2a9c-e75efe62b12c 755 | # ╟─00000000-0000-0000-0000-000000000001 756 | # ╟─00000000-0000-0000-0000-000000000002 757 | -------------------------------------------------------------------------------- /src/images_abstractions/notes.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitmath/computational-thinking/93a2262534f4fa0eb63bf94bf72a4ba87edb2d19/src/images_abstractions/notes.pptx -------------------------------------------------------------------------------- /src/index.jlmd: -------------------------------------------------------------------------------- 1 | --- 2 | authors: ["Massachusetts Institute of Technology"] 3 | tags: ["homepage"] 4 | layout: "welcome.md" 5 | --- 6 | -------------------------------------------------------------------------------- /src/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Software installation" 3 | tags: ["welcome"] 4 | order: 1 5 | layout: "md.jlmd" 6 | --- 7 | 8 | $( 9 | begin 10 | # these special elements will automatically update to read the latest Julia version. See the JavaScript snippet at the bottom of this page to see how it works! 11 | 12 | version = html"1.10.4" 13 | pkg_version = html"1.10" 14 | 15 | nothing 16 | end 17 | ) 18 | 19 | # First-time setup: Install Julia & Pluto 20 | 21 | **Video version:** 22 | 23 | 24 | 25 | > **Note:** this video was recorded in 2020, so everything looks a bit different, but the steps are the same! 26 | 27 | \\ 28 | \\ 29 | \\ 30 | **Text and pictures version:** 31 | 32 | ## Step 1: Install Julia $version 33 | 34 | Go to [https://julialang.org/downloads](https://julialang.org/downloads) and download the current stable release, Julia $(version), using the correct version for your operating system (Linux x86, Mac, Windows, etc). 35 | 36 | ## Step 2: Run Julia 37 | 38 | After installing, **make sure that you can run Julia**. On some systems, this means searching for the "Julia $(version)" program installed on your computer; in others, it means running the command `julia` in a terminal. Make sure that you can execute `1 + 1`: 39 | 40 | ![image](https://user-images.githubusercontent.com/6933510/91439734-c573c780-e86d-11ea-8169-0c97a7013e8d.png) 41 | 42 | *Make sure that you are able to launch Julia and calculate `1+1` before proceeding!* 43 | 44 | ## Step 3: Install [`Pluto`](https://github.com/fonsp/Pluto.jl) 45 | 46 | Next we will install the [**Pluto**](https://github.com/fonsp/Pluto.jl), the notebook environment that we will be using during the course. Pluto is a Julia _programming environment_ designed for interactivity and quick experiments. 47 | 48 | Open the **Julia REPL**. This is the command-line interface to Julia, similar to the previous screenshot. 49 | 50 | Here you type _Julia commands_, and when you press ENTER, it runs, and you see the result. 51 | 52 | To install Pluto, we want to run a _package manager command_. To switch from _Julia_ mode to _Pkg_ mode, type `]` (closing square bracket) at the `julia>` prompt: 53 | 54 |

 55 | julia> ]
 56 | 
 57 | (@v$(pkg_version)) pkg>
 58 | 
59 | 60 | The line turns blue and the prompt changes to `pkg>`, telling you that you are now in _package manager mode_. This mode allows you to do operations on **packages** (also called libraries). 61 | 62 | To install Pluto, run the following (case sensitive) command to *add* (install) the package to your system by downloading it from the internet. 63 | You should only need to do this *once* for each installation of Julia: 64 | 65 |

 66 | (@v$(pkg_version)) pkg> add Pluto
 67 | 
68 | 69 | This might take a couple of minutes, so you can go get yourself a cup of tea! 70 | 71 | ![image](https://user-images.githubusercontent.com/6933510/91440380-ceb16400-e86e-11ea-9352-d164911774cf.png) 72 | 73 | You can now close the terminal. 74 | 75 | ## Step 4: Use a modern browser: Mozilla Firefox or Google Chrome 76 | We need a modern browser to view Pluto notebooks with. Firefox and Chrome work best. 77 | 78 | 79 | # Second time: _Running Pluto & opening a notebook_ 80 | Repeat the following steps whenever you want to work on a project or homework assignment. 81 | 82 | ## Step 1: Start Pluto 83 | 84 | Start the Julia REPL, like you did during the setup. In the REPL, type: 85 | ```julia 86 | julia> using Pluto 87 | 88 | julia> Pluto.run() 89 | ``` 90 | 91 | ![image](https://user-images.githubusercontent.com/6933510/91441094-eb01d080-e86f-11ea-856f-e667fdd9b85c.png) 92 | 93 | The terminal tells us to go to `http://localhost:1234/` (or a similar URL). Let's open Firefox or Chrome and type that into the address bar. 94 | 95 | ![image](https://user-images.githubusercontent.com/6933510/199279574-4b1d0494-2783-49a0-acca-7b6284bede44.png) 96 | 97 | > If you're curious about what a _Pluto notebook_ looks like, have a look at the **Featured Notebooks**. These notebooks are useful for learning some basics of Julia programming. 98 | > 99 | > If you want to hear the story behind Pluto, have a look a the [JuliaCon presentation](https://www.youtube.com/watch?v=IAF8DjrQSSk). 100 | 101 | If nothing happens in the browser the first time, close Julia and try again. And please let us know! 102 | 103 | ## Step 2a: Opening a notebook from the web 104 | 105 | This is the main menu - here you can create new notebooks, or open existing ones. Our homework assignments will always be based on a _template notebook_, available in this GitHub repository. To start from a template notebook on the web, you can _paste the URL into the blue box_ and press ENTER. 106 | 107 | For example, homework 0 is available [here](/hw0/). Go to this page, and on the top right, click on the button that says "Edit or run this notebook". From these instructions, copy the notebook link, and paste it into the box. Press ENTER, and select OK in the confirmation box. 108 | 109 | ![image](https://user-images.githubusercontent.com/6933510/91441968-6b750100-e871-11ea-974e-3a6dfd80234a.png) 110 | 111 | **The first thing we will want to do is to save the notebook somewhere on our own computer; see below.** 112 | 113 | ## Step 2b: Opening an existing notebook file 114 | When you launch Pluto for the second time, your recent notebooks will appear in the main menu. You can click on them to continue where you left off. 115 | 116 | If you want to run a local notebook file that you have not opened before, then you need to enter its _full path_ into the blue box in the main menu. More on finding full paths in step 3. 117 | 118 | ## Step 3: Saving a notebook 119 | We first need a folder to save our homework in. Open your file explorer and create one. 120 | 121 | Next, we need to know the _absolute path_ of that folder. Here's how you do that in [Windows](https://www.top-password.com/blog/copy-full-path-of-a-folder-file-in-windows/) and [MacOS](https://www.josharcher.uk/code/find-path-to-folder-on-mac/). In Linux, right click and "Copy file path". 122 | 123 | For example, you might have: 124 | 125 | - `C:\\Users\\fons\\Documents\\18S191_assignments\\` on **Windows**. 126 | 127 | - `/Users/fons/Documents/18S191_assignments/` on **MacOS**. 128 | 129 | - `/home/fons/Documents/18S191_assignments/` on **Ubuntu**. 130 | 131 | Now that we know the absolute path, go back to your Pluto notebook, and at the top of the page, click on _"Save notebook..."_. 132 | 133 | ![image](https://user-images.githubusercontent.com/6933510/91444741-77fb5880-e875-11ea-8f6b-02c1c319e7f3.png) 134 | 135 | This is where you type the **new path+filename for your notebook**: 136 | 137 | ![image](https://user-images.githubusercontent.com/6933510/91444565-366aad80-e875-11ea-8ed6-1265ded78f11.png) 138 | 139 | Click _Choose_. 140 | 141 | ## Step 4: Sharing a notebook 142 | 143 | After working on your notebook (your code is autosaved when you run it), you will find your notebook file in the folder we created in step 3. This the file that you can share with others, or submit as your homework assignment to Canvas. 144 | 145 | 146 | 161 | -------------------------------------------------------------------------------- /src/logistics.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Class logistics" 3 | tags: ["welcome"] 4 | order: 3 5 | layout: "md.jlmd" 6 | --- 7 | 8 | 14 | 15 | # Course logistics 16 | 17 | [![Discord Chat](/assets/discord_logo.svg#badge)](https://discord.gg/Z5qnVf8) 18 | 19 | ### MIT Students Only 20 | [![Zoom Meeting](/assets/zoom_logo.svg#badge)](https://zoom.us/j/96183959527) 21 | [![Piazza Forum](/assets/piazza_logo.svg#badge)](https://piazza.com/mit/spring2021/6s083) 22 | [![Canvas LMS](/assets/canvas_logo.svg#badge)](https://canvas.mit.edu/courses/7590) 23 | [![MITx LMS](/assets/mitx_logo.svg#badge)](https://lms.mitx.mit.edu/courses/course-v1:MITx+6.S083r+2021_Spring/course/) 24 | 25 | > **Suggestion**: Bookmark this page for easy access to everything you need to follow this class! 26 | 27 | Counts as 6.0001 and 6.0002 credit, or can be taken in addition. Counts as a course 28 | 6 elective. 29 | 30 | Course materials will be published on this website on **Monday 1:00pm**. Each week is a new _chapter_, which includes: 31 | 32 | - Asynchronous video lectures _(total 60 minutes)_ 33 | - Interactive visualizations 34 | - Exercises 35 | 36 | ## Live lectures 37 | 38 | On **Monday 1:00pm - 2:30pm**, after the material is published, there will also be: 39 | 40 | - Q&A on Discord 41 | - Live overview lecture _(30 minutes)_ 42 | 43 | On **Wednesday 1:00pm 2:30pm** _(MIT students only)_, you will meet with fellow students and your TA to: 44 | 45 | - Review the lecture 46 | - Work on problem sets in small groups or individually, with the opportunity to ask questions to your TA 47 | 48 | Start date: February 16, 2021 49 | 50 | ## Discussion forum and homework submission 51 | 52 | - [Discord](https://discord.gg/Z5qnVf8): discussion (we encourage you to hang out here during class!) 53 | 54 | - MIT Only: [Canvas](https://canvas.mit.edu/courses/7590): Homework submissions, Piazza Link. If you're a non-MIT student, don't worry, the **homework has built-in answers checks**, or you can find a partner to cross-grade homeworks via Discord. 55 | 56 | ## Evaluation 57 | 58 | The final grade is 80% problem sets, and 20% MITx _quick questions_. 59 | 60 | - Problem sets are released on Friday and due the following Friday by 11:59pm EST. They have equal weight; your lowest score will be dropped. 61 | 62 | - [MITx](https://lms.mitx.mit.edu/courses/course-v1:MITx+6.S083r+2021_Spring/course/) exercises (_quick questions_) are due before Wednesday (11:59pm), but are best done on Monday, during or right after the lectures. 63 | -------------------------------------------------------------------------------- /src/pluto_export_configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment_to_website_maintainers": "README! hello! this file is for a special purpose: some of the notebooks from this repository are also featured Pluto notebooks (they show in the main menu of Pluto, see https://github.com/fonsp/Pluto.jl/pull/2927). More specifically, the site computational-thinking.mit.edu acts as a 'featured source' of pluto, search for plutojl.org in https://github.com/fonsp/Pluto.jl/blob/main/frontend/featured_sources.js . That means: this file does not configure this website, changing things here does not change the website.", 3 | 4 | "title": "Computational Thinking highlights", 5 | "description": "Highlights for the class Computational Thinking at MIT. For the complete course material, check out computationalthinking.mit.edu", 6 | 7 | "collections": [ 8 | { 9 | "title": "Julia track", 10 | "description": "These lectures are from the \"Julia track\" of Computational Thinking. Check out computationalthinking.mit.edu for the other tracks: Mathematics, Climate science and Data science.", 11 | "tags": ["track_julia"] 12 | } 13 | ] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/reviews.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Class reviews" 3 | tags: ["welcome"] 4 | order: 2.2123 5 | layout: "md.jlmd" 6 | --- 7 | 8 | 9 | # Student feedback 10 | 11 | 12 |
13 | 14 | $(let 15 | feedback = [ 16 | ( 17 | "Applications Feedback", 18 | "Spring 2020", 19 | @htl("

The Introduction to Computational Thinking with Julia class is a welcome departure from the paradigm of teaching the canonical computer science examples such as sorting algorithms and graph search that are often overused in introductory curricula.

The class delves into real-world applications from the very beginning in a way that gives students an opportunity to be excited about the possibilities of computer science and mathematical modelling all while learning how to harness the power and elegance of the modern language of Julia.

"), 20 | ), 21 | ( 22 | "Class Feedback", 23 | "Spring 2020", 24 | @htl("

This is one of the best classes I have ever taken. I like how the content is divided into four main real-world applications of computational thinking, which made learning very enjoyable and also made working with Julia easier for me.

I also found it amazing that this class provided applications of topics in differential equations and linear algebra classes and added a new way to view them. Unfortunately, I haven't found a similar class on computational thinking for the spring as the skills I gain are very practical and needed in research (I was impressed by the number of MISTI research opportunities that asked for experience with agent-based modeling or modeling in general.)

"), 25 | ), 26 | ( 27 | "Website Feedback", 28 | "Spring 2020", 29 | @htl("

The class website made the class lectures and homework easy to find in addition to the GitHub page and canvas. - The Discord channel and Piazza also made it easier to ask questions and see other students' questions and comments. - The feedback for assignments was very clear, and the instructors were willing to explain my mistakes further by email.

"), 30 | ), 31 | ( 32 | "Lecture Feedback", 33 | "Spring 2020", 34 | @htl("

The synchronous lectures were very comfortable, and the instructors encouraged us to ask questions.

"), 35 | ) 36 | ] 37 | 38 | [ 39 | @htl(""" 40 |
41 |
42 |

$(f[1]) 43 |

44 |
$(f[2]) 45 |
46 | $(f[3]) 47 |
48 |
49 | """) 50 | for f in feedback 51 | ] 52 | end) 53 | 54 |
55 | 56 | # What other people are saying 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/search.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Search results" 3 | tags: [] 4 | layout: "md.jlmd" 5 | --- 6 | 7 | 8 |
9 |
10 |

Search

11 | 17 | 18 |

Results

19 |
20 | Loading... 21 |
22 | 23 | -------------------------------------------------------------------------------- /src/semesters.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Previous semesters" 3 | tags: ["welcome"] 4 | order: 8 5 | layout: "md.jlmd" 6 | --- 7 | 8 | # This is the _Fall 2024_ edition 9 | 10 | For previous versions of this class, see: 11 | 12 | - [Fall 2023](https://computationalthinking.mit.edu/Fall23/) 13 | - [Fall 2022](https://computationalthinking.mit.edu/Fall22/) 14 | - [Spring 2021](https://computationalthinking.mit.edu/Spring21/) 15 | - [Fall 2020](https://computationalthinking.mit.edu/Fall20/) 16 | - [Spring 2020](https://ocw.mit.edu/courses/mathematics/18-s190-introduction-to-computational-thinking-with-julia-with-applications-to-modeling-the-covid-19-pandemic-spring-2020/) 17 | - [Fall 2019](https://github.com/dpsanders/6.S083_fall_2019/tree/fall_2019) 18 | -------------------------------------------------------------------------------- /src/sidebar data.jl: -------------------------------------------------------------------------------- 1 | Dict( 2 | "main" => [ 3 | "welcome" => collections["welcome"].pages, 4 | "Module 1: Images, Transformations, Abstractions" => collections["module1"].pages, 5 | "Module 2: Social Science & Data Science" => collections["module2"].pages, 6 | "Module 3: Climate Science" => collections["module3"].pages, 7 | 8 | ], 9 | ) -------------------------------------------------------------------------------- /src/structure.md: -------------------------------------------------------------------------------- 1 | {{ plutonotebookpage ../notebooks/week4/structure.jl }} -------------------------------------------------------------------------------- /src/week0/basic_syntax.jl: -------------------------------------------------------------------------------- 1 | ### A Pluto.jl notebook ### 2 | # v0.19.45 3 | 4 | #> [frontmatter] 5 | #> title = "Julia syntax basics" 6 | #> layout = "layout.jlhtml" 7 | #> description = "" 8 | #> tags = ["track_julia", "track_climate", "track_data", "track_math"] 9 | 10 | using Markdown 11 | using InteractiveUtils 12 | 13 | # ╔═╡ 0d3aec92-edeb-11ea-3adb-cd0dc17cbdab 14 | md"# Get started with Julia - live 15 | 16 | Before being able to run this notebook successfully locally, you will need to [set up Julia and Pluto.](https://plutojl.org/#install) 17 | " 18 | 19 | 20 | # ╔═╡ 3b038ee0-edeb-11ea-0977-97cc30d1c6ff 21 | md"## Variables 22 | 23 | We can define a variable using `=` (assignment). Then we can use its value in other expressions: 24 | " 25 | 26 | # ╔═╡ 3e8e0ea0-edeb-11ea-22e0-c58f7c2168ce 27 | x = 3 28 | 29 | 30 | # ╔═╡ 59b66862-edeb-11ea-2d62-71dcc79dbfab 31 | y = 2x 32 | 33 | # ╔═╡ 5e062a24-edeb-11ea-256a-d938f77d7815 34 | md"By default Julia displays the output of the last operation. (You can suppress the output by adding `;` (a semicolon) at the end.) 35 | " 36 | 37 | # ╔═╡ 7e46f0e8-edeb-11ea-1092-4b5e8acd9ee0 38 | md"We can ask what type a variable has using `typeof`:" 39 | 40 | # ╔═╡ 8a695b86-edeb-11ea-08cc-17263bec09df 41 | typeof(y) 42 | 43 | # ╔═╡ 8e2dd3be-edeb-11ea-0703-354fb31c12f5 44 | md"## Functions" 45 | 46 | # ╔═╡ 96b5a28c-edeb-11ea-11c0-597615962f54 47 | md"We can use a short-form, one-line function definition for simple functions:" 48 | 49 | # ╔═╡ a7453572-edeb-11ea-1e27-9f710fd856a6 50 | f(x) = 2 + x 51 | 52 | # ╔═╡ b341db4e-edeb-11ea-078b-b71ac00089d7 53 | md"Typing the function's name gives information about the function. To call it we must use parentheses:" 54 | 55 | # ╔═╡ 23f9afd4-eded-11ea-202a-9f0f1f91e5ad 56 | f 57 | 58 | # ╔═╡ cc1f6872-edeb-11ea-33e9-6976fd9b107a 59 | f(10) 60 | 61 | # ╔═╡ ce9667c2-edeb-11ea-2665-d789032abd11 62 | md"For longer functions we use the following syntax with the `function` keyword and `end`:" 63 | 64 | # ╔═╡ d73d3400-edeb-11ea-2dea-95e8c4a6563b 65 | function g(x, y) 66 | z = x + y 67 | return z^2 68 | end 69 | 70 | # ╔═╡ e04ccf10-edeb-11ea-36d1-d11969e4b2f2 71 | g(1, 2) 72 | 73 | # ╔═╡ e297c5cc-edeb-11ea-3bdd-090f415685ab 74 | md"## For loops" 75 | 76 | # ╔═╡ ec751446-edeb-11ea-31ba-2372e7c71b42 77 | md"Use `for` to loop through a pre-determined set of values:" 78 | 79 | # ╔═╡ fe3fa290-edeb-11ea-121e-7114e5c573c1 80 | let s = 0 81 | 82 | for i in 1:10 83 | s += i # Equivalent to s = s + i 84 | end 85 | 86 | s 87 | end 88 | 89 | # ╔═╡ 394b0ec8-eded-11ea-31fb-27392068ef8f 90 | md"Here, `1:10` is a **range** representing the numbers from 1 to 10:" 91 | 92 | # ╔═╡ 4dc00908-eded-11ea-25c5-0f7b2b7e18f9 93 | typeof(1:10) 94 | 95 | # ╔═╡ 6c44abb4-edec-11ea-16bd-557800b5f9d2 96 | md"Above we used a `let` block to define a new local variable `s`. 97 | But blocks of code like this are usually better inside functions, so that they can be reused. For example, we could rewrite the above as follows: 98 | " 99 | 100 | # ╔═╡ 683af3e2-eded-11ea-25a5-0d90bf099d98 101 | function mysum(n) 102 | s = 0 103 | 104 | for i in 1:n 105 | s += i 106 | end 107 | 108 | return s 109 | end 110 | 111 | # ╔═╡ 76764ea2-eded-11ea-1aa6-296f3421de1c 112 | mysum(100) 113 | 114 | # ╔═╡ 93a231f4-edec-11ea-3b39-299b3be2da78 115 | md"## Conditionals: `if`" 116 | 117 | # ╔═╡ 82e63a24-eded-11ea-3887-15d6bfabea4b 118 | md"We can evaluate whether a condition is true or not by simply writing the condition:" 119 | 120 | # ╔═╡ 9b339b2a-eded-11ea-10d7-8fc9a907c892 121 | a = 3 122 | 123 | # ╔═╡ 9535eb40-eded-11ea-1651-e33c9c23dbfb 124 | a < 5 125 | 126 | # ╔═╡ a16299a2-eded-11ea-2b56-93eb7a1010a7 127 | md"We see that conditions have a Boolean (`true` or `false`) value. 128 | 129 | We can then use `if` to control what we do based on that value:" 130 | 131 | # ╔═╡ bc6b124e-eded-11ea-0290-b3760cb81024 132 | if a < 5 133 | "small" 134 | 135 | else 136 | "big" 137 | 138 | end 139 | 140 | # ╔═╡ cfb21014-eded-11ea-1261-3bc30952a88e 141 | md"""Note that the `if` also returns the last value that was evaluated, in this case the string `"small"` or `"big"`, Since Pluto is reactive, changing the definition of `a` above will automatically cause this to be reevaluated!""" 142 | 143 | # ╔═╡ ffee7d80-eded-11ea-26b1-1331df204c67 144 | md"## Arrays" 145 | 146 | # ╔═╡ cae4137e-edee-11ea-14af-59a32227de1b 147 | md"### 1D arrays (`Vector`s)" 148 | 149 | # ╔═╡ 714f4fca-edee-11ea-3410-c9ab8825d836 150 | md"We can make a `Vector` (1-dimensional, or 1D array) using square brackets:" 151 | 152 | # ╔═╡ 82cc2a0e-edee-11ea-11b7-fbaa5ad7b556 153 | v = [1, 2, 3] 154 | 155 | # ╔═╡ 85916c18-edee-11ea-0738-5f5d78875b86 156 | typeof(v) 157 | 158 | # ╔═╡ 881b7d0c-edee-11ea-0b4a-4bd7d5be2c77 159 | md"The `1` in the type shows that this is a 1D array. 160 | 161 | We access elements also using square brackets:" 162 | 163 | # ╔═╡ a298e8ae-edee-11ea-3613-0dd4bae70c26 164 | v[2] 165 | 166 | # ╔═╡ a5ebddd6-edee-11ea-2234-55453ea59c5a 167 | v[2] = 10 168 | 169 | # ╔═╡ a9b48e54-edee-11ea-1333-a96181de0185 170 | md"Note that Pluto does not automatically update cells when you modify elements of an array, but the value does change." 171 | 172 | # ╔═╡ 68c4ead2-edef-11ea-124a-03c2d7dd6a1b 173 | md"A nice way to create `Vector`s following a certain pattern is to use an **array comprehension**:" 174 | 175 | # ╔═╡ 84129294-edef-11ea-0c77-ffa2b9592a26 176 | v2 = [i^2 for i in 1:10] 177 | 178 | # ╔═╡ d364fa16-edee-11ea-2050-0f6cb70e1bcf 179 | md"## 2D arrays (matrices)" 180 | 181 | # ╔═╡ db99ae9a-edee-11ea-393e-9de420a545a1 182 | md"We can make small matrices (2D arrays) with square brackets too:" 183 | 184 | # ╔═╡ 04f175f2-edef-11ea-0882-712548ebb7a3 185 | M = [1 2 186 | 3 4] 187 | 188 | # ╔═╡ 0a8ac112-edef-11ea-1e99-cf7c7808c4f5 189 | typeof(M) 190 | 191 | # ╔═╡ 1295f48a-edef-11ea-22a5-61e8a2e1d005 192 | md"The `2` in the type confirms that this is a 2D array." 193 | 194 | # ╔═╡ 3e1fdaa8-edef-11ea-2f03-eb41b2b9ea0f 195 | md"This won't work for larger matrices, though. For that we can use e.g." 196 | 197 | # ╔═╡ 48f3deca-edef-11ea-2c18-e7419c9030a0 198 | zeros(5, 5) 199 | 200 | # ╔═╡ a8f26af8-edef-11ea-2fc7-2b776f515aea 201 | md"Note that `zeros` gives `Float64`s by default. We can also specify a type for the elements:" 202 | 203 | # ╔═╡ b595373e-edef-11ea-03e2-6599ef14af20 204 | zeros(Int, 4, 5) 205 | 206 | # ╔═╡ 4cb33c04-edef-11ea-2b35-1139c246c331 207 | md"We can then fill in the values we want by manipulating the elements, e.g. with a `for` loop." 208 | 209 | # ╔═╡ 54e47e9e-edef-11ea-2d75-b5f550902528 210 | md"A nice alternative syntax to create matrices following a certain pattern is an array comprehension with a *double* `for` loop:" 211 | 212 | # ╔═╡ 6348edce-edef-11ea-1ab4-019514eb414f 213 | [i + j for i in 1:5, j in 1:6] 214 | 215 | # ╔═╡ Cell order: 216 | # ╟─0d3aec92-edeb-11ea-3adb-cd0dc17cbdab 217 | # ╟─3b038ee0-edeb-11ea-0977-97cc30d1c6ff 218 | # ╠═3e8e0ea0-edeb-11ea-22e0-c58f7c2168ce 219 | # ╠═59b66862-edeb-11ea-2d62-71dcc79dbfab 220 | # ╟─5e062a24-edeb-11ea-256a-d938f77d7815 221 | # ╟─7e46f0e8-edeb-11ea-1092-4b5e8acd9ee0 222 | # ╠═8a695b86-edeb-11ea-08cc-17263bec09df 223 | # ╟─8e2dd3be-edeb-11ea-0703-354fb31c12f5 224 | # ╟─96b5a28c-edeb-11ea-11c0-597615962f54 225 | # ╠═a7453572-edeb-11ea-1e27-9f710fd856a6 226 | # ╟─b341db4e-edeb-11ea-078b-b71ac00089d7 227 | # ╠═23f9afd4-eded-11ea-202a-9f0f1f91e5ad 228 | # ╠═cc1f6872-edeb-11ea-33e9-6976fd9b107a 229 | # ╟─ce9667c2-edeb-11ea-2665-d789032abd11 230 | # ╠═d73d3400-edeb-11ea-2dea-95e8c4a6563b 231 | # ╠═e04ccf10-edeb-11ea-36d1-d11969e4b2f2 232 | # ╟─e297c5cc-edeb-11ea-3bdd-090f415685ab 233 | # ╟─ec751446-edeb-11ea-31ba-2372e7c71b42 234 | # ╠═fe3fa290-edeb-11ea-121e-7114e5c573c1 235 | # ╟─394b0ec8-eded-11ea-31fb-27392068ef8f 236 | # ╠═4dc00908-eded-11ea-25c5-0f7b2b7e18f9 237 | # ╟─6c44abb4-edec-11ea-16bd-557800b5f9d2 238 | # ╠═683af3e2-eded-11ea-25a5-0d90bf099d98 239 | # ╠═76764ea2-eded-11ea-1aa6-296f3421de1c 240 | # ╟─93a231f4-edec-11ea-3b39-299b3be2da78 241 | # ╟─82e63a24-eded-11ea-3887-15d6bfabea4b 242 | # ╠═9b339b2a-eded-11ea-10d7-8fc9a907c892 243 | # ╠═9535eb40-eded-11ea-1651-e33c9c23dbfb 244 | # ╟─a16299a2-eded-11ea-2b56-93eb7a1010a7 245 | # ╠═bc6b124e-eded-11ea-0290-b3760cb81024 246 | # ╟─cfb21014-eded-11ea-1261-3bc30952a88e 247 | # ╟─ffee7d80-eded-11ea-26b1-1331df204c67 248 | # ╟─cae4137e-edee-11ea-14af-59a32227de1b 249 | # ╟─714f4fca-edee-11ea-3410-c9ab8825d836 250 | # ╠═82cc2a0e-edee-11ea-11b7-fbaa5ad7b556 251 | # ╠═85916c18-edee-11ea-0738-5f5d78875b86 252 | # ╟─881b7d0c-edee-11ea-0b4a-4bd7d5be2c77 253 | # ╠═a298e8ae-edee-11ea-3613-0dd4bae70c26 254 | # ╠═a5ebddd6-edee-11ea-2234-55453ea59c5a 255 | # ╟─a9b48e54-edee-11ea-1333-a96181de0185 256 | # ╟─68c4ead2-edef-11ea-124a-03c2d7dd6a1b 257 | # ╠═84129294-edef-11ea-0c77-ffa2b9592a26 258 | # ╟─d364fa16-edee-11ea-2050-0f6cb70e1bcf 259 | # ╟─db99ae9a-edee-11ea-393e-9de420a545a1 260 | # ╠═04f175f2-edef-11ea-0882-712548ebb7a3 261 | # ╠═0a8ac112-edef-11ea-1e99-cf7c7808c4f5 262 | # ╟─1295f48a-edef-11ea-22a5-61e8a2e1d005 263 | # ╟─3e1fdaa8-edef-11ea-2f03-eb41b2b9ea0f 264 | # ╠═48f3deca-edef-11ea-2c18-e7419c9030a0 265 | # ╟─a8f26af8-edef-11ea-2fc7-2b776f515aea 266 | # ╠═b595373e-edef-11ea-03e2-6599ef14af20 267 | # ╟─4cb33c04-edef-11ea-2b35-1139c246c331 268 | # ╟─54e47e9e-edef-11ea-2d75-b5f550902528 269 | # ╠═6348edce-edef-11ea-1ab4-019514eb414f 270 | -------------------------------------------------------------------------------- /tools/update_notebook_packages.jl: -------------------------------------------------------------------------------- 1 | if !isdir("pluto-deployment-environment") || length(ARGS) != 1 2 | error(""" 3 | Run me from the root of the repository directory, using: 4 | 5 | julia tools/update_notebook_packages.jl 6 | 7 | Where is one of: PATCH, MINOR, MAJOR 8 | """) 9 | end 10 | 11 | if VERSION < v"1.6.0-aaa" 12 | @error "Our website needs to be generated with Julia 1.6. Go to julialang.org/downloads to install it." 13 | end 14 | 15 | import Pkg 16 | Pkg.activate("./pluto-deployment-environment") 17 | Pkg.instantiate() 18 | 19 | import Pluto 20 | 21 | flatmap(args...) = vcat(map(args...)...) 22 | 23 | 24 | all_files_recursive = flatmap(walkdir("src")) do (root, _dirs, files) 25 | joinpath.((root,), files) 26 | end 27 | 28 | all_notebooks = filter(Pluto.is_pluto_notebook, all_files_recursive) 29 | 30 | level = getfield(Pkg, Symbol("UPLEVEL_$(ARGS[1])")) 31 | 32 | for n in all_notebooks 33 | @info "Updating" n 34 | Pluto.update_notebook_environment(n; backup=false, level) 35 | end 36 | --------------------------------------------------------------------------------