# Bayesian Optimal Experimental Design for Race Tracking in Resin Transfer Moulding
## 3 Bayesian Formulation
### Exploring the Posterior  
Although Equation (26) is the posterior, we need some way of interpreting this distribution. The posterior could be analysed using Markov Chain Monte Carlo (MCMC) methods [8], but this would involve evaluating the posterior hundreds of thousands of times. Calculating the posterior is a computationally expensive operation because it requires calculating \(\mathcal{G}(\mathbf{k})\) and running the RTM model. The RTM model involves solving the system of equations for pressure at each timestep, where the number of timesteps scales with the number of nodes. Other research in this area focuses on the development of less computationally expensive methods [18; 19].  
We use a Laplace approximation to the posterior, which requires several orders of magnitude less computational time. The Laplace approximation works by approximating the posterior about the maximum a posteriori (MAP) estimate. We then take a Gaussian approximation of this estimate. However, the calculation of the MAP estimate is not trivial and requires maximising the posterior. This can be simplified by noting the following.  
\[\begin{array}{ll}\mathbf{k}_{\text{MAP}}&=\underset{\mathbf{k}}{\operatorname{ argmax}}\left(\pi(\mathbf{k}|\mathbf{d})\right)\\ &=\underset{\mathbf{k}}{\operatorname{argmin}}\left(-2\ln\pi(\mathbf{k}|\mathbf{d})\right) \\ &=\underset{\mathbf{k}}{\operatorname{argmin}}\left(||\mathbf{L}_{e}(\mathcal{G}(\mathbf{k })-\mathbf{d})||^{2}+||\mathbf{L}_{k}(\mathbf{k}-\mu_{k})||^{2}\right).\end{array} \tag{27}\]  
Once the MAP estimate has been found, the Laplace approximation to the posterior can be found by considering the Taylor expansion of \(\mathcal{G}(\mathbf{k})\) about \(\mathbf{k}_{\text{MAP}}\):  
\[\mathcal{G}(\mathbf{k})\approx\mathcal{G}(\mathbf{k}_{\text{MAP}})+\mathbf{\mathcal{J}}( \mathbf{k}-\mathbf{k}_{\text{MAP}}), \tag{28}\]  
where \(\mathbf{\mathcal{J}}\) is the Jacobian of the RTM model evaluated at the MAP estimate. This Jacobian considers the derivative of all outputs of \(\mathcal{G}(\mathbf{k})\), with respect to each of the components of \(\mathbf{k}\):  
\[\mathbf{\mathcal{J}}=\begin{bmatrix}\frac{\partial\mathcal{G}_{1}}{\partial\mathbf{k }_{1}}&\frac{\partial\mathcal{G}_{1}}{\partial\mathbf{k}_{2}}&\cdots&\frac{ \partial\mathcal{G}_{1}}{\partial\mathbf{k}_{n}}\\ \frac{\partial\mathcal{G}_{2}}{\partial\mathbf{k}_{1}}&\frac{\partial\mathcal{G}_ {2}}{\partial\mathbf{k}_{2}}&\cdots&\frac{\partial\mathcal{G}_{2}}{\partial\mathbf{k} _{n}}\\ &\vdots&\ddots\\ \frac{\partial\mathcal{G}_{m}}{\partial\mathbf{k}_{1}}&\frac{\partial\mathcal{G}_ {m}}{\partial\mathbf{k}_{2}}&\cdots&\frac{\partial\mathcal{G}_{m}}{\partial\mathbf{k} _{n}}\end{bmatrix}, \tag{29}\]  
where \(\mathcal{G}_{i}\) is the \(i\)th component of the output vector from \(\mathcal{G}\). Substituting this into Equation (26) gives an equation for the Laplace approximation of \(\pi(\mathbf{k}|\mathbf{d})\), \(\pi_{\text{Laplace}}(\mathbf{k}|\mathbf{d})\):  
\[\pi_{\text{Laplace}}(\mathbf{k}|\mathbf{d})\propto\exp\biggl{(}-\frac{1}{2}||\mathbf{L}_{e }(\mathbf{\mathcal{J}}\mathbf{k}-\mathbf{z})||^{2}-\frac{1}{2}||\mathbf{L}_{k}(\mathbf{k}-\mu_{k} )||^{2}\biggr{)}, \tag{30}\]  
where \(\mathbf{z}=\mathbf{d}+\mathbf{\mathcal{J}}\mathbf{k}_{\text{MAP}}-\mathcal{G}(\mathbf{k}_{\text{ MAP}})\), which does not depend on \(\mathbf{k}\). This probability density function describes a Gaussian distribution (that is, \(\pi_{\text{Laplace}}\sim\mathcal{N}(\mathbf{k}_{\text{MAP}},\mathbf{\Gamma}_{\text{ post}})\)), the covariance of which can be calculated as follows:  
\[\mathbf{\Gamma}_{\text{post}}=(\mathbf{\mathcal{J}}^{\text{T}}\mathbf{\Gamma}_{e}^{-1}\bm {\mathcal{J}}+\mathbf{\Gamma}_{k}^{-1})^{-1}. \tag{31}\]