Bowl Pile Height
The goal of this puzzle is to compute the height of a stack of bowls.
A bowl is defined to be a radially symmetric device without thickness.
Its silhouette shape is an even polynomial. The stack is described by a list of radii, each associated with an even polynomial, given as input as a list of coefficients (e.g. the list
3.1 4.2 represents the polynomial \$3.1x^2+4.2x^4\$).
The polynomial may have arbitrary degree. For simplicity, the height of the pile is defined as the altitude of the center of the top-most bowl (see plot of Example 3 for an illustration).
Test cases are in the format
radius:coeff1 coeff2 ...: each line starts with a float number representing the radius of the bowl, followed by a colon and a space-separated list containing the coefficients for the even powers, starting with power 2 (zero constant part is implied). For example, the line
2.3:3.1 4.2 describes a bowl of radius
2.3 and the shape-polynomial
3.1 * x^2 + 4.2 * x^4.
describes a pile of zero height since a single bowl has no height.
1:1 2 1.2:5 1:3
describes a pile of height
2.0 (see plot).
1:1.0 0.6:0.2 0.6:0.4 1.4:0.2 0.4:0 10
describes a pile of height 0.8 (see green arrow in the plot).
This is code golf, so the shortest code wins.
I have reference code.
The reference implementation relies on a library to compute the roots of polynomials. You may do that as well but you don't need to. Since the reference implementation is only a (quite good) numerical approximation, I will accept any code which produces correct results within common floating-point tolerances.
The idea counts. I don't care if there are small erros \$<\varepsilon\$.
Another variant of this puzzle is to minimize the height by reordering the bowls. I'm not sure if there's a fast solution (I guess it's NP-hard). If anyone has a better idea (or can prove NP-completeness), please tell me!