Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

#1 2009-04-30 19:25:28

MathsIsFun
Administrator

Offline

Eccentricity and Conic Sections

Made an Eccentricity Graph that shows the transition from circle, through ellipse to hyperbola.

Only problem is at e=1 which is theoretically a parabola, but comes out as rubbish (I made it a line to cover up the problem) ... any suggestions?

I want people to easily see how the conic-sections are related to e.

Code for "a" and "b":

Code:

if (e < 1) {
    a = 1;
    b = Math.sqrt(( 1-e*e)*a*a);
} else {
    a = 1;
    b = Math.sqrt((-1+e*e)*a*a);
}

Which is then plotted by this code (in a loop with "t" going from 0 to 3):

Code:

if (e < 1) {
    xVal = a * Math.cos(t);
    yVal = b * Math.sin(t); 
} else if (e==1) {
    xVal = t;
    yVal = 0; 
} else {
    xVal = a / Math.cos(t);
    yVal = b * Math.tan(t); 
}

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman
 

#2 2009-04-30 21:17:45

mathsyperson
Moderator

Offline

Re: Eccentricity and Conic Sections

Nice toy!
The one bug I can see is that when you have 1<e<<2, the hyperbola turns into vertical lines at the graph's boundary when it should just disappear.


Why did the vector cross the road?
It wanted to be normal.
 

#3 2009-05-01 08:19:50

MathsIsFun
Administrator

Offline

Re: Eccentricity and Conic Sections

Thanks mathsy, yes I should mask that out.

Any ideas on how to illustrate the e=1 case?


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman
 

#4 2009-05-08 20:54:49

MathsIsFun
Administrator

Offline

Re: Eccentricity and Conic Sections

A new version, and I put it on Eccentricity


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman
 

Board footer

Powered by FluxBB