You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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
33
22
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"
36
25
37
26
# ╔═╡ a2181260-e6cd-11ea-2a69-8d9d31d1ef0e
38
27
md"""
39
28
# Homework 0: Getting up and running
40
29
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
-
45
30
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.
46
31
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 🙂
48
33
"""
49
34
50
35
# ╔═╡ 31a8fbf8-e6ce-11ea-2c66-4b4d02b41995
51
36
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.
55
38
56
39
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.
57
40
"""
@@ -115,14 +98,6 @@ md"That's all that's required for this week. Please submit the notebook. We just
115
98
116
99
If you want to explore further, we have included a few optional exercises below."
117
100
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
-
126
101
# ╔═╡ 339c2d5c-e6ce-11ea-32f9-714b3628909c
127
102
md"## (Optional) Exercise 1 - _Square root by Newton's method_
128
103
@@ -231,28 +206,9 @@ md"To draw Sierpinski's triangle, we are going to use an external package, [_Com
231
206
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).
232
207
"
233
208
234
-
# ╔═╡ d6ee91ea-e750-11ea-1260-31ebf3ec6a9b
235
-
using Compose
236
-
237
-
# ╔═╡ 5acd58e0-e856-11ea-2d3d-8329889fe16f
238
-
using PlutoUI
239
-
240
209
# ╔═╡ dbc4da6a-e7b4-11ea-3b70-6f2abfcab992
241
210
md"Just like the definition above, our `sierpinksi` function is _recursive_: it calls itself."
242
211
243
-
# ╔═╡ e2848b9a-e703-11ea-24f9-b9131434a84b
244
-
functionsierpinski(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
-
256
212
# ╔═╡ 02b9c9d6-e752-11ea-0f32-91b7b6481684
257
213
complexity =3
258
214
@@ -274,9 +230,6 @@ md"### Exercise 2.1
274
230
275
231
As you can see, the total area covered by triangles is lower when the complexity is higher."
276
232
277
-
# ╔═╡ df0a4068-e7b2-11ea-2475-81b237d492b3
278
-
sierpinski.(0:6)
279
-
280
233
# ╔═╡ f22222b4-e7b5-11ea-0ea0-8fa368d2a014
281
234
md"""
282
235
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:**"
313
266
# ╔═╡ 52533e00-e856-11ea-08a7-25e556fb1127
314
267
md"Complexity = $(@bind n Slider(0:6, show_value=true))"
315
268
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
-
327
269
# ╔═╡ c1ecad86-e7bc-11ea-1201-23ee380181a1
328
270
md"""
329
271
!!! hint
@@ -351,6 +293,33 @@ function place_in_3_corners(t)
351
293
(context(1/2, 1/2, 1/2, 1/2), t))
352
294
end
353
295
296
+
# ╔═╡ e2848b9a-e703-11ea-24f9-b9131434a84b
297
+
functionsierpinski(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
+
354
323
# ╔═╡ 00000000-0000-0000-0000-000000000001
355
324
PLUTO_PROJECT_TOML_CONTENTS ="""
356
325
[deps]
@@ -366,9 +335,9 @@ PlutoUI = "~0.7.48"
366
335
PLUTO_MANIFEST_TOML_CONTENTS ="""
367
336
# This file is machine-generated - editing it directly is not advised
0 commit comments