From 71757a103ad3c4fa10029bcbfc2c4db0e24f116a Mon Sep 17 00:00:00 2001
From: Kwangjin Lee <k.lee-5@student.tudelft.nl>
Date: Wed, 2 Oct 2024 15:34:36 +0200
Subject: [PATCH 01/11] change pipeline and test

---
 .gitlab-ci.yml | 10 +++++-----
 book/intro.md  |  2 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2b978b40..cccaaae4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,7 @@ build-book:
   stage: build
   script:
     - |
-      if [ "$CI_COMMIT_BRANCH" == "publish" ]; then
+      if [ "$CI_COMMIT_BRANCH" == "release" ]; then
         echo "Building production version"
         teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
       else
@@ -40,8 +40,8 @@ build-book:
       - build_job_id.txt
     expire_in: 1 week
   rules:
-    - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish"
-    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
+    - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "release"
+    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "release"
       when: always
 
 deploy-draft:
@@ -69,9 +69,9 @@ deploy-production:
       curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \
       -H "Content-Type: application/json" \
       -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \
-      -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"publish\"},\"build_job_id\":$BUILD_JOB_ID}"
+      -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"release\"},\"build_job_id\":$BUILD_JOB_ID}"
   environment:
     name: production
     url: https://mude.citg.tudelft.nl/2024/book
   rules:
-    - if: $CI_COMMIT_BRANCH == "publish"
\ No newline at end of file
+    - if: $CI_COMMIT_BRANCH == "release"
\ No newline at end of file
diff --git a/book/intro.md b/book/intro.md
index e6c58b16..cef35f22 100644
--- a/book/intro.md
+++ b/book/intro.md
@@ -2,6 +2,8 @@
 
 Welcome to the MUDE textbook for the 2024-25 academic year. This is where assigned reading is located, along with interactive exercises to practice and study the module material.
 
+test text
+
 ````{admonition} Interactive Pages---Use Python in your Browser!
     
 This online textbook has a number of pages that are set up to be used interactively. You can use the "Live Code" button under the Rocket Ship icon in the top right to activate the interactive features and use Python interactively!
-- 
GitLab


From c5ca8cbec1e7516d16e4b6a24e71ba358962a4de Mon Sep 17 00:00:00 2001
From: Kwangjin Lee <k.lee-5@student.tudelft.nl>
Date: Wed, 2 Oct 2024 15:38:08 +0200
Subject: [PATCH 02/11] Update file intro.md

---
 book/intro.md | 2 --
 1 file changed, 2 deletions(-)

diff --git a/book/intro.md b/book/intro.md
index cef35f22..e6c58b16 100644
--- a/book/intro.md
+++ b/book/intro.md
@@ -2,8 +2,6 @@
 
 Welcome to the MUDE textbook for the 2024-25 academic year. This is where assigned reading is located, along with interactive exercises to practice and study the module material.
 
-test text
-
 ````{admonition} Interactive Pages---Use Python in your Browser!
     
 This online textbook has a number of pages that are set up to be used interactively. You can use the "Live Code" button under the Rocket Ship icon in the top right to activate the interactive features and use Python interactively!
-- 
GitLab


From feb60b78c9841af9fd40fd5aca11c7a1ee17a6b5 Mon Sep 17 00:00:00 2001
From: Tom van Woudenberg <t.r.vanwoudenberg@tudelft.nl>
Date: Tue, 8 Oct 2024 17:04:56 +0200
Subject: [PATCH 03/11] Update 9-starting_with_PDEs.ipynb

---
 book/numerical_methods/9-starting_with_PDEs.ipynb | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/book/numerical_methods/9-starting_with_PDEs.ipynb b/book/numerical_methods/9-starting_with_PDEs.ipynb
index d1113024..1782c909 100644
--- a/book/numerical_methods/9-starting_with_PDEs.ipynb
+++ b/book/numerical_methods/9-starting_with_PDEs.ipynb
@@ -179,12 +179,6 @@
     "\n",
     "\n"
    ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "80e42708",
-   "metadata": {},
-   "source": []
   }
  ],
  "metadata": {
-- 
GitLab


From 97e6fa5292d21703900e1a22fec96ae2b3ffc19f Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Fri, 11 Oct 2024 14:49:24 +0200
Subject: [PATCH 04/11] probability

---
 book/_toc.yml | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/book/_toc.yml b/book/_toc.yml
index 323ffaa5..0c903256 100644
--- a/book/_toc.yml
+++ b/book/_toc.yml
@@ -68,29 +68,29 @@ parts:
       - file: numerical_methods/8-boundary-value-problem.ipynb
       - file: numerical_methods/9-starting_with_PDEs.ipynb
 
-#     - file: probability/Reminder_intro.md
-#       title: Continuous Distributions
-#       sections:
-#       - file: probability/PDF_CDF
-#       - file: probability/empirical
-#       - file: probability/Param_distr.md
-#         title: Parametric distributions
-#         sections: 
-#         - file: probability/Gaussian.md
-#         - file: probability/other_distr.md
-#         - file: probability/Uniform.md
-#         - file: probability/Exponential.md
-#         - file: probability/Gumbel.md
-#         - file: probability/Lognormal.md
-#         - file: probability/summary.md
-#       - file: probability/fitting.md
-#         title: Fitting parametric distributions
-#         sections: 
-#         - file: probability/moments.md
-#         - file: probability/MLE_1.ipynb
-#         - file: probability/GOF
-#       - file: probability/Loc-scale.ipynb
-#     - file: rr/prob-design/overview
+    - file: probability/Reminder_intro.md
+      title: Continuous Distributions
+      sections:
+      - file: probability/PDF_CDF
+      - file: probability/empirical
+      - file: probability/Param_distr.md
+        title: Parametric distributions
+        sections: 
+        - file: probability/Gaussian.md
+        - file: probability/other_distr.md
+        - file: probability/Uniform.md
+        - file: probability/Exponential.md
+        - file: probability/Gumbel.md
+        - file: probability/Lognormal.md
+        - file: probability/summary.md
+      - file: probability/fitting.md
+        title: Fitting parametric distributions
+        sections: 
+        - file: probability/moments.md
+        - file: probability/MLE_1.ipynb
+        - file: probability/GOF
+      - file: probability/Loc-scale.ipynb
+    # - file: rr/prob-design/overview
 #       title: Risk and Reliability Intro
 #       sections:
 #       - file: rr/prob-design/one-random-variable
-- 
GitLab


From 791df76b437e8e8ed421e1a92c3ff0bc3ce4fd7b Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Fri, 11 Oct 2024 15:27:54 +0200
Subject: [PATCH 05/11] move classes files to learn-programming from
 learn-python

---
 book/external/learn-programming | 2 +-
 book/external/learn-python      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/book/external/learn-programming b/book/external/learn-programming
index d44691b9..13f9b4e5 160000
--- a/book/external/learn-programming
+++ b/book/external/learn-programming
@@ -1 +1 @@
-Subproject commit d44691b9b3e567fa23ea28062f8bee3af9a4cfd2
+Subproject commit 13f9b4e5f9f0d170770998ad5e4299d1836b1bfa
diff --git a/book/external/learn-python b/book/external/learn-python
index 9edbcc9b..f7d0e4a0 160000
--- a/book/external/learn-python
+++ b/book/external/learn-python
@@ -1 +1 @@
-Subproject commit 9edbcc9bb17dac02a3616bd63c704f10406e603d
+Subproject commit f7d0e4a0e824db9eb0acb8331761dbece01f0bfe
-- 
GitLab


From 6bd325b7e807ec5447a653980e2b8b0da611a68f Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Fri, 11 Oct 2024 15:30:55 +0200
Subject: [PATCH 06/11] add week 7 programming draft

---
 book/_toc.yml                | 6 +++++-
 book/programming/week_1_7.md | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 book/programming/week_1_7.md

diff --git a/book/_toc.yml b/book/_toc.yml
index 0c903256..16d46466 100644
--- a/book/_toc.yml
+++ b/book/_toc.yml
@@ -442,7 +442,11 @@ parts:
       - file: external/learn-python/book/08/handling_errors.ipynb
         title: Handling Errors
       - file: external/learn-python/book/08/asserts.ipynb
-    
+    - file: programming/week_1_7
+      sections:
+      - file: external/learn-programming/book/year2/classes
+      - file: external/learn-programming/book/year2/classes_solution
+
   - caption: Fundamental Concepts
     numbered: 2
     chapters: 
diff --git a/book/programming/week_1_7.md b/book/programming/week_1_7.md
new file mode 100644
index 00000000..b014ddc2
--- /dev/null
+++ b/book/programming/week_1_7.md
@@ -0,0 +1,3 @@
+# Week 1.7: Object-Oriented Programming (Lite!)
+
+OOP.
\ No newline at end of file
-- 
GitLab


From d2e32ea9cba814ac684b15b8a7b40eeac01bc7a7 Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Fri, 11 Oct 2024 16:05:52 +0200
Subject: [PATCH 07/11] update oop

---
 book/_toc.yml                   |  4 ++--
 book/external/learn-programming |  2 +-
 book/external/learn-python      |  2 +-
 book/programming/week_1_7.md    | 15 +++++++++++++--
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/book/_toc.yml b/book/_toc.yml
index 16d46466..86df5f5a 100644
--- a/book/_toc.yml
+++ b/book/_toc.yml
@@ -444,8 +444,8 @@ parts:
       - file: external/learn-python/book/08/asserts.ipynb
     - file: programming/week_1_7
       sections:
-      - file: external/learn-programming/book/year2/classes
-      - file: external/learn-programming/book/year2/classes_solution
+      - file: external/learn-programming/book/python/oop/classes
+
 
   - caption: Fundamental Concepts
     numbered: 2
diff --git a/book/external/learn-programming b/book/external/learn-programming
index 13f9b4e5..51c13be8 160000
--- a/book/external/learn-programming
+++ b/book/external/learn-programming
@@ -1 +1 @@
-Subproject commit 13f9b4e5f9f0d170770998ad5e4299d1836b1bfa
+Subproject commit 51c13be80615efbb4ab9a46a7cfe15cbd245cd3b
diff --git a/book/external/learn-python b/book/external/learn-python
index f7d0e4a0..f4c10f32 160000
--- a/book/external/learn-python
+++ b/book/external/learn-python
@@ -1 +1 @@
-Subproject commit f7d0e4a0e824db9eb0acb8331761dbece01f0bfe
+Subproject commit f4c10f32e1e161d93b6018b387a85c3294055f87
diff --git a/book/programming/week_1_7.md b/book/programming/week_1_7.md
index b014ddc2..6ba8fdef 100644
--- a/book/programming/week_1_7.md
+++ b/book/programming/week_1_7.md
@@ -1,3 +1,14 @@
-# Week 1.7: Object-Oriented Programming (Lite!)
+# Week 1.7: OOP
 
-OOP.
\ No newline at end of file
+This chapter contains a lot of information that is useful for improving your programming skills, however you are not required to learn all of it, and not required to memorize everything for the exam.
+
+You should be able to understand the fundamental concepts of classes and object-oriented programming (OOP) in Python as well as the key principles of encapsulation, inheritance, and polymorphism in OOP, which will enable you to better understand and use the classes that are everywhere in Python packages. For example, the class `rv_continuous` in `scipy.stats`, which is used for defining probability distributions, are used heavily in MUDE!
+
+One way to check if you understand this material sufficiently: by the end of Week 1.7 you should realize why OOP is so useful for the continuous parametric distributions we use. For example, recognizing that all distributions can be defined and used in the same way. For example:
+- methods like `.pdf()` and `.cdf()` can be used predictably
+- you can easily define distributions in terms of parameters or moments
+- fitting distributions is also straightforward
+
+For non-probability topics, this will help you recognize why objects in Python packages like Numpy have syntax like `object.mean()` or `object.shape`.
+
+We hope you enjoy this eye-opening experience!
-- 
GitLab


From 2c00004c0bd87a2c5bf4275eebf5647375853052 Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Sat, 12 Oct 2024 16:38:35 +0200
Subject: [PATCH 08/11] include fix from programming book

---
 book/external/learn-programming | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/book/external/learn-programming b/book/external/learn-programming
index 51c13be8..1e53d4f5 160000
--- a/book/external/learn-programming
+++ b/book/external/learn-programming
@@ -1 +1 @@
-Subproject commit 51c13be80615efbb4ab9a46a7cfe15cbd245cd3b
+Subproject commit 1e53d4f545797d14fd57f8ef28fec4bcc2fb14ea
-- 
GitLab


From 3f44f8620bf4418b54241cbdd4c230acb1b3e972 Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Sat, 12 Oct 2024 16:40:04 +0200
Subject: [PATCH 09/11] include fix from programming book

---
 book/external/learn-programming | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/book/external/learn-programming b/book/external/learn-programming
index 51c13be8..1e53d4f5 160000
--- a/book/external/learn-programming
+++ b/book/external/learn-programming
@@ -1 +1 @@
-Subproject commit 51c13be80615efbb4ab9a46a7cfe15cbd245cd3b
+Subproject commit 1e53d4f545797d14fd57f8ef28fec4bcc2fb14ea
-- 
GitLab


From 5ca787eee9a1391a9a4d4be09586765444b42075 Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Mon, 14 Oct 2024 05:20:56 +0200
Subject: [PATCH 10/11] rename and restructure

---
 book/_toc.yml                                 |  11 +++++----
 book/multivariate/Introduction.md             |  18 --------------
 book/multivariate/{AND_OR.md => events.md}    |   4 +--
 .../{events.png => figures/venn-events.png}   | Bin
 .../venn-intersection.png}                    | Bin
 .../{Multi_gaussian.md => gaussian.md}        |   0
 .../{Other_multi.md => nongaussian.md}        |   0
 book/multivariate/overview.md                 |  23 ++++++++++++++++++
 book/multivariate/variables.md                |   0
 9 files changed, 31 insertions(+), 25 deletions(-)
 delete mode 100644 book/multivariate/Introduction.md
 rename book/multivariate/{AND_OR.md => events.md} (97%)
 rename book/multivariate/{events.png => figures/venn-events.png} (100%)
 rename book/multivariate/{intersection.png => figures/venn-intersection.png} (100%)
 rename book/multivariate/{Multi_gaussian.md => gaussian.md} (100%)
 rename book/multivariate/{Other_multi.md => nongaussian.md} (100%)
 create mode 100644 book/multivariate/overview.md
 create mode 100644 book/multivariate/variables.md

diff --git a/book/_toc.yml b/book/_toc.yml
index 984516ba..b9aa1f2e 100644
--- a/book/_toc.yml
+++ b/book/_toc.yml
@@ -91,12 +91,13 @@ parts:
         - file: probability/GOF
       - file: probability/Loc-scale.ipynb
 
-    - file: multivariate/Introduction
-      title: Multivariate distributions
+    - file: multivariate/overview
+      title: Multivariate Distributions
       sections:
-      - file: multivariate/AND_OR.md
-      - file: multivariate/Multi_gaussian.md
-      - file: multivariate/Other_multi.md
+      - file: multivariate/events
+      - file: multivariate/variables
+      - file: multivariate/gaussian
+      - file: multivariate/nongaussian
 
 #   - caption: Q2 Topics
 #     numbered: 2
diff --git a/book/multivariate/Introduction.md b/book/multivariate/Introduction.md
deleted file mode 100644
index ac174127..00000000
--- a/book/multivariate/Introduction.md
+++ /dev/null
@@ -1,18 +0,0 @@
-
-# Multivariate continuous distributions
-
-Challenges in Civil engineering and Geosciences involve working in data scarce scenarios (epistemic uncertainty) with natural phenomena of stochastic nature (aleatoric uncertainty). Univariate continuous distributions assists us in modelling the uncertainty of a variable to later include that uncertainty in the decision-making process or risk analysis, between others. However, these problems are typically complex and, usually, they involve more than one variable. For instance, when assessing the algae bloom in a water body different variables need to be considered, such as the amount of nutrients in the water (nitrogen and phosphorus), the dissolved oxigen in the water or the temperature of the water body. Sometimes (although not frequently) these variables are not related to each other, so we can consider them independent. However, frequently, these variables are generated by the same drivers and, thus, they are dependent to each other. For intance, the algae bloom is influenced by the temperature and availability of nutrients, but also the availability of nutrients can be influenced by the temperature of water. Therefore, there can be a relationship between those variables that we need to consider in an accurate analysis. There is where multivariate probability distributions are helpful as they allow us to model the distribution of not only one variable but several at the same time thus accounting for their dependence.
-
-## Revisiting correlation
-
-Probabilistic dependence between random variables is usually quantified through correlation coefficients. Previous, you have already been introduced to the concept of [correlation](correl) and Pearson correlation coefficient, which is given by
-
-$$ 
-\rho(X_1,X_2)=\frac{Cov(X_1,X_2)}{\sigma_{X_1} \sigma_{X_2}} 
-$$ 
-
-where $X_1$ and $X_2$ are two random variables, $Cov(X_1,X_2)$ is their covariance, and $\sigma_{X_1}$ and $\sigma_{X_2}$ are the standard deviations of $X_1$ and $X_2$. $-1 \leq \rho(X_1,X_2) \leq 1$, being $\rho(X_1,X_2)=-1$ a perfect negative linear correlation, and $\rho(X_1,X_2)=1$ a perfect positive linear correlation. If $\rho(X_1,X_2) \to 0$, we say that $X_1$ and $X_2$ are independent[^note]. This is, that having information about $X_1$ does not provide us with information about $X_2$. The interactive element below allows you to play around with the correlation value yourself. Observe how the distribution's density contours, or the scattered data, changes when you adapt the correlation value.
-
-<iframe src="../_static/elements/element_correlation.html" width="600" height="400" frameborder="0"></iframe>
-
-[^note]: That is an intuituve definition of independence. For a more formal definition of independence, visit the next page of the chapter.
\ No newline at end of file
diff --git a/book/multivariate/AND_OR.md b/book/multivariate/events.md
similarity index 97%
rename from book/multivariate/AND_OR.md
rename to book/multivariate/events.md
index efc44462..f3ff9d7e 100644
--- a/book/multivariate/AND_OR.md
+++ b/book/multivariate/events.md
@@ -10,7 +10,7 @@ If you also need further practice or to revisit other concepts such as mutually
 Let's move back to discrete events to explain what AND and OR probabilities are. Imagine two events, A and B. These can be, for instance, the fact that it rains today (A) and the fact that the temperature is below 10 degrees (B). Each of these events will have a probability of ocurring, denoted here as $P(A)$ and $P(B)$, respectively.
 
 
-```{figure} ../events.png
+```{figure} ../venn-events.png
 
 ---
 
@@ -20,7 +20,7 @@ Venn diagram of the events A and B.
 
 The AND probility or intersection of the events A and B, $P(A \cap B)$, is defined as the probability that both events happen at the same time and, thus, it would be represented in our diagram as shown in the figure below.
 
-```{figure} ../intersection.png
+```{figure} ../venn-intersection.png
 
 ---
 
diff --git a/book/multivariate/events.png b/book/multivariate/figures/venn-events.png
similarity index 100%
rename from book/multivariate/events.png
rename to book/multivariate/figures/venn-events.png
diff --git a/book/multivariate/intersection.png b/book/multivariate/figures/venn-intersection.png
similarity index 100%
rename from book/multivariate/intersection.png
rename to book/multivariate/figures/venn-intersection.png
diff --git a/book/multivariate/Multi_gaussian.md b/book/multivariate/gaussian.md
similarity index 100%
rename from book/multivariate/Multi_gaussian.md
rename to book/multivariate/gaussian.md
diff --git a/book/multivariate/Other_multi.md b/book/multivariate/nongaussian.md
similarity index 100%
rename from book/multivariate/Other_multi.md
rename to book/multivariate/nongaussian.md
diff --git a/book/multivariate/overview.md b/book/multivariate/overview.md
new file mode 100644
index 00000000..ae021a24
--- /dev/null
+++ b/book/multivariate/overview.md
@@ -0,0 +1,23 @@
+
+(mulitivar)=
+# Multivariate Distributions
+
+Challenges in all branches of science and engineering involve working in situations where uncertainty plays a significant role: prior chapters of this book focused a lot on _error_, but often we must also deal with data scarce scenarios (often categorized as _epistemic_ uncertainty) and natural phenomena with a significant _stochastic_ nature (often categorized as _aleatoric_ uncertainty). As seen in the previous chapter, univariate continuous distributions can assist us in modelling uncertainty associated with a specific variable in order to quantitatively account for uncertainty in general; the distribution helps inform the decision-making process or risk analysis. However, our problems of interest are typically complex and usually involve more than one variable: a _multivariate_ situation.
+
+Consider, for example, when assessing algae blooms in a water body (e.g., a freshwater lake), different variables must be be considered, such as nutrients in the water (nitrogen and phosphorus) and their concentration, dissolved oxygen and temperature of the water body. Sometimes (although not frequently), these variables are not related to each other, so we can consider them _independent._ For example, the amount of nitrogen and phosphorous that reaches the lake may not be related to the water temperature of the lake. However, truly _independent_ situations rarely occur in reality, and the variables are _dependent_ on each other. For example, the concentration of nitrogen and phosphorous changes with time and the reaction rates are dependent on the temperature of the water; thus if you are interested in these quantities over time, temperature is certainly a _dependent variable_ of interest.
+
+Although dependent relationships can often be quantified using deterministic relationships (e.g., mechanistic or phenomenological models), probability distributions are also capable of capturing this behavior. This is where _multivariate probability distributions_ are helpful, as they allow us to model the distribution of not only one variable but several at the same time, thus accounting for their dependence.
+
+**Revisiting correlation**
+
+Probabilistic dependence between random variables is usually quantified through correlation coefficients. Previous, you have already been introduced to the concept of [correlation](correl) and Pearson correlation coefficient, which is given by
+
+$$ 
+\rho(X_1,X_2)=\frac{Cov(X_1,X_2)}{\sigma_{X_1} \sigma_{X_2}} 
+$$ 
+
+where $X_1$ and $X_2$ are random variables, $Cov(X_1,X_2)$ is their covariance, and $\sigma_{X_1}$ and $\sigma_{X_2}$ are the standard deviations of $X_1$ and $X_2$. $-1 \leq \rho(X_1,X_2) \leq 1$, being $\rho(X_1,X_2)=-1$ a perfect negative linear correlation, and $\rho(X_1,X_2)=1$ a perfect positive linear correlation. If $\rho(X_1,X_2) \to 0$, we say that $X_1$ and $X_2$ are independent[^note]. This is, that having information about $X_1$ does not provide us with information about $X_2$. The interactive element below allows you to play around with the correlation value yourself. Observe how the distribution's density contours, or the scattered data, changes when you adapt the correlation value.
+
+<iframe src="../_static/elements/element_correlation.html" width="600" height="400" frameborder="0"></iframe>
+
+[^note]: That is an intuitive definition of independence. For a more formal definition of independence, visit the next page of the chapter.
\ No newline at end of file
diff --git a/book/multivariate/variables.md b/book/multivariate/variables.md
new file mode 100644
index 00000000..e69de29b
-- 
GitLab


From 0e3a1ec8f15cf5ffb360cfbbfbd1c246ee6f64b3 Mon Sep 17 00:00:00 2001
From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl>
Date: Mon, 14 Oct 2024 07:42:27 +0200
Subject: [PATCH 11/11] more stuff

---
 book/_toc.yml                  | 12 ++++++
 book/multivariate/events.md    | 67 +++++++++++++++++++++++-----------
 book/multivariate/functions.md | 10 +++++
 book/multivariate/gaussian.md  |  4 +-
 book/multivariate/overview.md  | 18 ++++++++-
 book/multivariate/variables.md | 38 +++++++++++++++++++
 6 files changed, 126 insertions(+), 23 deletions(-)
 create mode 100644 book/multivariate/functions.md

diff --git a/book/_toc.yml b/book/_toc.yml
index b9aa1f2e..22dfef3c 100644
--- a/book/_toc.yml
+++ b/book/_toc.yml
@@ -95,9 +95,21 @@ parts:
       title: Multivariate Distributions
       sections:
       - file: multivariate/events
+        title: Dependent Events
       - file: multivariate/variables
+        title: Continuous Variables
       - file: multivariate/gaussian
+        title: Multivariate Gaussian
       - file: multivariate/nongaussian
+        title: Non-Gaussian Distributions
+      - file: multivariate/functions
+        title: Functions of Random Variables
+        sections:
+        - file: rr/prob-design/one-random-variable
+        - file: rr/prob-design/two-random-variables
+        - file: rr/prob-design/exercise
+          sections:
+          - file: rr/prob-design/exercise_solutions
 
 #   - caption: Q2 Topics
 #     numbered: 2
diff --git a/book/multivariate/events.md b/book/multivariate/events.md
index f3ff9d7e..0c983afc 100644
--- a/book/multivariate/events.md
+++ b/book/multivariate/events.md
@@ -1,16 +1,42 @@
+(multivariate_events)=
+# Events: Fundamentally Refreshing
 
-# Basic concepts to start
+Before going further into _continuous multivariate distributions,_ we will start with a reminder of some basic concepts you have seen previously: independence and conditional probability, illustrated by considering the probability of _events._
 
-Before going further into continuous multivariate distributions, we will start with a reminder of some basic concepts you have seen previously: independence, AND and OR probabilities, and conditional probability.
+```{admonition} Event
+:class: tip
+
+In probability theory, an _event_ is considered to be the outcome of an experiment with a specific probability. 
+
+**some other stuff**
 
 If you also need further practice or to revisit other concepts such as mutually exclusive events or collectively exhaustive, you can go [here](https://teachbooks.github.io/learn-probability/section_01/Must_know_%20probability_concepts.html).
+```
+
+## Discrete Events
+
+As we are working towards multivariate _continuous_ distributions we will these events will be referred to _discrete_ events to distinguish them from.
+
+In this case our sample space is:
+- still 1
+- each event is a random variable
+- to facilitate the venn diagram and "event-based" analogies we will only consider binary cases for each event, so $\leq$ and $>$ cases (can illustrate for more than binary cases, but why bother)
+- 
 
-## AND and OR probabilities: Venn diagrams
+Great. Now let's review a few key concepts (quickly!).
 
-Let's move back to discrete events to explain what AND and OR probabilities are. Imagine two events, A and B. These can be, for instance, the fact that it rains today (A) and the fact that the temperature is below 10 degrees (B). Each of these events will have a probability of ocurring, denoted here as $P(A)$ and $P(B)$, respectively.
+**idea**: simply list condition, total probability, independence rule, Bayes rule (lays out terms and usage), then the following sections briefly illustrate these things with the flood example and Venn diagrams.
 
+## Case Study
 
-```{figure} ../venn-events.png
+Imagine two events, A and B:
+- A represents river A flooding
+- B represents river B flooding
+
+Each of these events will have a probability of ocurring, denoted here as $P(A)$ and $P(B)$, respectively.
+
+
+```{figure} ./figures/venn-events.png
 
 ---
 
@@ -20,7 +46,7 @@ Venn diagram of the events A and B.
 
 The AND probility or intersection of the events A and B, $P(A \cap B)$, is defined as the probability that both events happen at the same time and, thus, it would be represented in our diagram as shown in the figure below.
 
-```{figure} ../venn-intersection.png
+```{figure} ./figures/venn-intersection.png
 
 ---
 
@@ -28,6 +54,16 @@ The AND probility or intersection of the events A and B, $P(A \cap B)$, is defin
 Venn diagram of the events A and B, and AND probability.
 ```
 
+Thus there are two ways we have of describing the same probability:
+- intersection
+- AND
+
+we will use these interchangeably.
+
+Keep an eye out for related (English) words: both, together, joint, ...
+
+### 
+
 The OR probability or union of the events A and B, $P(A \cup B)$, is defined as the probability that either one of the two events happen or both of them. This probability can be computed as 
 
 $$
@@ -36,25 +72,14 @@ $$
 
 This is, we add the probabilities of occurrence of the event A and B and we deduct the intersection of them, to avoid counting them twice.
 
-## AND and OR probabilities from samples
-
-
 
-## Independence
 
-When two random variables, X and Y, are independent, it means that the occurrence or value of one variable does not influence the occurrence or value of the other variable.
 
-Formally, X and Y are considered independent **if and only if** the joint probability function (or cumulative distribution function) can be factorized into the product of their marginal probability functions (or cumulative distribution functions). This is, 
-
-$F(x, y) = P(x<X \bigcap y<Y ) = P(x<X)P(y<Y) = F(x)F(y)$
-
-The different relationships above highlights the connection between the joint cumulative distribution function (CDF) and the marginal CDFs of two independent random variables, X and Y.
-
-Definition of independence 
-
-Definition of And and OR probabilities using Venn diagrams
+## AND and OR probabilities from samples
 
-Move to continuous distributions and compute them from samples
+**we can illustrate samples in the venn diagram as dots with labels:
+- simple counting exercises will illustrate the probabilities
+- 
 
 ## Conditional probability
 
diff --git a/book/multivariate/functions.md b/book/multivariate/functions.md
new file mode 100644
index 00000000..645ed8bc
--- /dev/null
+++ b/book/multivariate/functions.md
@@ -0,0 +1,10 @@
+(multivar_functions)=
+# Functions of Random Variables
+
+In contrast to earlier weeks, this is where there is dependence between the input random variables.
+
+binary cases are **boring**
+
+Up to this point we have only done binary cases with two RV's (both or either river flooding). In other words, when the problem of interest is based on some set of A and B. What about when this is described as a continuous function? Then we have a (familiar) function of random variables! We will illustrate this case in the next section. **this is where the 1- and 2-random variable pages from 2023 can be included.
+
+**1- and 2-random variable cases from 2023.**
\ No newline at end of file
diff --git a/book/multivariate/gaussian.md b/book/multivariate/gaussian.md
index ed93293e..9e1cf1c0 100644
--- a/book/multivariate/gaussian.md
+++ b/book/multivariate/gaussian.md
@@ -5,4 +5,6 @@ Definition of bivariate Gaussian
 
 Move to 3D
 
-Analytical conditionalization of the 3D Gaussian: 2D margin!
\ No newline at end of file
+Analytical conditionalization of the 3D Gaussian: 2D margin!
+
+**case study**: return to the river flooding case and illustrate the effect of dependence. figure and table.
\ No newline at end of file
diff --git a/book/multivariate/overview.md b/book/multivariate/overview.md
index ae021a24..f4567a58 100644
--- a/book/multivariate/overview.md
+++ b/book/multivariate/overview.md
@@ -16,8 +16,24 @@ $$
 \rho(X_1,X_2)=\frac{Cov(X_1,X_2)}{\sigma_{X_1} \sigma_{X_2}} 
 $$ 
 
-where $X_1$ and $X_2$ are random variables, $Cov(X_1,X_2)$ is their covariance, and $\sigma_{X_1}$ and $\sigma_{X_2}$ are the standard deviations of $X_1$ and $X_2$. $-1 \leq \rho(X_1,X_2) \leq 1$, being $\rho(X_1,X_2)=-1$ a perfect negative linear correlation, and $\rho(X_1,X_2)=1$ a perfect positive linear correlation. If $\rho(X_1,X_2) \to 0$, we say that $X_1$ and $X_2$ are independent[^note]. This is, that having information about $X_1$ does not provide us with information about $X_2$. The interactive element below allows you to play around with the correlation value yourself. Observe how the distribution's density contours, or the scattered data, changes when you adapt the correlation value.
+where $X_1$ and $X_2$ are random variables, $Cov(X_1,X_2)$ is their covariance, and $\sigma_{X_1}$ and $\sigma_{X_2}$ are the standard deviations of $X_1$ and $X_2$. $-1 \leq \rho(X_1,X_2) \leq 1$, being $\rho(X_1,X_2)=-1$ a perfect negative linear correlation, and $\rho(X_1,X_2)=1$ a perfect positive linear correlation. If $\rho(X_1,X_2) \to 0$, we say that $X_1$ and $X_2$ are independent[^note]. This is, that having information about $X_1$ does not provide us with information about $X_2$. The interactive element below allows you to play around with the correlation value yourself. Observe how the distribution's _density_ contours, or a scatter plot of _samples,_ change when you adjust the correlation.
 
 <iframe src="../_static/elements/element_correlation.html" width="600" height="400" frameborder="0"></iframe>
 
+**Overview of this Chapter**
+
+Our ultimate goal is to construct and validate a model to quantify probability for combinations of more than one random variable of interest (i.e., to quantify various types of uncertainty). Specifically, 
+
+$$
+f_X(x) \;\; \textrm{and} \;\; F_X(x)
+$$
+
+where $X$ is a vector of continuous random variables and $f$ and $F$ are the multivariate probability density function (PDF) and cumulative distribution functions (CDF), respectively. Often we will use _bivariate_ situations (two random variables) to illustrate key concepts, for example:
+
+$$
+f_{X_1,X_2}(x_1,x_2) \;\; \textrm{and} \;\; F_{X_1,X_2}(x_1,x_2)
+$$
+
+This chapter begins with a refresher on some fundamental aspects of probability theory that are typically covered in BSc courses on the subject, for example, dependence/independence, probability of binary events and conditional probability. Using the _bivariate_ paradigm, we will build a foundation on which to apply the multivariate Gaussian distribution (introduced in earlier chapters), as well as introduce alternative _multivariate distributions._ The chapter ends with a brief introduction to _copulas_ as a straightforward approach for evaluating two random variables that are dependent _and_ described by non-Gaussian marginal distributions (the previous chapter).
+
 [^note]: That is an intuitive definition of independence. For a more formal definition of independence, visit the next page of the chapter.
\ No newline at end of file
diff --git a/book/multivariate/variables.md b/book/multivariate/variables.md
index e69de29b..2e433cb9 100644
--- a/book/multivariate/variables.md
+++ b/book/multivariate/variables.md
@@ -0,0 +1,38 @@
+(multivariate_variables)=
+# Multivariate Random Variables
+
+
+
+
+
+
+
+## Independence
+
+When two random variables, X and Y, are independent, it means that the occurrence or value of one variable does not influence the occurrence or value of the other variable.
+
+Formally, X and Y are considered independent **if and only if** the joint probability function (or cumulative distribution function) can be factorized into the product of their marginal probability functions (or cumulative distribution functions). This is, 
+
+$F(x, y) = P(x<X \bigcap y<Y ) = P(x<X)P(y<Y) = F(x)F(y)$
+
+The different relationships above highlights the connection between the joint cumulative distribution function (CDF) and the marginal CDFs of two independent random variables, X and Y.
+
+Definition of independence 
+
+### Illustration
+
+Definition of And and OR probabilities using bivariate plots and compared to the Venn diagrams.
+
+## Samples
+
+Compute probabilities from samples.
+
+Illustrate the difference between the theoretical and empirical probabilities. Include a table that summarizes them and describe how this can be used to validate the multivariate distribution (**obviously** we should illustrate a case where dependence is important: many observations where _both_ rivers flood).
+
+**Illustrate explicitly that this is the thing that is inaccurate in the example:**
+
+$$
+F_{X_1,X_2}(X_1>x_1,X_2>x_2)
+$$
+
+**So now we need a way to describe dependence!** 
\ No newline at end of file
-- 
GitLab