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 20 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
Error message

Another cell defining df contains errors.

Computers are hard!
👀 Reading hidden code
PlutoUI.WithIOContext(df, displaysize=(99999,99999))
---
Error message

ArgumentError: `DataFrame` constructor from a `Matrix` requires passing :auto as a second argument to automatically generate column names: `DataFrame(matrix, :auto)`

Stack trace

Here is what happened, the most recent locations are first:

  1. DataFrames.DataFrame(matrix::Matrix{Int64})
  2. df = DataFrame(x)
👀 Reading hidden code
df = DataFrame(x)
---
100×100 Matrix{Int64}:
 28  29  54  95  95  86  29  52  99  85  …  24   9  68  82  81  58  74  94  80  56
 44  61  26  66  70  87  90  37  76  30     77  25  63  79   2  43  96  74  88  26
 46  63  49  55  92  80  70  92  57  38     88  93  30  67  10  63  90  22  45  18
 92  38  56  15  37  50   8  62  11  69     42  32  85  89  69  49  29  77  74  70
 62  96  54  68  92  51  57  69  55  51     45  61   6  29  94  61  35  51   3   5
 23  84  43  20  80  62  88  36  87  57  …  56  29  96  83  13  23  37  92  13  95
 59  73  51  59  20  80  58  10  19  36     71  53  41  11  97  10  15  11  17  25
  ⋮                   ⋮                  ⋱   ⋮                   ⋮              
 41  56  74  36  47  97  44  28  78  86     59  51  35  52  48  49  81  72  74  36
 25  33   8   3   1  88  62  56  83  99  …  44  55  36  74  65  92  33  50  67  73
 14  88   2   7  99  55  72  92  46  46     68   9  57  22  87  20  20  38  55  10
 60   4  63  64  39  61  31   1  77  51     99  65  40  32  68   7  66  98  61  35
 31  14  32  34  99  17  54  91  74  54     85  15  18  73  36  90  78  90  37  51
  9   2  48   8  92  99  14  11  45  20     66  63  25  93  21  93  31  38  71   9
x = rand(1:99, 100,100)
👀 Reading hidden code
79.7 μs

asdf

asdf

asdf
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfa|>sdfvv
md"""
asdf

# asdf

```julia
asdf
```

```
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfa|>sdfvv
```


"""
👀 Reading hidden code
219 μs
[md"# asdf", 123, x]
👀 Reading hidden code
41.9 ms
"|>"
"|>"
👀 Reading hidden code
9.5 μs
["|>"]
👀 Reading hidden code
13.0 μs
100×1 Matrix{Int64}:
 28
 44
 46
 92
 62
 23
 59
  ⋮
 41
 25
 14
 60
 31
  9
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = x[:,1:n]
👀 Reading hidden code
26.2 μs
@bind n Slider(1:99)
👀 Reading hidden code
382 ms
begin
using Revise
using PlutoUI
using DataFrames
end
👀 Reading hidden code
2.5 s
Float16(3.14)
Float16(pi)
👀 Reading hidden code
12.5 μs
3.1415927f0
Float32(pi)
👀 Reading hidden code
14.3 μs
3.141592653589793
Float64(pi)
👀 Reading hidden code
13.8 μs
Any[Float16(pi), Float32(pi), Float64(pi)]
👀 Reading hidden code
23.9 μs
x[1,:]
👀 Reading hidden code
16.7 μs
Error message

DomainError with -1.0:

sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).

Stack trace

Here is what happened, the most recent locations are first:

  1. throw_complex_domainerror(f::Symbol, x::Float64)
    from math.jl:33
  2. sqrt
  3. sqrt
  4. |>(x::Int64, f::typeof(sqrt))
  5. -1 |> sqrt
Silly computer!
-1 |> sqrt
👀 Reading hidden code
---
100×100 Matrix{Int64}:
 28  29  54  95  95  86  29  52  99  85  …  24   9  68  82  81  58  74  94  80  56
 44  61  26  66  70  87  90  37  76  30     77  25  63  79   2  43  96  74  88  26
 46  63  49  55  92  80  70  92  57  38     88  93  30  67  10  63  90  22  45  18
 92  38  56  15  37  50   8  62  11  69     42  32  85  89  69  49  29  77  74  70
 62  96  54  68  92  51  57  69  55  51     45  61   6  29  94  61  35  51   3   5
 23  84  43  20  80  62  88  36  87  57  …  56  29  96  83  13  23  37  92  13  95
 59  73  51  59  20  80  58  10  19  36     71  53  41  11  97  10  15  11  17  25
  ⋮                   ⋮                  ⋱   ⋮                   ⋮              
 41  56  74  36  47  97  44  28  78  86     59  51  35  52  48  49  81  72  74  36
 25  33   8   3   1  88  62  56  83  99  …  44  55  36  74  65  92  33  50  67  73
 14  88   2   7  99  55  72  92  46  46     68   9  57  22  87  20  20  38  55  10
 60   4  63  64  39  61  31   1  77  51     99  65  40  32  68   7  66  98  61  35
 31  14  32  34  99  17  54  91  74  54     85  15  18  73  36  90  78  90  37  51
  9   2  48   8  92  99  14  11  45  20     66  63  25  93  21  93  31  38  71   9
PlutoUI.WithIOContext(x, :compact => true)
👀 Reading hidden code
8.6 ms
f (generic function with 1 method)
f(x...) = x
👀 Reading hidden code
409 μs
f(:a => 2, :b => 3)
👀 Reading hidden code
23.1 μs
Error message

MethodError: no method matching f(; a=2, b=3)

Closest candidates are:

f(::Any...) at ~/work/disorganised-mess/disorganised-mess/WithIOContext.jl#==#d2692aa6-1519-11eb-3943-2fa87dde3c98:1 got unsupported keyword arguments "a", "b"

Stack trace

Here is what happened, the most recent locations are first:

  1. f(;a = 2, b = 3)
f(;a = 2, b = 3)
👀 Reading hidden code
---
Error message

MethodError: no method matching f(; a=2, b=3)

Closest candidates are:

f(::Any...) at ~/work/disorganised-mess/disorganised-mess/WithIOContext.jl#==#d2692aa6-1519-11eb-3943-2fa87dde3c98:1 got unsupported keyword arguments "a", "b"

Stack trace

Here is what happened, the most recent locations are first:

  1. f(a = 2, b = 3)
f(a = 2, b = 3)
👀 Reading hidden code
---
g (generic function with 1 method)
g(x...; y...) = [x...,y...]
👀 Reading hidden code
1.2 ms
g(:a => 2)
👀 Reading hidden code
19.1 μs
g(a = 2, b = 3)
👀 Reading hidden code
13.4 ms
h (generic function with 1 method)
h(a, b...; c...) = [b..., c...]
👀 Reading hidden code
1.2 ms
h(1, 2=>3)
👀 Reading hidden code
18.4 μs
WithIOContext
begin
struct WithIOContext
x
context_properties
end
WithIOContext(x, props::Pair...; moreprops...) = WithIOContext(x, [props..., moreprops...])
end
👀 Reading hidden code
2.2 ms
function Base.show(io::IO, m::MIME"text/plain", w::WithIOContext)
Base.show(IOContext(io, w.context_properties...), m, w.x)
end
👀 Reading hidden code
3.3 ms
100×100 Matrix{Int64}:
 28  29  …  56
 44  61     26
 46  63     18
  ⋮      ⋱  
 31  14     51
  9   2      9
WithIOContext(x, :a => false, compact = true, cols=3, displaysize=(10,20))
👀 Reading hidden code
52.3 ms
100×100 Array{Int64, 2}:
 28  29  54  95  95  86  29  52  99  85  …  24   9  68  82  81  58  74  94  80  56
 44  61  26  66  70  87  90  37  76  30     77  25  63  79   2  43  96  74  88  26
 46  63  49  55  92  80  70  92  57  38     88  93  30  67  10  63  90  22  45  18
 92  38  56  15  37  50   8  62  11  69     42  32  85  89  69  49  29  77  74  70
 62  96  54  68  92  51  57  69  55  51     45  61   6  29  94  61  35  51   3   5
 23  84  43  20  80  62  88  36  87  57  …  56  29  96  83  13  23  37  92  13  95
 59  73  51  59  20  80  58  10  19  36     71  53  41  11  97  10  15  11  17  25
  ⋮                   ⋮                  ⋱   ⋮                   ⋮              
 41  56  74  36  47  97  44  28  78  86     59  51  35  52  48  49  81  72  74  36
 25  33   8   3   1  88  62  56  83  99  …  44  55  36  74  65  92  33  50  67  73
 14  88   2   7  99  55  72  92  46  46     68   9  57  22  87  20  20  38  55  10
 60   4  63  64  39  61  31   1  77  51     99  65  40  32  68   7  66  98  61  35
 31  14  32  34  99  17  54  91  74  54     85  15  18  73  36  90  78  90  37  51
  9   2  48   8  92  99  14  11  45  20     66  63  25  93  21  93  31  38  71   9
WithIOContext(x, :compact => false)
👀 Reading hidden code
20.8 μs