# Parametric regions

I'm trying to plot $a x^2 + b x + c$ where $a, b, c$ (and $x$) take on a range of values.

I tried

ParametricPlot[{x, a x^2 + b x + c}, {x, -1, 1},
{a, -.25, .25}, {b, -.25, .25}, {c, -.25, .25}]


but ParametricPlot can only handle up to two parameters.

My work around uses FindInstance which can be really slow:

RangePlot[eq_Equal, {x_, xmin_, xmax_}, {y_, ymin_, ymax_}, vars_List, constraints_] :=
RegionPlot[
FindInstance[And[constraints, eq], vars] =!= {}, {x, xmin, xmax}, {y, ymin, ymax}
]

RangePlot[y == a x^2 + b x + c, {x, -1, 1}, {y, -1, 1}, {a, b, c},
-.25 < a < .25 && -.25 < b < .25 && -.25 < c < .25]


Is there a better way to do this?

-
This is not quite what I'm looking for. I want a,b,c,x to all take on a non-discrete amount of values. That is to say a,b,c,x all take on a range of values in some interval. – Chip Hurst Oct 21 '12 at 3:34
A bit hard to visualize things when you have four things varying all at once. Maybe take three at a time and fix one of those parameters? – J. M. Oct 21 '12 at 4:17
@J.M. I thought the same at first, but re reading the question the Op wants the coverage of $R^2$ obtained by the whole parameters' range. Much more interesting – Dr. belisarius Oct 21 '12 at 4:26
@Chip You should move your update to an answer so that I can vote for it. :-) – Mr.Wizard Jul 31 '14 at 22:33
@Mr.Wizard ok, it's moved. :-) – Chip Hurst Aug 3 '14 at 18:50

One can observe that your parabola is a monotonic function of a and c, therefore one can define a minimum and maximum family of parabolas as :

minPar = a x^2 + b x + c /. {a -> -1/4, c -> -1/4};
maxPar = a x^2 + b x + c /. {a -> 1/4, c -> 1/4};


Next, one can pick the very maximum and minimum of the family :

minMinPar[x_] := Piecewise[{{minPar /. b -> 1/4, x <= 0}, {minPar /. b -> -1/4, x > 0}}]
maxMaxPar[x_] := Piecewise[{{maxPar /. b -> -1/4, x <= 0}, {maxPar /. b -> 1/4, x > 0}}]


and assuming continuity one can then just plot the two extreme curves and fill in between :

Plot[{minMinPar[x], maxMaxPar[x]}, {x, -1, 1}, Filling -> {1 -> {2}}]


-

Reduce can solve this problem. First, reduce the inequalities to a cylindrical decomposition in which the inequalities for x and y are in the first two "levels" or "dimensions" (not the same as Mathematica levels -- I'm not sure if there is a standard name). Delete the inequalities related to the parameters. Reduce again, if you want the result simplified.

xyineq = DeleteCases[
Reduce[y == a x^2 + b x + c && -1 < x < 1 && -1 < 4 a < 1 && -1 <
4 b < 1 && -1 < 4 c < 1, {x, y, a, b, c}, Reals],
ineq : (_Inequality | _Less | _Equal) /; MemberQ[ineq, a | b | c, Infinity],
Infinity];

xyrgn = Reduce[xyineq, {x, y}, Reals]
(*
(-1 < x <= 0 &&  1/4 (-1 + x - x^2) < y < 1/4 (1 - x + x^2)) ||
( 0 < x < 1  &&  1/4 (-1 - x - x^2) < y < 1/4 (1 + x + x^2))
*)

RegionPlot[xyrgn, {x, -1, 1}, {y, -0.75, 0.75}]


-

## Version 10 update

There is actually a nice way to solve this problem in V10.

R = ParametricRegion[{x, a x^2 + b x + c}, {{x, -1, 1},
{a, -.25, .25}, {b, -.25, .25}, {c, -.25, .25}}];
RegionPlot[R]


-

This is a solution which I am using currently, as an alternative for 2D ParametricPlot with more than 2 variables. (I am not claiming anything regarding it being optimal - it just solves my purpose)

The simple way out is to discretize the range of the variables into fine grid and evaluate the functions at that point (hence there is a constant predicatable overhead of the computation time, using which you can discretize the grid)

For this example here I am using the function objFn which is dependent on 3 variables g1,g2 and g3

points = Partition[
Flatten@Table[{g1, g2, g3}, {g1, 1, 3, 0.1}, {g2, 1, 3, 0.1}, {g3,
1, 3, 0.1}], 3];
fPoints = objFn @@ # & /@ points
ListPlot[fPoints]


You get a pixelated image from which you can make out the region. But is more predicatable , in terms of computation time it takes, than using FindInstance

-