We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 856f170 commit c101e4bCopy full SHA for c101e4b
lectures/monte_carlo.md
@@ -584,14 +584,20 @@ compute_call_price()
584
585
## ExerciseS
586
587
+```{exercise}
588
+:label: monte_carlo_ex1
589
+
590
We would like to increase $M$ in the code above to make the calculation more
591
accurate.
592
593
But this is problematic because Python loops are slow.
594
595
Your task is to write a faster version of this code using NumPy.
596
+```
597
-
598
+```{solution-start} monte_carlo_ex1
599
+:class: dropdown
600
601
602
```{code-cell} ipython3
603
def compute_call_price(β=β,
@@ -628,3 +634,6 @@ Now let's try with larger $M$ to get a more accurate calculation.
628
634
%%time
629
635
compute_call_price(M=10_000_000)
630
636
```
637
638
+```{solution-end}
639
0 commit comments