Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-novice into main
  • Loading branch information
BeastyBlacksmith committed Nov 15, 2023
2 parents 47b2cf4 + 0cfd076 commit 8aa515a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion episodes/04_Using_the_package_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ environment.
````
Status `~/projects/trebuchet/Project.toml`
[f6369f11] ForwardDiff v0.10.36
[295af30f] Revise v3.5.7
[295af30f] Revise v3.5.9
[98b73d46] Trebuchet v0.2.2
````
Expand Down
17 changes: 15 additions & 2 deletions episodes/05_Write_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ Closest candidates are:
size(::AbstractArray{T, N}, !Matched::Any) where {T, N}
@ Base abstractarray.jl:42
size(!Matched::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted})
@ LinearAlgebra /opt/hostedtoolcache/julia/1.9.3/x64/share/julia/stdlib/v1.9/LinearAlgebra/src/qr.jl:582
@ LinearAlgebra /opt/hostedtoolcache/julia/1.9.4/x64/share/julia/stdlib/v1.9/LinearAlgebra/src/qr.jl:582
size(!Matched::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}, !Matched::Integer)
@ LinearAlgebra /opt/hostedtoolcache/julia/1.9.3/x64/share/julia/stdlib/v1.9/LinearAlgebra/src/qr.jl:581
@ LinearAlgebra /opt/hostedtoolcache/julia/1.9.4/x64/share/julia/stdlib/v1.9/LinearAlgebra/src/qr.jl:581
...
````
Expand Down Expand Up @@ -425,6 +425,19 @@ She can also lookup the docstring using the `@doc` macro
Return a tuple with the size of the buffer.
size(s::Sampleable)
The size (i.e. shape) of each sample. Always returns () when s is
univariate, and (length(s),) when s is multivariate.
size(d::MultivariateDistribution)
Return the sample size of distribution d, i.e (length(d),).
size(d::MatrixDistribution)
Return the size of each sample from distribution d.
size(g, i)
Return the number of vertices in g if i=1 or i=2, or 1 otherwise.
Expand Down
30 changes: 15 additions & 15 deletions episodes/07_Loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ Trebuchet( rand() * 500, rand() * pi/2 )

````output
2-element Trebuchet:
376.178140632858
1.202932191168969
19.92126761754809
1.1758129035479739
````

will give her a Trebuchet with a weight between 0 and 500 and a release angle between 0 and pi/2 radians at random.
Expand All @@ -121,9 +121,9 @@ distances = [shoot_distance(Trebuchet(rand() * 500, rand() * pi / 2), env) for _

````output
3-element Vector{Float64}:
116.46124636135293
52.7811798347779
104.89623248181303
106.68417294212176
116.21335516132379
73.730294183957
````

This is called an _array comprehension_.
Expand All @@ -138,16 +138,16 @@ distances = [(w,a) => shoot_distance(Trebuchet(w, a), env) for (w, a) in zip(wei

````output
10-element Vector{Pair{Tuple{Float64, Float64}, Float64}}:
(407.1030550189028, 0.3891512578388659) => 112.09184022880909
(129.3962122859022, 0.47410570172882877) => 97.15862611465982
(460.1656325336061, 0.985034729119892) => 99.11003543196146
(110.51399719143818, 1.1558775471416098) => 61.0114196763061
(265.81455100189766, 0.8247629754893243) => 104.58648053317526
(96.13278884246179, 0.27533670195930326) => 77.83567463291564
(12.485336793085056, 0.9864156252374033) => 0.6815707596179541
(352.3464102053692, 1.2580446062583366) => 59.37739417570197
(391.36673118879764, 1.195168563100913) => 73.94484391737066
(477.81826452742524, 0.048738054505380206) => 69.01930432439035
(181.72785884820692, 0.397146829944134) => 101.73108411880898
(63.630046905466806, 0.0007390075864837765) => 38.578677436450356
(381.07768051820875, 0.14798050038431537) => 87.06414198100867
(282.3416703597322, 1.1918686477537617) => 69.0089195197084
(368.30808129827875, 0.0067941316204262366) => 59.34525074762748
(344.7882424260206, 0.3851870910679704) => 111.70986370160507
(372.4460093501431, 0.06855206373789495) => 72.63633120284015
(360.2628661185558, 1.4172206158209621) => 32.342739435405775
(43.15599567794415, 0.631090875891836) => 59.136515031317124
(483.7790756755326, 0.8497073005978015) => 110.42731071869284
````

### Gradient descent
Expand Down
4 changes: 2 additions & 2 deletions episodes/10_Adding_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end
````

````output
Test.DefaultTestSet("Test arithmetic equalities", Any[], 1, false, false, true, 1.698515973154304e9, 1.698515973191453e9, false)
Test.DefaultTestSet("Test arithmetic equalities", Any[], 1, false, false, true, 1.700042192846853e9, 1.70004219287704e9, false)
````

With this Melissa can run her test using the pkg mode of the REPL:
Expand All @@ -76,7 +76,7 @@ Thus it is possible to move the `Test` entry in the `Project.toml` file from
test = ["Test"]
```

Check out the [sample project file](../code/Project.toml) for a complete
Check out the [sample project file](https://github.com/carpentries-incubator/julia-novice/blob/main/code/Project.toml) for a complete
example.

:::::: challenge
Expand Down

0 comments on commit 8aa515a

Please sign in to comment.