diff --git a/notebooks/day1/02-collections.jl b/notebooks/day1/02-collections.jl index efb920b..b10b97d 100644 --- a/notebooks/day1/02-collections.jl +++ b/notebooks/day1/02-collections.jl @@ -60,7 +60,28 @@ A = [] # empty array md"Note that the element type is `Any`, since the compiler has no idea what we would store in `A`!" # ╔═╡ a0c22de6-4c1d-11eb-34a2-aff57cfd22a1 -X = [1, 3, -5, 7] # array of integers +X = [1, 3, -5, 6] # array of integers + +# ╔═╡ 57386df5-058b-4f50-98b1-2557553fa54c +md"Julia provides many functions to process arrays." + +# ╔═╡ 4a7c0935-de06-469e-8eef-88664d5678a5 +sum(X) + +# ╔═╡ ca8fb43b-94d3-43b0-a686-1f5380d766b9 +minimum(X) + +# ╔═╡ c5a6873a-a7c3-4ed5-8e3a-34cece9dc2d2 +extrema(X) # smallest and largest value + +# ╔═╡ 845df822-2d5b-47ab-ac46-9656d2a68d73 +any([true, false, true]) + +# ╔═╡ 60f0eee2-4f23-4cd4-9fdd-0c69100b9662 +any(>(0), X) # >(0) generates a function that check is something is greater than 0 + +# ╔═╡ 17875f73-831a-4e06-8492-e172295da1da +count(isodd, X) # ╔═╡ a81d1f22-4c1d-11eb-1b76-2929f30565bf md"### Indexing and slicing" @@ -294,6 +315,9 @@ P[3,2] # indexing # ╔═╡ 0b9d0bf8-4c24-11eb-2beb-0763c66e6a20 P[1,:] # slicing +# ╔═╡ d02f96c8-4192-4bb5-92e8-1837af89f013 +P' # tranposing (or conjugate transpose for a complex matrix) + # ╔═╡ b9a9a730-5a73-11eb-0d17-7bf1aa935697 md"You will likely not be surprised that most functions just work for two (or more) dimensions:" @@ -380,7 +404,7 @@ md"### Element-wise operations" md"""This is the Julian way since functions act on the objects, and element-wise operations are done with "dot" operations. For every function or binary operation like `^` there is a "dot" operation `.^` to perform element-by-element exponentiation on arrays.""" # ╔═╡ 0697987c-4c4b-11eb-3052-df54b72dec52 -T = [10 10 10; 20 20 20] +T = [10 20 30; 21 22 23] # ╔═╡ 14bceb32-4c4b-11eb-06b2-5190f7ebb9c2 T.^2 @@ -400,7 +424,22 @@ Did you notice that dot-operations are also applicable to functions, even user-d T.^2 .+ cos.(T) == @. T^2 + cos(T) # ╔═╡ be557eda-64a3-11eb-1562-35ad48531ebd +md"Many functions that compute something on a whole matrix can also work on the the rows or columns." + +# ╔═╡ 16951b3e-4748-41d4-b42e-49f230979f39 +sum(T) + +# ╔═╡ fd4c9d45-3099-4044-9177-650430b7f5f1 +sum(T, dims=1) # over rows + +# ╔═╡ 0ee08475-fa03-4e4f-9fcc-7b173387043a +sum(T, dims=2) # over columns + +# ╔═╡ 61a1d179-783f-46e2-8180-352d1220e35f +maximum(T, dims=1) +# ╔═╡ 295b6131-cbc3-45bf-af6a-c823b38eb9ea +md"Note that the dimensionality is kept. This is important for type stability!" # ╔═╡ eed4faca-4c1f-11eb-3e6c-b342b48080eb md""" ### Intermezzo: Colors.jl and Images.jl @@ -464,7 +503,7 @@ md"### Higher dimensional arrays" md"Matrices can be generalized to multiple dimensions." # ╔═╡ 5fcfb5dc-4c4b-11eb-0be6-e7f66ea1839e -H = rand(3, 3, 3) +H = rand(3, 3, 3) # many functions to construct arrays work with an arbitrary number of dimensions # ╔═╡ bf6b9fc4-5a74-11eb-2676-bda580c65877 md"That is all there is to see about matrices, feel free to create arrays of any dimension." @@ -528,7 +567,13 @@ md"`StepRange` and `UnitRange` also work with floats." (0:1:100) / 10 # equivalent # ╔═╡ ae6064e6-64a4-11eb-24b5-0b0b848aa2d6 +md"You can also use the function `range`:" +# ╔═╡ 8fec0796-6084-49c3-a7f8-a00dfd329e2c +range(0, 1, 10) # start, stop, length + +# ╔═╡ 0704bcce-0e7b-42c6-8aa4-8f8e0922e3b5 +range(0, 1, step=0.2) # giving steps # ╔═╡ 0fd08728-4c58-11eb-1b71-c9710d398fab md"## 3. Other collections" @@ -581,6 +626,9 @@ md"### Dictionaries" # ╔═╡ c6d236da-4c58-11eb-2714-3f5c43583a3d md"A dictionary is a collection that stores a set of values with their corresponding keys internally for faster data retrieval. The operation of finding the value associated with a key is called lookup or indexing. [Techopedia.com](https://www.techopedia.com/definition/10263/dictionary-c)" +# ╔═╡ e594575b-8faa-4be4-8367-75dd65afc01f +md"Dictionaries can be initialized by giving a series of key-value pairs of the form `k=>v':" + # ╔═╡ 3253ab74-4c58-11eb-178e-83ea8aba9c8f scores = Dict("humans" => 2, "vogons" => 1) # dictionaries @@ -596,8 +644,134 @@ scores # ╔═╡ 3fc787d6-5a76-11eb-06e9-5378d27ce011 delete!(scores, "humans") # removing a key, earth was destroyed +# ╔═╡ 937af866-47db-4aa7-9c42-3e92cb42383c +md"## 4. Strings" + +# ╔═╡ e6c6b353-cc75-4ce4-8055-7a78ea8b3bca +md""" +In the previous notebook, we briefly covered strings. As strings have much in common with collections, they are a sequence of characters, we will show a bit more functionality here. +""" + +# ╔═╡ f7a97d80-3951-44e6-82dc-4b5714bb145c +mystring = "One ring to rule them all" # strings are defined using double quotes + +# ╔═╡ e5405e7a-e986-4cfb-b338-98ae453b9101 +mystring[3] # a string is built from characters + +# ╔═╡ ba650ce6-d4a5-44dd-9ddc-42add99cbac2 +'a' # character + +# ╔═╡ ab1dc759-a500-44f5-b182-43dc6811ec11 +"a" # tiny string + +# ╔═╡ 3a71effa-67d6-4694-8d70-6e22e7672904 +mystring[5:8] # slicing works similarly as with vectors + +# ╔═╡ e1f2dd8b-4b3c-457b-b880-1def928b4524 +mystring[end-2:end] # gives a Substring + +# ╔═╡ 3f9d2121-1a98-47e4-96cf-9b32ebdcbd7b +mystring[1] = '0' # this doesn't work however! + +# ╔═╡ 580d6c53-1f3b-4044-88ab-8e31781276f6 +md"For long strings, you can use triple quotes:" + +# ╔═╡ c71f044c-6807-4fff-9fd9-5590d5fef845 +mylongstring = """ +One ring to rule them all, + one ring to find them, +One ring to bring them all + and in the darkness bind them. +""" + +# ╔═╡ 5fb7bbbf-63a7-4bd5-88dc-24f4ac330266 +println(mylongstring) + +# ╔═╡ 636d20ce-efce-48f2-a7cb-c8db7bb0cc3a +md"Note that there is a `\n` at the end that is not so tidy. This frequently occurs when parsing strings and can be solved by `rstrip`." + +# ╔═╡ 3ab46e8a-dbf1-4103-9e1a-8887f375512e +rstrip(mylongstring) + +# ╔═╡ f1ac2420-767f-405d-b68e-543f7842e96f +md"You can interpolate strings by using `$variable`, for example:" + +# ╔═╡ ee864877-ffa4-4603-a9d6-b54501abdadf +"The ring is carried by $(student.name)" + +# ╔═╡ 8b5153b5-dcee-401f-9664-bc8eb02f1c8a +"The answer to life, the universe and everything is $(7 * 3 * 2)!" # you can compute something there + +# ╔═╡ 3f765458-4a6e-40a4-a075-b4e20ee01f80 +md"Two or more strings can be concatenated using `*`:" + +# ╔═╡ d7e1c451-664b-445b-a737-075c32239c88 +"hocus" * "pocus" + +# ╔═╡ dadda755-621f-4903-be44-d7f954030c98 +md"So, since `*` is used for concatenation, you might infer that `^` would repeat a string" + +# ╔═╡ 2000c0e1-f4c0-43ac-97de-7aa6db592c41 +"ha"^20 + +# ╔═╡ 187f81ab-8996-45aa-955d-b2ca6b598016 +md""" +There are many handy functions for processing and searching strings. +""" + +# ╔═╡ 60371e70-2e74-4ec4-9952-348b10f0c545 +findfirst("ring", mylongstring) # position of the first occurence of a string + +# ╔═╡ e1b4260c-231f-4d31-86b4-fead7f780782 +findlast("ring", mylongstring) # position of the last occurence of a string + +# ╔═╡ 10507d4a-08d7-4520-a210-744fd6824ef8 +occursin("find", mylongstring) # check if a substring is part of a string + +# ╔═╡ eb09ab1e-1de9-449c-952f-e71908b7720d +replace(mylongstring, "ring"=>"donut") # replace a substring + +# ╔═╡ de259259-86e5-48e0-9110-975e31b1f57c +md"The output of the following example seems to give an unexpected error. Can you find and fix it?" + +# ╔═╡ e2a7870c-dc5c-45b9-bb0b-8f6f4f679519 +md"If you are familiar with string processing, you might have heard of [regular expressions](https://docs.julialang.org/en/v1/manual/strings/#man-regex-literals), which allow to capture fairly complex string patterns such as telephone numbers or IP addresses. Julia supports RegEx that are as powerful as those of PERL. An exhaustive overview of regular expressions is beyond the scope of this course, but we give a couple of examples." + +# ╔═╡ d6dafbb2-b049-470e-99e6-382a6d9331ba +re = r"\d+" # a regex that matches numbers + +# ╔═╡ b51d1361-51bd-4d55-95d6-2092713ca535 +md"Note the form of `r\"...\"`, which defines a RegEx using Metaprogramming, an advanced topic for tomorrow." + +# ╔═╡ dac56976-1685-49e9-98b7-89a59a90a0b2 +joke = "Why did the number 1 break up with 7? It heard 7 ate 9, but when it asked, 7 claimed it was only 20. Turns out, 7 was really 31!" + +# ╔═╡ 09ea4e54-9fbf-4961-aec9-5cd3e17cf6e9 +match(re, joke) # matches the first occurrence + +# ╔═╡ 4a4045a0-d4c0-4739-8424-9fdb386f2ad1 +matches = eachmatch(re, joke) # matches all occurrences + +# ╔═╡ a5cd90b3-292a-43be-9a42-c3d3620befbe +collect(matches) + +# ╔═╡ 3076c343-a216-4e4a-b97b-4f836c0330d2 +findall(re, joke) # all + +# ╔═╡ 9ff5c3d8-d2e9-4fdf-bb95-084447776e58 +md"You can use round brackets to match patterns:" + +# ╔═╡ c05b74fa-866d-4265-8d62-168fa71c6824 +m = match(r"(\d+)\s*\+\s*(\d+)\s*=\s*(\d+)", " 12 + 17 = 29 ") + +# ╔═╡ 24826e56-5cb0-4fbb-a1fb-c80ea8fbb822 +m[1] + +# ╔═╡ ba9146ba-ecbe-42fb-8d46-f18bf5feaedb +m.captures + # ╔═╡ ebb09172-4c58-11eb-1cc9-91193c57677d -md"## 4. Exercises" +md"## 5. Exercises" # ╔═╡ f441018e-5212-4e7a-b67e-6e28f92be4a2 md""" @@ -638,21 +812,33 @@ end; # ╔═╡ c1e377c4-64a4-11eb-3e7f-b163cb465057 md""" -> **Question 2: Computing the determinant** +> **Question 2: $N$-Rook Problem** -1. Write a function `mydet` to compute the determinant of a 2x2 square matrix. Remember, for a $2 \times 2$ matrix, the determinant is computed as +In chess, rooks are powerful pieces that can move horizontally or vertically across the board. The $N$-Rook problem involves placing $N$ rooks on an $N \times N$ chessboard in such a way that no two rooks share the same row or column. Complete the function `rook_problem` to determine whether a given configuration is valid. + +The function should return `true` if the configuration is valid, indicating that the rooks are positioned without any conflicts, and `false` otherwise. Represent the configuration using a square Boolean matrix where `true` indicates the positions occupied by rooks. -${\displaystyle|A|={\begin{vmatrix}a&b\\c&d\end{vmatrix}}=ad-bc.}$ -2. For larger matrices, there is a recursive way of computing the determinant based on the minors, i.e. the determinants of the submatrices. See [http://mathworld.wolfram.com/Determinant.html](http://mathworld.wolfram.com/Determinant.html). Update `mydet` to compute the determinant of a general square matrix. """ -# ╔═╡ 5619fd6c-4cfe-11eb-1512-e1800b6c7df9 -function mydet(A) - size(A,1) != size(A,2) && throw(DimensionMismatch) +# ╔═╡ 1c357d6f-7ac0-4e4d-82c4-b0c83fb65bbd +function rook_problem(board::Matrix{Bool}) + @assert count(board) == size(board, 1) == size(board, 2) "Wrong number of rooks or not a square board" return missing end +# ╔═╡ 45ea911b-7feb-4c9e-a81b-813cdd9e0e30 +R1 = [true false false; false false true; false true false] + +# ╔═╡ e570ac5f-c2a3-42b9-9f70-6b51a64abf2c +R2 = [true false false false; false false true false; false true false false; false true false false] + +# ╔═╡ 4cccf6fb-ed30-4462-b929-54c88a3280d1 +rook_problem(R1) + +# ╔═╡ 5fa1dc21-ac69-471f-8899-a68b76980a88 +rook_problem(R2) + # ╔═╡ e5293248-64a4-11eb-0d30-53a15bec0d01 md""" > **Question 3: it is pi 'o clock** @@ -678,12 +864,39 @@ end # ╔═╡ 41b19e20-4d0f-11eb-1c3c-572cc5243d99 +# ╔═╡ a5c5910c-1a70-4e70-be5f-08ebe6790c19 +md""" +> **Question 4: Check password** +Complete the function `check_password`, which checks if your suggested password matches the safety guidelines: + +- has a length of at least six characters +- contains at least two letters +- contains at least one lower-case and one upper-case letter +- contains at least one number +- has at least one character that is a neither a letter nor a number, i.e. `!@#$%^&*()_+-=,.?` + +Your function returns `true` if the password matches the requirements and a `false` if not. Optionally, use a print statement to convey the user what is lacking. + +""" + +# ╔═╡ d286cd36-27ea-405f-b54e-e97c2d0bbcba +function check_password(pwd) + + return missing +end + +# ╔═╡ 17d3ba29-d492-4ba4-88ac-4689330d023f +check_password("password") + +# ╔═╡ 204cef98-ce43-42f1-99f4-50c2686767b8 +check_password("Passw0rd!") + # ╔═╡ 04aff640-58bb-11eb-1bb6-69ad9fc32314 -md"## 5. Extra exercises" +md"## 6. Extra exercises" # ╔═╡ 5c8f024f-87a3-444f-8f09-5d179a04a1cb md""" -> **Question 4: Markdown tables** +> **Question 5: Markdown tables** Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. It is also the markup language used in this notebook. Markdown is really easy to learn (see the example below). The problem with markdown is that table generation is a tedious process... Write a small Julia package (read function) that generates a markdown table that takes an array of strings for the header and an n-by-m array of table values. Complete `markdowntable()` below. The function should both return a string of the markdown table and should automatically copies this to the clipboard using the `clipboard()` function. Just for completion, you should end your table with a newline (\n). @@ -720,7 +933,7 @@ end # ╔═╡ 8c5da051-f397-4613-97aa-2d673e03ea7b md""" -> **Question 5: Ridge Regression** +> **Question 6: Ridge Regression** Ridge regression can be seen as an extension of ordinary least squares regression, @@ -787,7 +1000,7 @@ end; # ╔═╡ a0026d1c-bcdb-4a2e-b1a1-11c5235a4956 md"""## Answers -If you would like to take a look at the answers, you can do so by checking the box of the question you would like to see. The function will be shown just below the question you want to look at. +If you want to look at the answers, you can check the box for the questions you want to see. The function will be shown just below the question you want to look at. | Question | Show solution | |-----|:---------:| @@ -796,6 +1009,7 @@ If you would like to take a look at the answers, you can do so by checking the b | Question 3 | $(@bind answ_q3 CheckBox()) | | Question 4 | $(@bind answ_q4 CheckBox()) | | Question 5 | $(@bind answ_q5 CheckBox()) | +| Question 6 | $(@bind answ_q6 CheckBox()) | """ # ╔═╡ 6d43af49-f127-4ffe-ba97-0f04fb792efb @@ -814,9 +1028,9 @@ end if answ_q2 == true md""" ```Julia - function mydet(A) - size(A,1) != size(A,2) && throw(DimensionMismatch) - return A[1,1]*A[2,2]-[1,2]*A[2,1] + function rook_problem(board::Matrix{Bool}) + @assert count(board) == size(board, 1) == size(board, 2) "Wrong number of rooks or not a square board" + return all(==(1), sum(board, dims=1)) && all(==(1), sum(board, dims=2)) end ``` """ @@ -843,8 +1057,25 @@ if answ_q3 == true """ end -# ╔═╡ cf2b6aa4-b0e8-471a-95fc-646bbddb989a +# ╔═╡ df56e757-873b-4115-a030-9dd83e532b7e if answ_q4 == true + md""" + ```Julia + function check_password(pwd) + l = length(pwd) + letters = count(isletter, pwd) + upper = count(isuppercase, pwd) + lower = count(islowercase, pwd) + nums = count(isnumeric, pwd) + nonconv = length(pwd ∩ "!@#\$%^&*()_+-=,.?") + return l ≥ 6 && letters ≥ 2 && upper ≥ 1 && lower ≥ 1 && nums ≥ 1 && nonconv ≥ 1 + end + ``` + """ +end + +# ╔═╡ cf2b6aa4-b0e8-471a-95fc-646bbddb989a +if answ_q5 == true md""" ```Julia function markdowntable(table, header) @@ -865,7 +1096,7 @@ if answ_q4 == true end # ╔═╡ 65a45d44-7942-4808-bed0-0369077c5edb -if answ_q5 == true +if answ_q6 == true md""" ```Julia β₁ = inv(transpose(t)*t + UniformScaling(0.01)) * transpose(t)* Y₁ @@ -878,7 +1109,7 @@ if answ_q5 == true end # ╔═╡ 2e7973b6-4d0f-11eb-107c-cdaf349428c0 -md""" ## 5. References +md""" ## 6. References - [Julia Documentation](https://juliadocs.github.io/Julia-Cheat-Sheet/) - [Introduction to Julia UCI data science initiative](http://ucidatascienceinitiative.github.io/IntroToJulia/) @@ -1006,7 +1237,7 @@ version = "4.5.0" [[CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.0.2+0" [[ComputationalResources]] git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7" @@ -1333,26 +1564,21 @@ version = "0.3.1" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] -uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" - [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -1411,7 +1637,7 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.2+0" [[MetaGraphs]] deps = ["Graphs", "JLD2", "Random"] @@ -1436,7 +1662,7 @@ version = "0.3.4" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2022.10.11" [[NaNMath]] deps = ["OpenLibm_jll"] @@ -1469,7 +1695,7 @@ version = "1.12.8" [[OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.21+4" [[OpenEXR]] deps = ["Colors", "FileIO", "OpenEXR_jll"] @@ -1492,7 +1718,7 @@ version = "2.4.0+0" [[OpenLibm_jll]] deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" -version = "0.8.1+2" +version = "0.8.1+0" [[OpenSpecFun_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] @@ -1532,7 +1758,7 @@ version = "2.5.3" [[Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.9.0" [[PkgVersion]] deps = ["Pkg"] @@ -1579,7 +1805,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["SHA"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[RangeArrays]] @@ -1669,7 +1895,6 @@ version = "1.1.0" [[SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" [[SpecialFunctions]] deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] @@ -1697,7 +1922,7 @@ version = "1.4.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.9.0" [[StatsAPI]] deps = ["LinearAlgebra"] @@ -1712,9 +1937,9 @@ uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" version = "0.33.21" [[SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] @@ -1785,7 +2010,7 @@ version = "0.5.5" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.2.13+0" [[Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1796,7 +2021,7 @@ version = "1.5.2+0" [[libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.7.0+0" [[libpng_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] @@ -1813,12 +2038,12 @@ version = "1.10.3+0" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.4.0+0" """ # ╔═╡ Cell order: @@ -1830,6 +2055,13 @@ version = "17.4.0+2" # ╠═8f8c7b44-4c1d-11eb-0cd8-3bb82c75c086 # ╟─b0420f36-5a71-11eb-01f1-f16b115f5895 # ╠═a0c22de6-4c1d-11eb-34a2-aff57cfd22a1 +# ╟─57386df5-058b-4f50-98b1-2557553fa54c +# ╠═4a7c0935-de06-469e-8eef-88664d5678a5 +# ╠═ca8fb43b-94d3-43b0-a686-1f5380d766b9 +# ╠═c5a6873a-a7c3-4ed5-8e3a-34cece9dc2d2 +# ╠═845df822-2d5b-47ab-ac46-9656d2a68d73 +# ╠═60f0eee2-4f23-4cd4-9fdd-0c69100b9662 +# ╠═17875f73-831a-4e06-8492-e172295da1da # ╟─a81d1f22-4c1d-11eb-1b76-2929f30565bf # ╟─bb79bf28-4c1d-11eb-35bf-379ac0cd16b6 # ╠═eaf59a7e-4c1d-11eb-2db3-fd7f995db3e4 @@ -1893,6 +2125,7 @@ version = "17.4.0+2" # ╠═08e5589e-661f-11eb-262a-dd917f77f56b # ╠═0b9bad58-4c24-11eb-26a8-1d04d7b2be61 # ╠═0b9d0bf8-4c24-11eb-2beb-0763c66e6a20 +# ╠═d02f96c8-4192-4bb5-92e8-1837af89f013 # ╟─b9a9a730-5a73-11eb-0d17-7bf1aa935697 # ╠═d4405d8c-5a73-11eb-21f7-37c4d7ac537b # ╠═da5edf54-5a73-11eb-26ff-2f6af8adceed @@ -1925,6 +2158,11 @@ version = "17.4.0+2" # ╟─28f5c018-4c4b-11eb-3530-8b592f2abeda # ╠═32351fb8-4c4b-11eb-058b-5bb348e8dfb7 # ╟─be557eda-64a3-11eb-1562-35ad48531ebd +# ╠═16951b3e-4748-41d4-b42e-49f230979f39 +# ╠═fd4c9d45-3099-4044-9177-650430b7f5f1 +# ╠═0ee08475-fa03-4e4f-9fcc-7b173387043a +# ╠═61a1d179-783f-46e2-8180-352d1220e35f +# ╟─295b6131-cbc3-45bf-af6a-c823b38eb9ea # ╟─eed4faca-4c1f-11eb-3e6c-b342b48080eb # ╠═fbde6364-4f30-11eb-1ece-712293996c04 # ╠═42254aa6-4f37-11eb-001b-f78d5383e36f @@ -1966,6 +2204,8 @@ version = "17.4.0+2" # ╠═0bec2d28-4c58-11eb-0a51-95bf50bbfd79 # ╠═6aa73154-661f-11eb-2b88-578eb2dd2ec2 # ╟─ae6064e6-64a4-11eb-24b5-0b0b848aa2d6 +# ╠═8fec0796-6084-49c3-a7f8-a00dfd329e2c +# ╠═0704bcce-0e7b-42c6-8aa4-8f8e0922e3b5 # ╟─0fd08728-4c58-11eb-1b71-c9710d398fab # ╟─2c6097f4-4c58-11eb-0807-d5d8cbfbd62c # ╟─9505a4d4-4c58-11eb-1e2e-0d080437fa23 @@ -1983,11 +2223,51 @@ version = "17.4.0+2" # ╠═dd8978a4-5a75-11eb-287e-03e4272b6f2c # ╟─9cecd9a6-4c58-11eb-22dc-33cd2559d815 # ╟─c6d236da-4c58-11eb-2714-3f5c43583a3d +# ╟─e594575b-8faa-4be4-8367-75dd65afc01f # ╠═3253ab74-4c58-11eb-178e-83ea8aba9c8f # ╠═32593936-4c58-11eb-174c-0bb20d93dde5 # ╠═fcfb511c-5a75-11eb-2181-33d147ab1806 # ╠═1882840a-5a76-11eb-3392-81c2915487f5 # ╠═3fc787d6-5a76-11eb-06e9-5378d27ce011 +# ╟─937af866-47db-4aa7-9c42-3e92cb42383c +# ╠═e6c6b353-cc75-4ce4-8055-7a78ea8b3bca +# ╠═f7a97d80-3951-44e6-82dc-4b5714bb145c +# ╠═e5405e7a-e986-4cfb-b338-98ae453b9101 +# ╠═ba650ce6-d4a5-44dd-9ddc-42add99cbac2 +# ╠═ab1dc759-a500-44f5-b182-43dc6811ec11 +# ╠═3a71effa-67d6-4694-8d70-6e22e7672904 +# ╠═e1f2dd8b-4b3c-457b-b880-1def928b4524 +# ╠═3f9d2121-1a98-47e4-96cf-9b32ebdcbd7b +# ╟─580d6c53-1f3b-4044-88ab-8e31781276f6 +# ╠═c71f044c-6807-4fff-9fd9-5590d5fef845 +# ╠═5fb7bbbf-63a7-4bd5-88dc-24f4ac330266 +# ╟─636d20ce-efce-48f2-a7cb-c8db7bb0cc3a +# ╠═3ab46e8a-dbf1-4103-9e1a-8887f375512e +# ╟─f1ac2420-767f-405d-b68e-543f7842e96f +# ╠═ee864877-ffa4-4603-a9d6-b54501abdadf +# ╠═8b5153b5-dcee-401f-9664-bc8eb02f1c8a +# ╟─3f765458-4a6e-40a4-a075-b4e20ee01f80 +# ╠═d7e1c451-664b-445b-a737-075c32239c88 +# ╟─dadda755-621f-4903-be44-d7f954030c98 +# ╠═2000c0e1-f4c0-43ac-97de-7aa6db592c41 +# ╟─187f81ab-8996-45aa-955d-b2ca6b598016 +# ╠═60371e70-2e74-4ec4-9952-348b10f0c545 +# ╠═e1b4260c-231f-4d31-86b4-fead7f780782 +# ╠═10507d4a-08d7-4520-a210-744fd6824ef8 +# ╠═eb09ab1e-1de9-449c-952f-e71908b7720d +# ╟─de259259-86e5-48e0-9110-975e31b1f57c +# ╠═e2a7870c-dc5c-45b9-bb0b-8f6f4f679519 +# ╠═d6dafbb2-b049-470e-99e6-382a6d9331ba +# ╟─b51d1361-51bd-4d55-95d6-2092713ca535 +# ╠═dac56976-1685-49e9-98b7-89a59a90a0b2 +# ╠═09ea4e54-9fbf-4961-aec9-5cd3e17cf6e9 +# ╠═4a4045a0-d4c0-4739-8424-9fdb386f2ad1 +# ╠═a5cd90b3-292a-43be-9a42-c3d3620befbe +# ╠═3076c343-a216-4e4a-b97b-4f836c0330d2 +# ╟─9ff5c3d8-d2e9-4fdf-bb95-084447776e58 +# ╠═c05b74fa-866d-4265-8d62-168fa71c6824 +# ╠═24826e56-5cb0-4fbb-a1fb-c80ea8fbb822 +# ╠═ba9146ba-ecbe-42fb-8d46-f18bf5feaedb # ╟─ebb09172-4c58-11eb-1cc9-91193c57677d # ╟─f441018e-5212-4e7a-b67e-6e28f92be4a2 # ╟─ee9069e2-63a7-11eb-12b9-97ae270506f4 @@ -1997,13 +2277,22 @@ version = "17.4.0+2" # ╠═5f47cdf0-58be-11eb-1bca-a3d0941b9bea # ╟─6d43af49-f127-4ffe-ba97-0f04fb792efb # ╟─c1e377c4-64a4-11eb-3e7f-b163cb465057 -# ╠═5619fd6c-4cfe-11eb-1512-e1800b6c7df9 +# ╠═1c357d6f-7ac0-4e4d-82c4-b0c83fb65bbd +# ╠═45ea911b-7feb-4c9e-a81b-813cdd9e0e30 +# ╠═e570ac5f-c2a3-42b9-9f70-6b51a64abf2c +# ╠═4cccf6fb-ed30-4462-b929-54c88a3280d1 +# ╠═5fa1dc21-ac69-471f-8899-a68b76980a88 # ╟─eae5611f-913c-48e4-bc1b-86d33908ac46 # ╟─e5293248-64a4-11eb-0d30-53a15bec0d01 # ╠═cb20fffe-58cf-11eb-1b65-49699f2d3699 # ╠═cee388d2-58cf-11eb-3b88-971b4b85e957 # ╟─be4c9bbe-0ec1-4477-b422-dcf308cd6f5b # ╟─41b19e20-4d0f-11eb-1c3c-572cc5243d99 +# ╟─a5c5910c-1a70-4e70-be5f-08ebe6790c19 +# ╠═d286cd36-27ea-405f-b54e-e97c2d0bbcba +# ╠═17d3ba29-d492-4ba4-88ac-4689330d023f +# ╠═204cef98-ce43-42f1-99f4-50c2686767b8 +# ╟─df56e757-873b-4115-a030-9dd83e532b7e # ╟─04aff640-58bb-11eb-1bb6-69ad9fc32314 # ╟─5c8f024f-87a3-444f-8f09-5d179a04a1cb # ╠═75d14674-58ba-11eb-3868-172fc00a0eb8 diff --git a/notebooks/day1/03-exercises.jl b/notebooks/day1/03-exercises.jl index 2b32175..dd15622 100644 --- a/notebooks/day1/03-exercises.jl +++ b/notebooks/day1/03-exercises.jl @@ -1445,7 +1445,7 @@ version = "4.5.0" [[CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.0.2+0" [[ComputationalResources]] git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7" @@ -1912,26 +1912,21 @@ version = "0.3.1" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] -uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" - [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -2038,7 +2033,7 @@ version = "1.1.7" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.2+0" [[Measures]] git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" @@ -2068,7 +2063,7 @@ version = "0.3.4" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2022.10.11" [[NaNMath]] deps = ["OpenLibm_jll"] @@ -2107,7 +2102,7 @@ version = "1.3.5+1" [[OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.21+4" [[OpenEXR]] deps = ["Colors", "FileIO", "OpenEXR_jll"] @@ -2130,7 +2125,7 @@ version = "2.4.0+0" [[OpenLibm_jll]] deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" -version = "0.8.1+2" +version = "0.8.1+0" [[OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -2158,7 +2153,7 @@ version = "1.4.1" [[PCRE2_jll]] deps = ["Artifacts", "Libdl"] uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" -version = "10.42.0+1" +version = "10.42.0+0" [[PNGFiles]] deps = ["Base64", "CEnum", "ImageCore", "IndirectArrays", "OffsetArrays", "libpng_jll"] @@ -2198,7 +2193,7 @@ version = "0.40.1+0" [[Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.9.0" [[PkgVersion]] deps = ["Pkg"] @@ -2269,7 +2264,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["SHA"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[RangeArrays]] @@ -2382,7 +2377,6 @@ version = "1.1.0" [[SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" [[SpecialFunctions]] deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] @@ -2410,7 +2404,7 @@ version = "1.4.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.9.0" [[StatsAPI]] deps = ["LinearAlgebra"] @@ -2425,9 +2419,9 @@ uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" version = "0.33.21" [[SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] @@ -2659,7 +2653,7 @@ version = "1.4.0+3" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.2.13+0" [[Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -2688,7 +2682,7 @@ version = "0.15.1+0" [[libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.7.0+0" [[libfdk_aac_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -2717,12 +2711,12 @@ version = "1.3.7+1" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.4.0+0" [[x264_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] diff --git a/notebooks/day2/01-types.jl b/notebooks/day2/01-types.jl index 7db2c09..894941b 100644 --- a/notebooks/day2/01-types.jl +++ b/notebooks/day2/01-types.jl @@ -719,7 +719,7 @@ version = "0.11.4" [[CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.0.2+0" [[Dates]] deps = ["Printf"] @@ -770,26 +770,21 @@ version = "0.21.3" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] -uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" - [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -813,14 +808,14 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.2+0" [[Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2022.10.11" [[NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -829,7 +824,7 @@ version = "1.2.0" [[OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.21+4" [[Parsers]] deps = ["Dates", "SnoopPrecompile"] @@ -840,7 +835,7 @@ version = "2.5.3" [[Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.9.0" [[PlutoUI]] deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] @@ -863,7 +858,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["SHA"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[Reexport]] @@ -890,17 +885,16 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.9.0" [[SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] @@ -936,22 +930,22 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.2.13+0" [[libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.7.0+0" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.4.0+0" """ # ╔═╡ Cell order: diff --git a/notebooks/day2/02-composite_types.jl b/notebooks/day2/02-composite_types.jl index 6662d00..8d3e293 100644 --- a/notebooks/day2/02-composite_types.jl +++ b/notebooks/day2/02-composite_types.jl @@ -152,12 +152,6 @@ end # ╔═╡ e3759d4c-5d90-11eb-0bea-bb4247623ec2 25 ∈ Squares(10) -# ╔═╡ 07998440-5d91-11eb-1a65-8de428eac89c -sum(Squares(18093)) - -# ╔═╡ e11b0b10-6621-11eb-0bdb-f3719cc92a20 -@elapsed sum(Squares(18093)) - # ╔═╡ 192d9fd4-5d91-11eb-1cb9-c706aad03480 Base.eltype(::Type{Squares}) = Int @@ -167,15 +161,6 @@ Base.length(S::Squares) = S.count # ╔═╡ 2270e790-5d91-11eb-20e5-29905f232734 collect(Squares(4)) -# ╔═╡ 49f1d98c-5d91-11eb-1657-f320e9fcdc0e -#Base.sum(S::Squares) = (n = S.count; return n*(n+1)*(2n+1)÷6) - -# ╔═╡ 4cb68744-5d91-11eb-2b3e-e7df55888c93 -sum(Squares(18093)) # much faster now! - -# ╔═╡ e99af5c0-6621-11eb-058b-45c3719930d0 -@elapsed sum(Squares(18093)) - # ╔═╡ e9a99a00-5d91-11eb-2c50-8be452cab83f struct Strang <: AbstractMatrix{Int} n::Int @@ -190,21 +175,9 @@ Base.getindex(S::Strang, i, j) = i==j ? 2 : (abs(i - j) == 1 ? -1 : 0) # ╔═╡ f3c3114c-5d91-11eb-1d37-6d97ea6d267f S = Strang(1000) # holy cow! Looks just like a real matrix! -# ╔═╡ 04dcda58-5d92-11eb-10ba-396947081338 -sum(S) # works, but slow... - -# ╔═╡ fbdb2958-6621-11eb-3cb6-a9bdeea3bdb7 -@elapsed sum(S) - # ╔═╡ 0f878dea-5d92-11eb-0000-b7484532ee70 #Base.sum(S::Strang) = 2 -# ╔═╡ 11630c02-5d92-11eb-1746-4dabf327fbbe -sum(S) - -# ╔═╡ 046ce4f8-6622-11eb-3c4f-7b6bf21fb77b -@elapsed sum(S) - # ╔═╡ 1e65cb9c-5d92-11eb-3526-332169917fd9 v = randn(1000) @@ -312,6 +285,33 @@ end # ╔═╡ a9502b64-5d90-11eb-144c-3d7ce0949e67 Base.iterate(S::Squares, state=1) = state > S.count ? nothing : (state*state, state+1) +# ╔═╡ 49f1d98c-5d91-11eb-1657-f320e9fcdc0e +Base.sum(S::Squares) = (n = S.count; return n*(n+1)*(2n+1)÷6) + +# ╔═╡ 07998440-5d91-11eb-1a65-8de428eac89c +sum(Squares(18093)) + +# ╔═╡ e11b0b10-6621-11eb-0bdb-f3719cc92a20 +@elapsed sum(Squares(18093)) + +# ╔═╡ 4cb68744-5d91-11eb-2b3e-e7df55888c93 +sum(Squares(18093)) # much faster now! + +# ╔═╡ e99af5c0-6621-11eb-058b-45c3719930d0 +@elapsed sum(Squares(18093)) + +# ╔═╡ 04dcda58-5d92-11eb-10ba-396947081338 +sum(S) # works, but slow... + +# ╔═╡ fbdb2958-6621-11eb-3cb6-a9bdeea3bdb7 +@elapsed sum(S) + +# ╔═╡ 11630c02-5d92-11eb-1746-4dabf327fbbe +sum(S) + +# ╔═╡ 046ce4f8-6622-11eb-3c4f-7b6bf21fb77b +@elapsed sum(S) + # ╔═╡ 201f59ee-5d92-11eb-33ae-51904d249dd4 S * v # works, but slow @@ -690,7 +690,7 @@ version = "0.11.4" [[CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.0.2+0" [[Dates]] deps = ["Printf"] @@ -741,26 +741,21 @@ version = "0.21.3" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] -uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" - [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -784,14 +779,14 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.2+0" [[Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2022.10.11" [[NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -800,7 +795,7 @@ version = "1.2.0" [[OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.21+4" [[Parsers]] deps = ["Dates", "SnoopPrecompile"] @@ -811,7 +806,7 @@ version = "2.5.3" [[Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.9.0" [[PlutoUI]] deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] @@ -834,7 +829,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["SHA"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[Reexport]] @@ -861,17 +856,16 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.9.0" [[SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] @@ -907,22 +901,22 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.2.13+0" [[libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.7.0+0" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.4.0+0" """ # ╔═╡ Cell order: diff --git a/notebooks/day2/03-fluky_fields.jl b/notebooks/day2/03-fluky_fields.jl index ca764b0..bf457cd 100644 --- a/notebooks/day2/03-fluky_fields.jl +++ b/notebooks/day2/03-fluky_fields.jl @@ -311,7 +311,7 @@ version = "4.5.0" [[CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+1" +version = "1.0.2+0" [[Contour]] git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781" @@ -554,26 +554,21 @@ version = "0.15.18" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" +version = "7.84.0+0" [[LibGit2]] -deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibGit2_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] -uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" -version = "1.6.4+0" - [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -669,7 +664,7 @@ version = "1.1.7" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+1" +version = "2.28.2+0" [[Measures]] git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" @@ -687,7 +682,7 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2023.1.10" +version = "2022.10.11" [[NaNMath]] deps = ["OpenLibm_jll"] @@ -708,12 +703,12 @@ version = "1.3.5+1" [[OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+2" +version = "0.3.21+4" [[OpenLibm_jll]] deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" -version = "0.8.1+2" +version = "0.8.1+0" [[OpenSSL]] deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] @@ -747,7 +742,7 @@ version = "1.4.1" [[PCRE2_jll]] deps = ["Artifacts", "Libdl"] uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" -version = "10.42.0+1" +version = "10.42.0+0" [[Parsers]] deps = ["Dates", "SnoopPrecompile"] @@ -769,7 +764,7 @@ version = "0.40.1+0" [[Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.10.0" +version = "1.9.0" [[PlotThemes]] deps = ["PlotUtils", "Statistics"] @@ -816,7 +811,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["SHA"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[RecipesBase]] @@ -890,7 +885,6 @@ version = "1.1.0" [[SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -version = "1.10.0" [[SpecialFunctions]] deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] @@ -901,7 +895,7 @@ version = "2.1.7" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.10.0" +version = "1.9.0" [[StatsAPI]] deps = ["LinearAlgebra"] @@ -916,9 +910,9 @@ uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" version = "0.33.21" [[SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "7.2.1+1" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] @@ -1127,7 +1121,7 @@ version = "1.4.0+3" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+1" +version = "1.2.13+0" [[Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1156,7 +1150,7 @@ version = "0.15.1+0" [[libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+1" +version = "5.7.0+0" [[libfdk_aac_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1179,12 +1173,12 @@ version = "1.3.7+1" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+2" +version = "17.4.0+0" [[x264_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]