Elementary mathematical operations
Elementary mathematical operations (+
, -
, *
, and /
) between arbitrary uncertain values of different types and scalars are supported.
Syntax
Resampling is used to perform the mathematical operations. All mathematical operations return a vector containing the results of repeated element-wise operations (where each element is a resampled draw from the furnishing distribution(s) of the uncertain value(s)).
The default number of realizations is set to 10000
. This allows calling uval1 + uval2
for two uncertain values uval1
and uval2
. If you need to tune the number of resample draws to n
, use the +(uval1, uval2, n)
syntax.
Future improvements
In the future, elementary operations might be improved for certain combinations of uncertain values where exact expressions for error propagation are now, for example using the machinery in Measurements.jl
for normally distributed values.
Supported operations
Addition
Base.:+
— MethodBase.:+(a::AbstractUncertainValue, b::AbstractUncertainValue) -> UncertainValue
Addition operator for pairs of uncertain values.
Computes the element-wise sum between for a default of n = 10000
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Use the +(a, b, n)
syntax to tune the number (n
) of draws.
Base.:+
— MethodBase.:+(a::AbstractUncertainValue, b::AbstractUncertainValue, n::Int) -> UncertainValue
Addition operator for pairs of uncertain values.
Computes the element-wise sum between a
and b
for n
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Call this function using the +(a, b, n)
syntax.
Base.:+
— MethodBase.:+(a::Real, b::AbstractUncertainValue) -> UncertainValue
Addition operator for between scalars and uncertain values.
Computes the element-wise sum between a
and b
for a default of n = 10000
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Use the +(a, b, n)
syntax to tune the number (n
) of draws.
Base.:+
— MethodBase.:+(a::Real, b::AbstractUncertainValue, n::Int) -> UncertainValue
Addition operator for scalar-uncertain value pairs.
Computes the element-wise sum between a
and b
for n
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Call this function using the +(a, b, n)
syntax.
Base.:+
— MethodBase.:+(a::AbstractUncertainValue, b::Real) -> UncertainValue
Addition operator for between uncertain values and scalars.
Computes the element-wise sum between a
and b
for a default of n = 10000
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Use the +(a, b, n)
syntax to tune the number (n
) of draws.
Base.:+
— MethodBase.:+(a::AbstractUncertainValue, b::Real, n::Int) -> UncertainValue
Addition operator for scalar-uncertain value pairs.
Computes the element-wise sum between a
and b
for n
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise sums.
Call this function using the +(a, b, n)
syntax.
Subtraction
Base.:-
— MethodBase.:-(a::AbstractUncertainValue, b::AbstractUncertainValue) -> UncertainValue
Subtraction operator for pairs of uncertain values.
Computes the element-wise differences between for a default of n = 30000
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Use the -(a, b, n)
syntax to tune the number (n
) of draws.
Base.:-
— MethodBase.:-(a::AbstractUncertainValue, b::AbstractUncertainValue, n::Int) -> UncertainValue
Subtraction operator for pairs of uncertain values.
Computes the element-wise differences between a
and b
for n
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Call this function using the -(a, b, n)
syntax.
Base.:-
— MethodBase.:-(a::Real, b::AbstractUncertainValue) -> UncertainValue
Subtraction operator for between scalars and uncertain values.
Computes the element-wise differences between a
and b
for a default of n = 30000
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Use the -(a, b, n)
syntax to tune the number (n
) of draws.
Base.:-
— MethodBase.:-(a::Real, b::AbstractUncertainValue, n::Int) -> UncertainValue
Subtraction operator for scalar-uncertain value pairs.
Computes the element-wise differences between a
and b
for n
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Call this function using the -(a, b, n)
syntax.
Base.:-
— MethodBase.:-(a::AbstractUncertainValue, b::Real) -> UncertainValue
Subtraction operator for between uncertain values and scalars.
Computes the element-wise differences between a
and b
for a default of n = 30000
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Use the -(a, b, n)
syntax to tune the number (n
) of draws.
Base.:-
— MethodBase.:-(a::AbstractUncertainValue, b::Real, n::Int) -> UncertainValue
Subtraction operator for scalar-uncertain value pairs.
Computes the element-wise differences between a
and b
for n
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise differences.
Call this function using the -(a, b, n)
syntax.
Multiplication
Base.:*
— MethodBase.:*(a::AbstractUncertainValue, b::AbstractUncertainValue) -> UncertainValue
Multiplication operator for pairs of uncertain values.
Computes the element-wise products between for a default of n = 10000
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Use the *(a, b, n)
syntax to tune the number (n
) of draws.
Base.:*
— MethodBase.:*(a::AbstractUncertainValue, b::AbstractUncertainValue, n::Int) -> UncertainValue
Multiplication operator for pairs of uncertain values.
Computes the element-wise products between a
and b
for n
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Call this function using the *(a, b, n)
syntax.
Base.:*
— MethodBase.:*(a::Real, b::AbstractUncertainValue) -> UncertainValue
Multiplication operator for between scalars and uncertain values.
Computes the element-wise products between a
and b
for a default of n = 10000
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Use the *(a, b, n)
syntax to tune the number (n
) of draws.
Base.:*
— MethodBase.:*(a::Real, b::AbstractUncertainValue, n::Int) -> UncertainValue
Multiplication operator for scalar-uncertain value pairs.
Computes the element-wise products between a
and b
for n
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Call this function using the *(a, b, n)
syntax.
Base.:*
— MethodBase.:*(a::AbstractUncertainValue, b::Real) -> UncertainValue
Multiplication operator for between uncertain values and scalars.
Computes the element-wise products between a
and b
for a default of n = 10000
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Use the *(a, b, n)
syntax to tune the number (n
) of draws.
Base.:*
— MethodBase.:*(a::AbstractUncertainValue, b::Real, n::Int) -> UncertainValue
Multiplication operator for scalar-uncertain value pairs.
Computes the element-wise products between a
and b
for n
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise products.
Call this function using the *(a, b, n)
syntax.
Division
Base.:/
— MethodBase.:/(a::AbstractUncertainValue, b::AbstractUncertainValue) -> UncertainValue
Division operator for pairs of uncertain values.
Computes the element-wise quotients between for a default of n = 10000
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Use the /(a, b, n)
syntax to tune the number (n
) of draws.
Base.:/
— MethodBase.:/(a::AbstractUncertainValue, b::AbstractUncertainValue, n::Int) -> UncertainValue
Division operator for pairs of uncertain values.
Computes the element-wise quotients between a
and b
for n
realizations of a
and b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Call this function using the /(a, b, n)
syntax.
Base.:/
— MethodBase.:/(a::Real, b::AbstractUncertainValue) -> UncertainValue
Division operator for between scalars and uncertain values.
Computes the element-wise quotients between a
and b
for a default of n = 10000
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Use the /(a, b, n)
syntax to tune the number (n
) of draws.
Base.:/
— MethodBase.:/(a::Real, b::AbstractUncertainValue, n::Int) -> UncertainValue
Division operator for scalar-uncertain value pairs.
Computes the element-wise quotients between a
and b
for n
realizations of b
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Call this function using the /(a, b, n)
syntax.
Base.:/
— MethodBase.:/(a::AbstractUncertainValue, b::Real) -> UncertainValue
Division operator for between uncertain values and scalars.
Computes the element-wise quotients between a
and b
for a default of n = 10000
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Use the /(a, b, n)
syntax to tune the number (n
) of draws.
Base.:/
— MethodBase.:/(a::AbstractUncertainValue, b::Real, n::Int) -> UncertainValue
Division operator for scalar-uncertain value pairs.
Computes the element-wise quotients between a
and b
for n
realizations of a
, then returns an uncertain value based on a kernel density estimate to the distribution of the element-wise quotients.
Call this function using the /(a, b, n)
syntax.
Special cases
CertainValue
s
Performing elementary operations with CertainValue
s behaves as for scalars.