Let's assume I want to plot the function $f(x)=a + bx+ cx^{2}$, where experimentally known values of parameters $a, b$ and, $c$ are as follows:

$a=1.01 \pm 0.18$

$b=0.92 \pm 0.11$

$c=2.2 \pm 0.2$

In the absence of uncertainties, we should have a thin curve which is trivial to plot. However, the thickness of the curve will increase depending on the amount of uncertainties. Is there any way to plot such a function with the corresponding "confidence bands" in Mathematica 8.0?

  • 4
    $\begingroup$ Try Plot[With[{w = Interval[1.01 + 0.18 {-1, 1}] + x (Interval[0.92 + 0.11 {-1, 1}] + x Interval[2.2 + 0.2 {-1, 1}])}, {Min[w], Max[w]}], {x, -5, 5}] and report back. $\endgroup$ Commented May 21, 2016 at 7:12

1 Answer 1


This does what I think you're after, fiddle with options as desired:

With[{a = Interval[1.01 + .18 {-1, 1}], 
  b = Interval[.92 + .11 {-1, 1}], c = Interval[2.2 + .2 {-1, 1}]}, 
 Plot[{Min[a + b*x + c*x^2], 1.01 + .92 x + 2.2 x^2, 
   Max[a + b*x + c*x^2]}, {x, -5, 5}, Filling -> {1 -> {3}}, 
  FillingStyle -> Darker, PlotStyle -> {None, Red, None}]]

enter image description here

  • $\begingroup$ Thanks dear Ciao, this is wonderful. I truly appreciate that. Even though I am able to reproduce this but it gives me a minor error message, "Darker is not a Graphics primitive or directive." Do you know what is wrong with the Graphics chosen? What else should I choose in order to not receive this error messages? I just chose "Orange" so that the "red" you had chosen would be visible in it and that is working. Just curious to know why "Darker" is not recognized in my 8.0 version. $\endgroup$
    – Benjamin
    Commented May 22, 2016 at 17:39
  • $\begingroup$ Also, what if there are more than one such function that needs to be plotted in the same graph? The "None" option of the PlotStyle is not recognized anymore in such cases! $\endgroup$
    – Benjamin
    Commented May 22, 2016 at 18:48
  • $\begingroup$ @Benjamin: I don't have 8.0 installed any more - I'm sure Darker was available in 8, but can't test to explain. Glad you worked around that. As for two or more curves - depends on what you want to do with the confidence bands. Might deserve its own question... $\endgroup$
    – ciao
    Commented May 22, 2016 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.