Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Vector confusion

  1. Jul 10, 2006 #1


    User Avatar
    Science Advisor
    Gold Member

    I'm trying to compute Mean Anomoly. Mean Anomoly is an angle that describes where in an orbit an object is relative to its periapsis. The formula according to Wikipedia is

    M = E - e \cdot \sin E
    where e is eccentricity (which I know), and E is Eccentric Anomoly.

    According to Wikipedia, Eccentric Anomoly is
    E = \arccos \frac{{1 - \left| r \right|/a}}{e}
    where a is Semi-Major Axis (which I know), e is eccentricity (which I know), and r is an orbiting body's position vector. If I solve for r, I'm home free.

    According to Wikipedia, The orbital position vector r is a cartesian vector describing the position of the orbiting body. Wouldn't that mean that r would be express as something like 1.0i + 2.0j+3.0k? But I can't plug something like that into the formula for Eccentric Anomoly. I could use Pothagorean Theorum to solve for distance and use this number. But that turns the vector into a scalar, and I doubt that's the right way to do it. Direction is pretty important here.

    I know the object's x, y, and z position wrt the reference frame. How do I turn r into something I can use in these formulas?
  2. jcsd
  3. Jul 10, 2006 #2
    The formula involves only the modulus of the vector r, doesn't it?
  4. Jul 10, 2006 #3


    User Avatar
    Science Advisor
    Gold Member

    Modulus = absolute value??

    In my example with 1.0i + 2.0j + 3.0k, I could do r=sqrt(1^2+2^2+3^2). But there are two points on the orbit that would have this same value for r. So I wouldn't know which one I computed.
  5. Jul 10, 2006 #4

    IIRC, you are the author of an orbit simulation program, right? I'm a [exaggeration]novice[/exaggeration] when it comes at programming, so I don't understand the exact nature of your problem. Sorry. :redface:
    Last edited: Jul 10, 2006
  6. Jul 10, 2006 #5


    User Avatar
    Science Advisor
    Gold Member

    Yes :biggrin: . And if you use the program, you'll notice on the orbital elements box I leave out Mean Anomoly, simply because I don't get it right. I see many references that give the same formulas as Wikipedia for Mean Anomoly. And they all have the variable r in them. r is a vector, not a scalar, which is why I'm confused as to how to turn an x,y,& z position into a single number that I can assign to r that conveys both distance and direction. From physics classes, I remember that any answer that is a vector is stated as a scalar plus either an angle, or with the ijk-hat method. But of course any programming language doesn't want to see hats in the code. And E=Arcos((1-ABS(15, northwest)/a)/(e)) will generate a syntax error.

    Thanks for your help thus far :smile:
  7. Jul 10, 2006 #6
    I have used your program before, and had fun generating all those patterns. :biggrin: But to fully appreciate a program such as this, I think I will need a decent understanding of celestial mechancis (I know it's not a necessity, but still I prefer it that way :) ). Keep up the good work, and I hope you get this problem solved.
  8. Jul 10, 2006 #7
    I could be wrong here, because I have no clue about oribtal mechanics (if that's what it's called :smile:)

    But, maybe this will help:
    So you are trying to calculuate [itex] E [/itex]

    Defined by the following:

    [tex] E = cos^{-1} \frac{1-\frac{| \vec r |}{a}}{e}[/tex]

    Looking up the definition of [itex] r [/itex] and [itex] e [/itex] we have:

    Orbital Postion Vector:
    [itex] \vec r [/itex]

    Since you are taking the modulus of this, you will return a scaler:
    ie) [tex] | \vec r | = \sqrt{x^2+y^2+z^2} [/tex]

    This is the length of the vector. So assuming my geometry is correct (I haven't really worked with ellipses), you will have at least two spots where [tex] | \vec r | [/tex] can be equal. For example if the ellipse was on 2d plane.

    [tex] | \vec r_1 | = |\vec r_2 | [/tex]
    [tex] \vec r_1 = (a,0,0) [/tex]
    [tex] \vec r_2 = (-a,0,0) [/tex]

    However, you are worried about a point on an ellipse, so you need some more information to make the angle unique (since [itex] \vec r [/itex] by itself is not doing it).

    Now if we look at [itex] e [/itex],

    Orbital Eccentricity
    ([itex] e [/itex])

    [tex] e = | \vec e | [/tex]

    Eccentricity Vector ([tex] \vec e [/tex])

    [tex] \vec e = \frac{\vec v \times \vec h}{\vec \mu}-\frac{\vec r}{| \vec r |} [/tex]
    [tex] \vec v = [/tex] orbital velocity vector
    [tex] \vec h = [/tex] orbital angular momentum
    [tex] \vec r = [/tex] orbital position vector
    [tex] \vec \mu = [/tex] standard gravitational parameter

    It would seem that at the point in question, [itex] \vec v [/itex] would be unique, thus causing [itex] e = | \vec e | [/itex] to be the unique quanitity that is dependent on position.

    :blushing: Like I said, I could be way off here.

    EDIT: I don't know what's up with the LaTeX... I guess I have an error somewhere. I hope this is somewhat readable.
    Last edited: Jul 10, 2006
  9. Jul 10, 2006 #8


    User Avatar
    Science Advisor
    Gold Member

    The LaTeX is fine. It doesn't work in preview mode though. Thanks. I think I'm getting a grip on it now. Using
    [tex] | \vec r | = \sqrt{x^2+y^2+z^2} [/tex]

    I'm getting good results. But I would expect the angle to increase from 0 to 2pi over the course of an orbit. Instead, it increases from 0 to pi and then back to 0. If I subtract this angle from 2pi anytime the object is in the 3rd or 4th quadrant (negative y value), then all is well.

    It just seems from the referenced formulas that this type of a piecewise answer is not necessary. But since taking the absolute value of the vector will yield the same answer for two different positions, I guess it is.

    One silly mistake I was making was forgetting that the angle is measured from periapsis (closest point) rather than as a longitude (angle from a fixed direction, usually the Vernal equinox). But in a circular orbit, where the only hint of eccentricity comes 5 places to the right of the decimal, this point is not well defined and it drifts all over the place, causing Mean Anomoly to do the same. Once given a little eccentricity, things begin to work a lot better.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Vector confusion
  1. Vector Confusion (Replies: 4)

  2. Unit Vector Confusion (Replies: 5)

  3. Exponent confusion. (Replies: 2)