# Multivariate equivalent to Measurement.jl?

**URL:** <https://discourse.julialang.org/t/multivariate-equivalent-to-measurement-jl/96956>\
**Category:** General Usage\
**Created:** [April 1, 2023, 8:28pm UTC](https://discourse.julialang.org/t/multivariate-equivalent-to-measurement-jl/96956 "2023-04-01T20:28:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Post date:** [April 1, 2023, 8:28pm UTC](https://discourse.julialang.org/t/multivariate-equivalent-to-measurement-jl/96956/1 "2023-04-01T20:28:00Z")

</div>

Hey,

I would like to propagate a second order moment around a value, a lot like what Measurements.jl does, but multivariate.

```julia
n = 10
x = ones(n)
gamma = randn(n,n)
V = gamma'gamma # this should now be a variance covariance matrix. 

# We now assume that the value x has "uncertainty" given by the variance covariance matrix V

# Thus, e.g., the uncertainty associated with x[1] is V[1,1]. 
# The uncertainty associated with x[1] - x[1] should be zero. 
# The uncertainty associted with x[1] + x[2] should be V[1,1] + V[2,2] + 2V[1,2]
# What would be the uncertainty of a given function f(x) ?

```

In the univariate case, this is precisely what `Measurements.jl` does, by overloading standard operations to provide this uncertainty propagation. But is there a package to do it in a multivariate case ?

* * *

I have an idea but i am not sure this is correct. The idea is to “reduce” to Measurements.jl capacities by simply using the `gamma` matrix to “standardize” x :

```julia
y = gamma \ x
# y is now suppose to be "standardized", and thus : 
y_mes = y .\pm 1
x_mes = gamma * y 
# x_mes now has the wanted uncertainty V

```

Would that be enough ? Assuming the output of the function `f(x)`, the value which i want the uncertainty from, is univariate, maybe Measurements.jl would be enough ? In real word applications, obtaining the `gamma` matrix is done by matrix square root or something like that.
