PDA

View Full Version : What kind of function...

tony873004
2007-Feb-10, 04:53 AM
What kind of function would give me a curve like this? It's like a sine wave, except it is fast at the bottom of the function.

http://orbitsimulator.com/BA/dft.GIF
This is a distance (from star) vs time graph of a planet in an eccentric orbit.

Captain Kidd
2007-Feb-10, 04:56 AM
absolute value of sin x?

tony873004
2007-Feb-10, 05:34 AM
good guess. It does look like that. I shouldn't have picked the most extreme example. Less eccentric orbits have rounder bottoms. Here's a graph showing different eccentricities from .8 (which is what the above graph is) down to 0 in steps of .2. Only one cycle is shown here. Is there anything else besides absolute value that could affect a sine wave this way.

http://orbitsimulator.com/PF/pft2.GIF

LucasVB
2007-Feb-10, 05:41 PM
Well, this was just a wild guess:

Where e is the eccentricity parameter.

Close enough. At least the shape looks right. Of course, you could find the exact function you want if you just analyze elliptical orbits and figure out the distance as a function of time. Sounds like a fun challenge

hhEb09'1
2007-Feb-10, 07:29 PM
Of course, you could find the exact function you want if you just analyze elliptical orbits and figure out the distance as a function of time. Sounds like a fun challengeWouldn't have to do it as a function of time--since the graph is a function of angle.

It's distance from the focus, so just take the ordinary x and y formula for ellipse, and plug in x = R cos(Θ) + C, and y = R sin(Θ), where C is the distance from the center to the focus. Solve for R. Have fun :)

grant hutchison
2007-Feb-10, 07:42 PM
Wouldn't have to do it as a function of time--since the graph is a function of angle.Good point. But Tony describes his first graph as "distance ... vs time". Tony, is it radius against time or radius against angle that you need? The former will get you embroiled in Kepler's equation as an extra step.

Grant Hutchison

tony873004
2007-Feb-10, 09:54 PM
Those aren't degrees on the x-axis. They're days and they go from 0 to 365, but since the labels cut off at 361, I guess it looks like degrees.

Degrees isn't what I want since the speed of the planet varies over the course of the orbit.

So probably the best way to express time would be a number from 0 to 1 times the orbital period. So in this case 0=0 and 1=365. d(0) would be distance, expressed as a fraction of sma, on day 0, d(365/2) the distance halfway through the orbit, and d(366) the same as d(0).

It's such a simple looking, and predictable curve. I don't have any trouble visualizing what the curve would be for ecc = 0.3. So it just made sense to me that there would be some simple formula to describe the curve, something like Lucas proposed.

grant hutchison
2007-Feb-10, 10:47 PM
I don't know how simple it's going to turn out to be ...
And because Kepler's equation is effectively a one-way valve, you'll be able to express time precisely as a "simple" function of radius, but not the other way around.

We can trickle backwards through the various anomalies. Eccentric anomaly E in terms of r is:

cosE = (a-r)/ae

Then there's Kepler's equation, linking mean anomaly M to E:

M = E - e.sinE

And (as I'm sure you know) M is directly proportional to time.

It would be interesting to see if it shakes down into anything vaguely "simple" :)

(Here (http://mathworld.wolfram.com/KeplersEquation.html) is more on the irreversibility of Kepler's equation.)

Grant Hutchison

hhEb09'1
2007-Feb-11, 03:24 AM
Those aren't degrees on the x-axis. They're days and they go from 0 to 365, but since the labels cut off at 361, I guess it looks like degrees.So this is Earth that you're playing with! :)

Just out of curiosity, what kind of code did you use to generate the curve?

tony873004
2007-Feb-11, 09:10 AM
So this is Earth that you're playing with! :)

Just out of curiosity, what kind of code did you use to generate the curve?

One of them is the Earth, kinda...

There are 5 planets in orbits with a semi-major axis of 1 AU, which gives them all periods of 1 year. But their eccentricities are different. You wouldn't want to live on the one I call p8 (for zero point 8 eccentricity). It gets closer to the Sun than Mercury, and further than Mars.

To generate the curve, I used a program I wrote called Gravity Simulator ( www.gravitysimulator.com ). It does n-body code to propogate the planets forward in time based on Newton's laws, and outputs the data into an Excel-readable text file at specified intervals.

For these graphs I created a simulation with a solar mass star, and 5 massless planets orbiting the star at 1 AU with eccentricities of 0.0 (Earth-like), 0.2, 0.4, 0.6 and 0.8. In the case of the top graph, I made it output the positions of the p8 planet at 2 day intervals for 6 years, and the bottom graph was all 5 planets at 1 day intervals for 1 year. In Excel I added the x, y, and z components of their positions using the Pothagorean theorem to calculate the distance. Then I graphed these columns.

The unreleased beta version is much nicer for outputing data than the version avaliable for download in the above link. If you'd like a copy pm me.

Delvo
2007-Feb-11, 01:20 PM
It's such a simple looking, and predictable curve. I don't have any trouble visualizing what the curve would be for ecc = 0.3. So it just made sense to me that there would be some simple formula to describe the curve, something like Lucas proposed.I just tested that equation and a few others in Excel. They don't work. Sine and cosine functions aren't the way to go, because you can either get waves that show compression/stretching within each iteration but also show it between one iteration and the next instead of repeating identically distorted waves, or get waves that are all the same with each iteration but show no such compression/stretching within a wave so the top and bottom concavities are mirror-images of each other. You get the latter by manipulating the results of the sine/cosine function, and the former by manipulating the variable that you're finding the sine/cosine of (or by manipulating both).

The graph has two features, complexity within a given iteration and repetition of results between iterations, that are incompatible with each other within the sine and cosine functions. What you need to do is apply them separately: get a function that explains one wave, and then make an infinite repeating series from that. (I know that it's instinctive to go for sine and cosine because they seem to incorporate both the individual-wave explanation and the repetition wrapped up in one function, but they're really the same thing I just said to do anyway, single-iteration functions to which we apply a repeating series separately, by the arbitrary convention of allowing values greater than 360° for the input variable. It's just so automatic by convention that we don't normally think about the fact that they don't inherently repeat and anything above 360° is just the
n=2 iteration of a function that we're applying repetition to ourselves, when we could just as justifiably have decided that input values above 360° are not valid and thus each function gets only one wave.)

Explaining just one iteration at a time also lets you derive the initial, one-iteration distance curve from the equation for the ellipse itself instead of completely separating from the original data with brand new ad hoc numbers, and you only have to explain the curve going concave once and convex once while the slope is always positive (or always negative if you start at the top). Repeating for later iterations of the series takes care of later waves for you.

So probably the best way to express time would be a number from 0 to 1 times the orbital period. So in this case 0=0 and 1=365. d(0) would be distance, expressed as a fraction of sma, on day 0, d(365/2) the distance halfway through the orbit, and d(366) the same as d(0).One nifty thing about this is the fact that it should make my suggestion easier to implement, by eliminating the need to convert between the input variable (degrees, days, "x", whatever) and an iteration count...