From: rusin@vesuvius.math.niu.edu (Dave Rusin) Newsgroups: comp.graphics.algorithms,sci.math.num-analysis Subject: Re: How to solve for three unknowns with three quadratic equations Date: 27 Mar 1998 04:02:06 GMT In article <6f8par$s9d$1@vixen.cso.uiuc.edu>, Peter J. Wahle wrote: >I'm working on a graphics related problem that results in three quadratic >equations in three unknowns. I need to solve for the unknowns. > >They are of the form >l^2 = aX^2 + bXZ + cZ^2 >r^2 = dY^2 + eYZ + cZ^2 >t^2 = aX^2 + fXY + dY^2 > >Where a, b, c, d, e, f, l, r, and t are real constants; >and X, Y, and Z are the unknowns I need to solve for. >X, Y, and Z must be real. > >Any suggestion on how I might solve this? >A direct method would be preferred, but >iterative methods could be useful. The previous suggestions to solve numerically are probably best, but you did ask for a "direct" method (and anyway the numerical techniques will need to know something global like where to start looking for solutions). You can take these three polynomials in 3 variables and eliminate two of them, that is, express X and Y (say) as rational functions of Z, and find the polynomial equation of which Z is a root. This is not exactly elegant, but in this case it shows we _can_ get such expressions for X and Y; Z must satisfy a degree-8 polynomial. It's a little better than that: this polynomial is actually a quartic in Z^2; so you just want to know the real, positive roots of this quartic. As one poster pointed out, it's clear geometrically that there are no such roots for some choices of the parameters. So excluding degenerate cases, it seems to me that there are up to 8 points of intersection among these three cylinders, always occuring in antipodal pairs. Given specific values of the parameters, it is perhaps not unreasonable to write down the quartic explicitly and solve for its roots. (Indeed, one could compute a Sturm sequence and so on, and give a certain number of inequality tests which would determine the number of points of intersection, and with a bit more work could separate them into intervals. If you think I'm going to do that symbolically, you've overestimated my patience!) For your viewing pleasure I give below the formula for Y and the quartic which Z^2 must satisfy; the corresponding formula for X is not given, as a service to news-servers everywhere (simply use symmetry). Computations done with Maple. dave myanswer={poly=(d*a*t^4-2*d*a*t^2*l^2+d*a*l^4-2*r^2*a*t^2*d+2*r^2*a*d*l^2+r^4*a *d-r^2*l^2*f^2)^2+(-2*d*r^4*a^2*t^2*e^2-6*d^2*b^2*t^2*r^4*a-24*d^2*a^2*c*l^2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