@@ -521,13 +521,11 @@ Use a `for` loop to step through the $\alpha$ values.
|
521 | 521 | |
522 | 522 | If you can, add a legend, to help distinguish between the three time series. |
523 | 523 | |
524 | | -Hints: |
| 524 | +```{hint} |
| 525 | +:class: dropdown |
525 | 526 | |
526 | 527 | * If you call the `plot()` function multiple times before calling `show()`, all of the lines you produce will end up on the same figure. |
527 | 528 | * For the legend, noted that if `var = 42`, the expression `f'foo{var}'` evaluates to `'foo42'`. |
528 | | - |
529 | | - Note: `f'foo{var}'` is an example of [f-String](https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings), which allows you to use `{}` to contain an expression. The contained expression will be evaluated, and the result will be placed into the string. |
530 | | - |
531 | 529 | ``` |
532 | 530 | |
533 | 531 | ```{exercise-end} |
@@ -553,6 +551,12 @@ plt.legend()
|
553 | 551 | plt.show() |
554 | 552 | ``` |
555 | 553 | |
| 554 | +```{note} |
| 555 | +`f'$\\alpha = {α}$'` in the solution is an application of [f-String](https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings), which allows you to use `{}` to contain an expression. |
| 556 | + |
| 557 | +The contained expression will be evaluated, and the result will be placed into the string. |
| 558 | +``` |
| 559 | + |
556 | 560 | ```{solution-end} |
557 | 561 | ``` |
558 | 562 | |
@@ -690,11 +694,15 @@ Use no imports besides
|
690 | 694 | import numpy as np |
691 | 695 | ``` |
692 | 696 | |
| 697 | +```{hint} |
| 698 | +:class: dropdown |
| 699 | + |
693 | 700 | Your hints are as follows: |
694 | 701 | |
695 | 702 | * If $U$ is a bivariate uniform random variable on the unit square $(0, 1)^2$, then the probability that $U$ lies in a subset $B$ of $(0,1)^2$ is equal to the area of $B$. |
696 | 703 | * If $U_1,\ldots,U_n$ are IID copies of $U$, then, as $n$ gets large, the fraction that falls in $B$, converges to the probability of landing in $B$. |
697 | 704 | * For a circle, $area = \pi * radius^2$. |
| 705 | +``` |
698 | 706 | |
699 | 707 | ```{exercise-end} |
700 | 708 | ``` |
|