# How can I propagate an asymmetric error in a function about the central value?

If I have some asymmetric error about the central value in x and y, then how can it be propagated in a function f[x, y, z]?

For example, given

f[x, y, z] = 2*x^2 + 3*y^3 + z


and x = 1.2 with error (+0.4,-0.3) and y = 2.3 with error (+0.3, -0.5), how can I plot f as a function of z showing these errors?

Building on Szabolcs answer [which disappeared whilst I was writing this] since the question mentions plotting:

f[x_, y_, z_] := 2 x^2 + 3 y^3 + z

Plot[Evaluate[
With[{u = f[Interval[{0.9, 1.6}], Interval[{1.8, 2.6}], z]},
{u /. Interval[r_] :> Min[Interval[r]],
u /. Interval[r_] :> Max[Interval[r]]}]], {z, 0, 10},
Filling -> {1 -> {2}}, PlotStyle -> Red] The somewhat convoluted use of Evaluate and Interval[r_] :> Min[Interval[r]] is in order to be able to fill between the limits.

However, in this particular case the same result can be got without using Interval:

Plot[Evaluate[With[{u = f[{0.9, 1.6}, {1.8, 2.6}, z]}, {Min[u], Max[u]}]],
{z, 0, 10}, Filling -> {1 -> {2}}, PlotStyle -> Red]


I'll try to answer more general question on finding confidence interval of arbitrary monotonic and smooth function.

Let us take as simple example the case of calculating the real refractive index from complex dielectric permittivity data with known relative errors of measurements.

The formula is

nRe[epsRe_, epsIm_] := Sqrt[(Sqrt[epsRe^2 + epsIm^2] + epsRe)/2]


In this case Interval cannot be used because Intervals are always assumed independent, but in our formula the same interval value is used twice.

We will use brute-force approach for estimating true value of the interval for nRe. Les us assume that errors of dielectric permittivity data are equal {-10%, +5%}. We will take all possible tuples for values between 0.9 and 1.05 with different steps and see how the error estimates depend of the step.

epsComplex = {{3.8,1.84},{2.43,0.9},{2.01,0.71},{1.77,0.65},{1.61,0.31}};

Max@Abs@Differences[
Table[{Min@#, Max@#} &[
nRe @@ (Transpose[Tuples[Range[.9, 1.05, step], {2}]]*{#1, #2})
] & @@@ epsComplex, {step, {.05, .01, .005, .001}}]]


0.

It is clear that in this case the error estimates do not depend on the choice of step and the minimal step .05 is sufficient. Now we can plot our error estimates along with computed values:

ListLinePlot[
Transpose[{Min@#1, #2, Max@#1} &[
nRe @@ (Transpose[Tuples[Range[.9, 1.05, .05], {2}]] {#1, #2}),
nRe[#1, #2]] & @@@ epsComplex], Filling -> {1 -> {3}},
PlotStyle -> {{Blue, Dashed}, {Blue, Thick}, {Blue, Dashed}}] 