Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

An ellipse degenerates into a line segment when the defining constant distance from the two foci is the actual distance between the two foci. The ellipse closes into a line segment.

The following code shows a family of concentric ellipses that should converge to a line segment when the constant is set to 5. However it doesn't plot the line segment even if I increase the MaxRecursion very high.

ContourPlot[Evaluate[Table[Sqrt[(x + 3)^2 + y^2] + Sqrt[x^2 + (y - 4)^2] == n, {n, 5, 
6, .01}]], {x, -4, 1}, {y, -1, 5}]

Is there someway to get Mathematica to actually plot the line segment of the degenerate case of an ellipse?

share|improve this question

marked as duplicate by Kuba, rm -rf Feb 6 at 21:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Epilog -> Line[{{-3, 0}, {0, 4}}] :) –  Kuba Feb 6 at 17:30
    
@Kuba That does work to draw a line segment. Thanks! So I guess Mathematica just can't recognize the degenerate case of the ellipse and I'll have to use that method in place instead? –  David Caliri Feb 6 at 18:12
1  
It's for the same reason as the problem in this question. –  Rahul Narain Feb 6 at 18:35

1 Answer 1

You can get an ellipse almost at the center, but you will need to increase the number of points in the plot:

ContourPlot[Evaluate[Table[
   Sqrt[(x + 3)^2 + y^2] + Sqrt[x^2 + (y - 4)^2] == n, 
   {n, 5.0001, 6, .1}]], {x, -4, 1}, {y, -1, 5}, PlotPoints -> 200]

enter image description here

It looks even more line-like if you decrease n to 5.00002 and increase PlotPoints to 600, though this dramatically increases the time required to draw the plot.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.