Back Story
I believe a quadratic polynomial, $ax^2+bx+c$, has only real solutions $\text{iff}$ the discriminant, $D \geq 0$, which occurs when:
$$ D = b^2 - 4ac \geq 0 \Rightarrow \begin{cases} b^2 \geq 4ac & \text{if } ac > 0, \\ \text{any } b & \text{if } ac \leq 0. \end{cases} $$
I want to create a software program that generates random quadratic polynomials with only real solutions without using any 'if-statements' because if it requires checking, then by this logic I would have to reject a lot of generated quadratic polynomials when simulating.
In Mathematica, I can use the code:
n = 10000; (* Number of random sets to generate *)
data = Table[
a = RandomReal[{-2, 2}];
b = RandomReal[{-2.5, 2.5}];
c = RandomReal[{-3, 3}];
discriminant = b^2 - 4*a*c;
If[discriminant >= 0, {a, b, c}, Nothing],
{n}
];
chm = ConcaveHullMesh[data];
bdp = MeshCoordinates[RegionBoundary[chm]];
ListSurfacePlot3D[bdp, AxesLabel -> {"a", "b", "c"}, PlotLabel -> "Coefficients of Quadratics with D >= 0"]
To generate a shape like this:
When I change the bounds for $a, b, \text{or } c$, I get a similar shape where it is partially flat on the top and bottom, then curves. And it seems to have a flip symmetry.
Question Repeated:
So then what shape is formed that contains all the points (a, b, c) given the maximum and minimum bounds for each of those 3 parameters?
Update:
Here is the code and images for different viewpoints for when $b^{2} = 4ac$:
n = 10000; (* Number of random sets to generate *)
data = Table[
a = RandomReal[{-2, 2}];
c = RandomReal[{-3, 3}];
If[RandomChoice[{True, False}],
b = 2 * Sqrt[Abs[a * c]], (* Ensure b is real *)
b = -2 * Sqrt[Abs[a * c]]
];
If[a < 0, c = -Abs[c]]; (* Ensure c is negative if a is negative *)
If[c < 0, a = -Abs[a]]; (* Ensure a is negative if c is negative *)
{a, b, c},
{n}
];
viewPoints = {
{"Above", {0, 0, Infinity}}, {"Below", {0, 0, -Infinity}},
{"Front", {0, Infinity, 0}}, {"Behind", {0, -Infinity, 0}},
{"Left", {Infinity, 0, 0}}, {"Right", {-Infinity, 0, 0}},
{"Top Front Right", {Infinity, Infinity, Infinity}}, {"Bottom Back Left", {-Infinity, -Infinity, -Infinity}}
};
plots = Table[
ListPlot3D[data,
ViewPoint -> vp[[2]],
ViewProjection -> "Orthographic",
ImagePadding -> 5,
PlotLabel -> Style[vp[[1]], 14, Bold, Background -> White],
PlotRangePadding -> 0.2
],
{vp, viewPoints}
];
(* Adjust the size of the graphics grid as needed *)
Rasterize[GraphicsGrid[Partition[plots, 2], Spacings -> {0, 0}, ImageSize -> Full]]
Which gave the example image: