# Extracting Uncertainty from Numerical Solution

I am performing numerical and uncertainty analysis for an oblique shockwave angle function:

$$\tan(\delta)=\frac{2}{\tan(\theta)}\frac{M^2\sin^2(\theta)-1}{M^2(\gamma+\cos(2\theta))+2}$$

where $$\delta$$ is deflection angle, $$\theta$$ is shock angle, M is mach number, and $$\gamma$$ is the ratio of specific heats. In our observation, $$\delta$$, $$\theta$$, and $$M$$ all have uncertainty. $$\gamma$$ is assumed to be exact.

Our unknown quantity is $$\theta \pm \sigma_{\theta}$$. If it was possible to solve for $$\theta$$ analytically, it would be trivial to propagate uncertainty (excluding covariances):

$$\sigma_{\theta}^2 = \left( \frac{\partial\theta}{\partial M}\sigma_M \right)^2+ \left( \frac{\partial\theta}{\partial\delta}\sigma_{\delta} \right)^2$$

The question is: how do I define $$\theta$$ so that I can take a derivative of it with respect to $$M$$ and $$\delta$$ for uncertainty analysis? Or maybe there is a way to approximate $$\theta$$ and take a numerical derivative? I am probably overthinking this.

I'll try to address the question in bold. The expression for the angle function can be expressed as $$f(\delta, M; \theta)$$. You can compute partial derivatives of this function as $$\frac{\partial f}{\partial \delta} = \frac{\partial f}{\partial \theta} \frac{\partial \theta}{\partial \delta}$$ and $$\frac{\partial f}{\partial M} = \frac{\partial f}{\partial \theta} \frac{\partial \theta}{\partial M}$$ That will give you the two partial derivatives of $$\theta$$ that you seek.