Re: Re: Ellipse equation simplification on Mathematica:
- To: mathgroup at smc.vnet.net
- Subject: [mg76890] Re: [mg76830] Re: Ellipse equation simplification on Mathematica:
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 29 May 2007 05:04:07 -0400 (EDT)
- References: <f2emof$35h$1@smc.vnet.net><200705181006.GAA12812@smc.vnet.net> <200705280500.BAA15766@smc.vnet.net> <A2AFF4CF-D65F-424C-A963-97043E71D6E7@mimuw.edu.pl>
On 29 May 2007, at 10:53, Andrzej Kozlowski wrote: > > On 28 May 2007, at 14:00, Narasimham wrote: > >> On May 19, 1:54 pm, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote: >>> On 18 May 2007, at 19:06, Narasimham wrote: >>> >>>> Reference is made to: >>> >>>> http://groups.google.co.in/group/geometry.puzzles/browse_thread/ >>>> threa... >>> >>>> Constant[c,d th,ph] ; >>> >>>> (* th, ph are spherical cords of tip of tube *) ; >>> >>>> cp = Cos[ph] ; sp = Sin[ph] ; cth = Cos[th] ; sth = Sin[th] ; >>> >>>> (* earlier typo corrected *) >>> >>>> d1 = Sqrt[(x + d cp cth + c )^2 + ( y + d cp sth )^2 + (d sp)^2 ] >>> >>>> d2 =Sqrt[(x - d cp cth - c )^2 + ( y - d cp sth )^2 + (d sp)^2 ] >>> >>>> FullSimplify[ d1 + d2 + 2 d - 2 a == 0] ; >>> >>>> When d = 0, algebraic/trigonometric simplification brings about >>>> common ellipse form: >>> >>>> (x/a)^2 + y^2/(a^2-c^2) = 1 >>> >>>> Request help for bringing to standard form involving constants a,c >>>> and the new tube length constant d. >>> >>>> Regards, >>>> Narasimham >>> >>> I don't think such a form exists. Consider the following. >>> >>> id1 = {d1^2 - ((x + d*cp*cth + c)^2 + (y + d*cp*sth)^2 + (d*sp)^2), >>> d2^2 - ((x - d*cp*cth - c)^2 + (y - d*cp*sth)^2 + (d*sp)^2), >>> sp^2 + cp^2 - 1, sth^2 + cth^2 - 1}; >>> >>> id = Prepend[id1, d1 + d2 + 2 d - 2 a]; >>> >>> Now consdier first the case of the ellipse: >>> >>> d = 0; >>> >>> gr = GroebnerBasis[id, {x, y, a, c}, {cp, sp, cth, sth, d1, d2}, >>> MonomialOrder -> EliminationOrder] >>> {-a^4 + c^2 a^2 + x^2 a^2 + y^2 a^2 - c^2 x^2} >>> >>> This tells us that >>> >>> First[%] == 0 >>> -a^4 + c^2*a^2 + x^2*a^2 + y^2*a^2 - c^2*x^2 == 0 >>> >>> is the equation of the ellipse, and this can be easily brought to >>> standard form by hand. But now consider your "general" case: >>> >>> Clear[d] >>> gr = GroebnerBasis[id, {x, y, a, c, d}, {cp, sp, cth, sth, d1, >>> d2}, >>> MonomialOrder -> EliminationOrder] >>> {} >>> >>> This means that elimination cannot be performed and no "standard >>> form" >>> of the kind you had in mind exists. Unless of course there is a bug >>> in GroebnerBasis (v. unlikely) or I have misunderstood what you had >>> in mind. >>> >>> Andrzej Kozlowski >> >> I checked for case of tube parallel to x- or y-axis produces ellipses >> and suspected validity even in 3-D general case. >> >> Narasimham >> > > > OK., now I see that I misundertood you and you wrote that cd,th, > ph (and presumably a) are supposed to be constants, so you do not > wish to eliminate them. But now one can easily prove that what you > get is not, in general, an ellipse. In this situation Groebner > basis works and you can obtain a rather horrible quartic equation > of your surface: > > id1 = {d1^2 - ((x + d*cp*cth + c)^2 + (y + d*cp*sth)^2 + (d*sp)^2), > d2^2 - ((x - d*cp*cth - c)^2 + (y - d*cp*sth)^2 + (d*sp)^2), > sp^2 + cp^2 - 1, sth^2 + cth^2 - 1}; > > id = Prepend[id1, d1 + d2 + 2*d - 2*a]; > > > v = GroebnerBasis[id, {x, y, a, c, cp, cth}, {sth, sp, d1, d2}, > MonomialOrder -> EliminationOrder][[1]]; > > First[v] == 0 > > is the equation (I prefer not to include the output here). > > Looking at v see that the non zero coefficients are only the free > coefficient, the coefficients of x^2, y^2, x^2 y^2, x^4 and y^4. So > only in some cases you will get a quadratic (for example when the > quartic happens to be a perfect square as in the case d=0, or when > the free coefficient vanishes, as in the trivial case a=d, or when > the coefficients of 4-degree terms vanish). One can work out all > the cases when gets a quadratic but it is also easy to find those > when one does not. For example, taking both th and ph to be 60 > degrees (so that cth and cph are both 1/2) we get: > > v /. {cp -> 1/2, cth -> 1/2, d -> 4, a -> 2, c -> 1} > > y^4 - 48 x^2 y^2 + 120 y^2 + 3600 > > This is certianly is not the equation of an ellipse. > > Andrzej Kozlowski > > Sorry; that last example was a bad one, because with these parameters (d>a) the original equations do not have solutions. The point is that the equations that we get after elimination will have more solutions than the ones we start with, but all the solutions of the original ones will satisfy the new ones. So to see that we do not normally get an ellipse we need a different choice of parameters, with a>d. So take instead w = First[v ]/. {cp -> 1/2, cth -> 1/2, sp -> Sqrt[3]/2, sth -> Sqrt [3]/2, d -> 1, a -> 3, c -> 1} (1521*x^4)/256 + (2229*y^2*x^2)/128 - (117*x^2)/4 + (3721*y^4)/256 - (183*y^2)/4 + 36 Now, this is clearly not the equation of an ellipse. We can see now the relationship between this and your original equation. With the above values of the parameters your equation takes the form: eq = d1 + d2 + 2*d - 2*a == 0 /. {cp -> 1/2, cth -> 1/2, sp -> Sqrt [3]/2, sth -> Sqrt[3]/2, d -> 1, a -> 3, c -> 1} Sqrt[(x - 5/4)^2 + (y - Sqrt[3]/4)^2 + 3/4] + Sqrt[(x + 5/4)^2 + (y + Sqrt[3]/4)^2 + 3/4] - 4 == 0 So now look at the graph: gr1=ContourPlot[ Sqrt[(x - 5/4)^2 + (y - Sqrt[3]/4)^2 + 3/4] + Sqrt[(x + 5/4)^2 + (y + Sqrt[3]/4)^2 + 3/4] - 4 == 0, {x, -5, 5}, {y, -5, 5}] Looks like a nice ellipse, right? Unfortunately it is only a part of the graph of w =First[v] gr2 = ContourPlot[Evaluate[w == 0], {x, -5, 5}, {y, -5, 5}] The picture is not quite convincing, because the latter contour plot is not very accurate but when you see them together: Show[gr1, gr2] the relationship becomes obvious. In any case, what you get a quartic curve that looks of course like an ellipse but isn't. Andrzej Kozlowski
- References:
- Re: Ellipse equation simplification on Mathematica:
- From: Narasimham <mathma18@hotmail.com>
- Re: Ellipse equation simplification on Mathematica:
- From: Narasimham <mathma18@hotmail.com>
- Re: Ellipse equation simplification on Mathematica: