Skip to content

Commit ebe5aa3

Browse files
committed
update homeworks and add tags
1 parent 20c7184 commit ebe5aa3

File tree

11 files changed

+2768
-3051
lines changed

11 files changed

+2768
-3051
lines changed

src/homework/hw0.jl

Lines changed: 40 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.19.14
2+
# v0.19.25
33

44
using Markdown
55
using InteractiveUtils
@@ -14,44 +14,27 @@ macro bind(def, element)
1414
end
1515
end
1616

17-
# ╔═╡ fafae38e-e852-11ea-1208-732b4744e4c2
18-
md"_Homework 0, version 4 -- Spring 2021_"
19-
20-
# ╔═╡ cdff6730-e785-11ea-2546-4969521b33a7
21-
md"""
22-
23-
Submission by: **_$(student.name)_** ($(student.kerberos_id)@mit.edu)
24-
"""
25-
26-
# ╔═╡ 7308bc54-e6cd-11ea-0eab-83f7535edf25
27-
# edit the code below to set your name and kerberos ID (i.e. email without @mit.edu)
28-
29-
student = (name = "Jazzy Doe", kerberos_id = "jazz")
17+
# ╔═╡ d6ee91ea-e750-11ea-1260-31ebf3ec6a9b
18+
using Compose
3019

31-
# press the ▶ button in the bottom right of this cell to run your edits
32-
# or use Shift+Enter
20+
# ╔═╡ 5acd58e0-e856-11ea-2d3d-8329889fe16f
21+
using PlutoUI
3322

34-
# you might need to wait until all other cells in this notebook have completed running.
35-
# scroll down the page to see what's up
23+
# ╔═╡ fafae38e-e852-11ea-1208-732b4744e4c2
24+
md"_Homework 0, version 4"
3625

3726
# ╔═╡ a2181260-e6cd-11ea-2a69-8d9d31d1ef0e
3827
md"""
3928
# Homework 0: Getting up and running
4029
41-
HW0 release date: Monday, Feb 15, 2021.
42-
43-
**HW0 due date: Thursday, Feb 18, 2021, 11:59pm EST**, _but best completed before Wednesday's lecture if possible_.
44-
4530
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.
4631
47-
We'd like everyone 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 🙂
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 🙂
4833
"""
4934

5035
# ╔═╡ 31a8fbf8-e6ce-11ea-2c66-4b4d02b41995
5136
md"""## Homework Logistics
52-
Homeworks are in the form of [Pluto notebooks](https://github.com/fonsp/Pluto.jl). Your must complete them and submit them on [Canvas](https://canvas.mit.edu/courses/5637) (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.
53-
54-
Homeworks will be released on Thursdays and due on Thursdays 11:59pm Eastern time.
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.
5538
5639
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.
5740
"""
@@ -115,14 +98,6 @@ md"That's all that's required for this week. Please submit the notebook. We just
11598
11699
If you want to explore further, we have included a few optional exercises below."
117100

118-
# ╔═╡ b3c7a050-e855-11ea-3a22-3f514da746a4
119-
if student.kerberos_id === "jazz"
120-
md"""
121-
!!! danger "Oops!"
122-
**Before you submit**, remember to fill in your name and kerberos ID at the top of this notebook!
123-
"""
124-
end
125-
126101
# ╔═╡ 339c2d5c-e6ce-11ea-32f9-714b3628909c
127102
md"## (Optional) Exercise 1 - _Square root by Newton's method_
128103
@@ -231,28 +206,9 @@ md"To draw Sierpinski's triangle, we are going to use an external package, [_Com
231206
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).
232207
"
233208

234-
# ╔═╡ d6ee91ea-e750-11ea-1260-31ebf3ec6a9b
235-
using Compose
236-
237-
# ╔═╡ 5acd58e0-e856-11ea-2d3d-8329889fe16f
238-
using PlutoUI
239-
240209
# ╔═╡ dbc4da6a-e7b4-11ea-3b70-6f2abfcab992
241210
md"Just like the definition above, our `sierpinksi` function is _recursive_: it calls itself."
242211

243-
# ╔═╡ e2848b9a-e703-11ea-24f9-b9131434a84b
244-
function sierpinski(n)
245-
if n == 0
246-
triangle()
247-
else
248-
t = sierpinski(n - 1) # recursively construct a smaller sierpinski's triangle
249-
place_in_3_corners(t) # place it in the 3 corners of a triangle
250-
end
251-
end
252-
253-
# ╔═╡ 9664ac52-e750-11ea-171c-e7d57741a68c
254-
sierpinski(complexity)
255-
256212
# ╔═╡ 02b9c9d6-e752-11ea-0f32-91b7b6481684
257213
complexity = 3
258214

@@ -274,9 +230,6 @@ md"### Exercise 2.1
274230
275231
As you can see, the total area covered by triangles is lower when the complexity is higher."
276232

277-
# ╔═╡ df0a4068-e7b2-11ea-2475-81b237d492b3
278-
sierpinski.(0:6)
279-
280233
# ╔═╡ f22222b4-e7b5-11ea-0ea0-8fa368d2a014
281234
md"""
282235
Can you write a function that computes the _area of `sierpinski(n)`_, as a fraction of the area of `sierpinski(0)`?
@@ -313,17 +266,6 @@ md"**Let's try it out below:**"
313266
# ╔═╡ 52533e00-e856-11ea-08a7-25e556fb1127
314267
md"Complexity = $(@bind n Slider(0:6, show_value=true))"
315268

316-
# ╔═╡ 147ed7b0-e856-11ea-0d0e-7ff0d527e352
317-
md"""
318-
319-
Sierpinski's triangle of complexity $(n)
320-
321-
$(sierpinski(n))
322-
323-
has area **$(area_sierpinski(n))**
324-
325-
"""
326-
327269
# ╔═╡ c1ecad86-e7bc-11ea-1201-23ee380181a1
328270
md"""
329271
!!! hint
@@ -351,6 +293,33 @@ function place_in_3_corners(t)
351293
(context(1 / 2, 1 / 2, 1 / 2, 1 / 2), t))
352294
end
353295

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+
354323
# ╔═╡ 00000000-0000-0000-0000-000000000001
355324
PLUTO_PROJECT_TOML_CONTENTS = """
356325
[deps]
@@ -366,9 +335,9 @@ PlutoUI = "~0.7.48"
366335
PLUTO_MANIFEST_TOML_CONTENTS = """
367336
# This file is machine-generated - editing it directly is not advised
368337
369-
julia_version = "1.8.0"
338+
julia_version = "1.8.5"
370339
manifest_format = "2.0"
371-
project_hash = "692dd8da3638d93c0a5b632ae68d0a454177fe73"
340+
project_hash = "580cb1b14c95df0d6df5dd9cf2103a0db1c2a919"
372341
373342
[[deps.AbstractPlutoDingetjes]]
374343
deps = ["Pkg"]
@@ -407,7 +376,7 @@ version = "4.3.0"
407376
[[deps.CompilerSupportLibraries_jll]]
408377
deps = ["Artifacts", "Libdl"]
409378
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
410-
version = "0.5.2+0"
379+
version = "1.0.1+0"
411380
412381
[[deps.Compose]]
413382
deps = ["Base64", "Colors", "DataStructures", "Dates", "IterTools", "JSON", "LinearAlgebra", "Measures", "Printf", "Random", "Requires", "Statistics", "UUIDs"]
@@ -607,7 +576,7 @@ version = "1.0.0"
607576
[[deps.Tar]]
608577
deps = ["ArgTools", "SHA"]
609578
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
610-
version = "1.10.0"
579+
version = "1.10.1"
611580
612581
[[deps.Test]]
613582
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
@@ -653,8 +622,6 @@ version = "17.4.0+0"
653622

654623
# ╔═╡ Cell order:
655624
# ╟─fafae38e-e852-11ea-1208-732b4744e4c2
656-
# ╟─cdff6730-e785-11ea-2546-4969521b33a7
657-
# ╠═7308bc54-e6cd-11ea-0eab-83f7535edf25
658625
# ╟─a2181260-e6cd-11ea-2a69-8d9d31d1ef0e
659626
# ╟─31a8fbf8-e6ce-11ea-2c66-4b4d02b41995
660627
# ╟─f9d7250a-706f-11eb-104d-3f07c59f7174
@@ -663,7 +630,6 @@ version = "17.4.0+0"
663630
# ╠═e02f7ea6-7024-11eb-3672-fd59a6cff79b
664631
# ╟─6acef56c-7025-11eb-2524-819c30a75d39
665632
# ╟─348cea34-7025-11eb-3def-41bbc16c7512
666-
# ╟─b3c7a050-e855-11ea-3a22-3f514da746a4
667633
# ╟─339c2d5c-e6ce-11ea-32f9-714b3628909c
668634
# ╟─56866718-e6ce-11ea-0804-d108af4e5653
669635
# ╠═bccf0e88-e754-11ea-3ab8-0170c2d44628

0 commit comments

Comments
 (0)