To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 50 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
72.4 μs
👀 Reading hidden code
67.2 μs
👀 Reading hidden code
65.7 μs

📏 Unitful sliders!

👀 Reading hidden code
168 μs
👀 Reading hidden code
using PlutoUI
179 ms
👀 Reading hidden code
@bind x Slider(1:100)
243 ms
1
👀 Reading hidden code
10.4 μs
👀 Reading hidden code
67.6 μs
👀 Reading hidden code
65.5 μs
👀 Reading hidden code
65.1 μs
👀 Reading hidden code
using Unitful
124 ms
1200 m
👀 Reading hidden code
1u"km" + 200u"m"
42.5 ms
👀 Reading hidden code
65.5 μs
👀 Reading hidden code
65.4 μs
👀 Reading hidden code
65.3 μs
👀 Reading hidden code
64.8 μs

Together!

👀 Reading hidden code
179 μs
@bind f Select([square_area, circle_area])
👀 Reading hidden code
153 ms
@bind diameter Slider((1:20)u"cm")
👀 Reading hidden code
463 ms
1 cm^2
f(diameter)
👀 Reading hidden code
13.2 μs
👀 Reading hidden code
67.0 μs
👀 Reading hidden code
65.7 μs
👀 Reading hidden code
67.9 μs
👀 Reading hidden code
65.4 μs
👀 Reading hidden code
64.8 μs
👀 Reading hidden code
65.3 μs

👀 Function slider

👀 Reading hidden code
165 μs

Let's define two functions:

👀 Reading hidden code
168 μs
square_area (generic function with 1 method)
square_area(x) = x^2
👀 Reading hidden code
442 μs
circle_area (generic function with 1 method)
circle_area(x) = π * x^2
👀 Reading hidden code
428 μs
👀 Reading hidden code
66.7 μs
👀 Reading hidden code
65.9 μs

We can slide through a list of functions!

👀 Reading hidden code
176 μs
square_area (generic function with 1 method)
f
👀 Reading hidden code
10.2 μs
👀 Reading hidden code
66.5 μs
👀 Reading hidden code
65.0 μs
👀 Reading hidden code
66.2 μs
👀 Reading hidden code
66.1 μs
👀 Reading hidden code
66.5 μs

Want to learn more?

Pluto.jl is an open source, interactive programming environment for Julia, designed for teachers.

Try it out today! plutojl.org

👀 Reading hidden code
371 μs