Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Intersection Ellipse & Circle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32524] Re: [mg32503] Intersection Ellipse & Circle
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Fri, 25 Jan 2002 02:57:56 -0500 (EST)
  • References: <200201241020.FAA06041@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Philipp Schramek wrote:
> 
> Hi
> I want to calculate the intersection of an Ellips ((x-c)^2/b^2 +
> (y-d)^2/a^2 ==1)which centre is at the point (c,d) and a Circle (x^2 +
> y^2 == 1) which centre is (0,0).
> I thought I might be able to solve this problem for any a!=0 && b!=0
> with Mathmatica 3. There should be 4 solutions.
> Therefore I did following calcuatlion:
> In[15]:= Eliminate[{y==Sqrt[1-x^2],((x-c)^2)/(b^2) + ((y-d)^2)/(a^2)
> ==1},y]
>                                  2
>    Out[15]= a != 0 && b != 0 && c  - 2 c x ==
> 
>               2    2  2         2  2      2             2
>          2   b    b  d     2   b  x    2 b  d Sqrt[1 - x ]
>   >     b  - -- - ----- - x  + ----- + -------------------
>               2     2            2              2
>              a     a            a              a
> 
>    In[16]:= Solve[%,x]
> 
>    Out[16]:= .....................
> My problem is that the solutions I got from Mathmatica are very very
> long and therefore far to long for me to use it as a analytical
> approach. In fact I was very suprised that there was not an easier
> solution. Even if I assume the special case b==1 the results were too
> long.I even tried to solve the problem defining the circle and the
> ellips by two angles:
> Eliminate[{Cos[x]==a*Cos[y]+c, Sin[x]==b*Sin[y]+d},y]
> But solving this result was even worse.
> 
> Does anyone has a suggestion how I could get a shorter result for my
> problem?
> 
> Thanks for you help
> Philipp


One thing to realize is you are getting solutions invloving symbolic
roots of quartics. These can be quite large and moreover are not
necessarily useful for plugging in numeric values after the fact (due to
instability). You can reduce to a more manageable size by forcing the
underlying Roots code to avoid the Cardano-Tartaglia formulas. The code
below indicates that most of the time is actually spent in messing with
the quartic formula so disabling it will save time as well as memory in
this case.

In[2]:= Timing[s1 = Solve[{(x-c)^2/b^2 + (y-d)^2/a^2 == 1, x^2 + y^2 ==
1}, {x,y}];]
Out[2]= {2.48 Second, Null}

In[3]:= LeafCount[s1]
Out[3]= 286345

In[4]:= SetOptions[Roots, Cubics->False, Quartics->False];

In[5]:= Timing[s2 = Solve[{(x-c)^2/b^2 + (y-d)^2/a^2 == 1, x^2 + y^2 ==
1}, {x,y}];]
Out[5]= {0.25 Second, Null}

In[6]:= LeafCount[s2]
Out[6]= 4809


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Change of Variables
  • Next by Date: Re: Intersection Ellipse & Circle
  • Previous by thread: Intersection Ellipse & Circle
  • Next by thread: Re: Re: Intersection Ellipse & Circle