Results 1 to 14 of 14

Math Help - vector questions

  1. #1
    Newbie
    Joined
    Jul 2006
    Posts
    9

    vector questions

    Hi all. 1st post here. I've got a math question. I hope this is the right sub-forum. This is not homework, just stuff I like to work on. This question deals with celestial mechanics. But don't worry if you know nothing about celestial mechanics. It's the math that's bothering me.

    To compute the eccentric vector, ( http://en.wikipedia.org/wiki/Eccentricity_vector ) the following formula is used:

    <br />
e = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r - \left( {r \cdot v} \right)v} \right]<br />

    It looks pretty straightforward. If I know v, mu, and r, I should just be able to plug in and solve for e.

    I do know mu. However, v and r are vectors. What I do know is the x, y, and z components of both v and r. And where r is in absolute value brackets, I believe can just do
    <br />
r = \sqrt {x_r^2  + y_r^2  + z_r^2 } <br />

    But where the vectors are not in absolute value brackets, I don't know what to do. I can't punch \hat i,\hat j,\hat k
    into my calculator.

    Similarly, in the formula for Eccentric anomoly ( http://en.wikipedia.org/wiki/Eccentric_anomaly ):
    <br />
E = \cos ^{ - 1} \frac{{1 - \left| r \right|/a}}{e}<br />
    r is a vector. It represents distance. Taking its absolute value will give me the same answer for 2 different points on an orbit. But every point on the orbit should have a unique Eccentric anomoly.

    I've never had a math class that dealt with vectors in equations like this. Any idea how I should treat them?

    Thanks.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Global Moderator

    Joined
    Nov 2005
    From
    New York City
    Posts
    10,616
    Thanks
    9
    Quote Originally Posted by tony873004
    I do know mu. However, v and r are vectors. What I do know is the x, y, and z components of both v and r. And where r is in absolute value brackets, I believe can just do
    <br />
r = \sqrt {x_r^2  + y_r^2  + z_r^2 } <br />
    You probably mean,
    |r|=\sqrt {x_r^2  + y_r^2  + z_r^2 }
    So what is the problem?

    Quote Originally Posted by tony873004
    <br />
E = \cos ^{ - 1} \frac{{1 - \left| r \right|/a}}{e}<br />
    r is a vector. It represents distance. Taking its absolute value will give me the same answer for 2 different points on an orbit. But every point on the orbit should have a unique Eccentric anomoly.
    How?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tony873004
    Hi all. 1st post here. I've got a math question. I hope this is the right sub-forum. This is not homework, just stuff I like to work on. This question deals with celestial mechanics. But don't worry if you know nothing about celestial mechanics. It's the math that's bothering me.

    To compute the eccentric vector, ( http://en.wikipedia.org/wiki/Eccentricity_vector ) the following formula is used:

    <br />
e = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r - \left( {r \cdot v} \right)v} \right]<br />
    <br />
v^2=v_x^2+v_y^2+v_z^2<br />
,

    where v=[v_x,v_y,v_z], and:

    <br />
r \cdot v=r_x v_x+r_y v_y+r_z v_z<br />

    is the dot product of v and r where r=[r_x,r_y,r_z], and:

    <br />
|r|=\sqrt {r_x^2 + r_y^2 + r_z^2 }<br />
.

    Then:

    <br />
e_x = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_x - \left( {r \cdot v} \right)v_x} \right]<br />

    <br />
e_y = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_y - \left( {r \cdot v} \right)v_y} \right]<br />

    <br />
e_z = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_z - \left( {r \cdot v} \right)v_z} \right]<br />

    where e=[e_x,e_y,e_z]

    RonL
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Jul 2006
    Posts
    9
    Quote Originally Posted by ThePerfectHacker
    You probably mean,
    |r|=\sqrt {x_r^2  + y_r^2  + z_r^2 }
    So what is the problem?


    How?
    Quote Originally Posted by ThePerfectHacker
    You probably mean,
    |r|=\sqrt {x_r^2  + y_r^2  + z_r^2 }
    So what is the problem?


    How?
    Yes, that's what I meant. The problem is that r appears both in and out of abs brackets in the formula
    <br />
e = \frac{1}{\mu }\left[ {\left( {v^2 - \frac{\mu }{{\left| r \right|}}} \right)r - \left( {r \cdot v} \right)v} \right]<br />
    and v, also a vector, appears only out of brackets. So, for example, if an object had a position of:
    x=1 m
    y=2
    z=3

    and a velocity of
    x=0.1 m/s
    y=0.2
    z=0.3

    and mu = 1.3E20 (mu is G, the gravitational constant times mass of the object being orbited)

    I'd have:

    <br />
\begin{array}{l}<br />
 e = \frac{1}{{1.3 \times 10^{20} }}\left[ {\left( {\left( {0.1\hat i + 0.2\hat j + 0.3\hat k} \right)^2  - \frac{{1.3 \times 10^{20} }}{{\sqrt {x_r^2  + y_r^2  + z_r^2 } }}} \right)1\hat i + 2\hat j + 3\hat k - \left( {1\hat i + 2\hat j + 3\hat k \cdot 0.1\hat i + 0.2\hat j + 0.3\hat k} \right)0.1\hat i + 0.2\hat j + 0.3\hat k} \right] \\ <br />
  \\ <br />
 \end{array}<br />

    and I don't know how to translate that into a line of computer code

    e=(1/1.3e20)*((?)^2-(1.3e20)/(sqrt(rx^2+ry^2+rz^2))*(?)-?*?

    or even punch it into my calculator. (Because of the hats ).

    How?
    I don't understand what "how?" refers to.

    btw. nice sig:
    1. Blue screen of death is easy
    3. I know VB better than English.
    5. I hate dynamic IPs or I'd have that too
    7. Yes
    9. well... 60
    10. Tried once, failed and gave up.

    ** edit
    Sorry latex is too long. I just put my x,y&z values with i,j,k hats in place of the non |vectors|
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jul 2006
    Posts
    9
    Quote Originally Posted by CaptainBlack
    <br />
v^2=v_x^2+v_y^2+v_z^2<br />
,

    where v=[v_x,v_y,v_z], and:

    <br />
r \cdot v=r_x v_x+r_y v_y+r_z v_z<br />

    is the dot product of v and r where r=[r_x,r_y,r_z], and:

    <br />
|r|=\sqrt {r_x^2 + r_y^2 + r_z^2 }<br />
.

    Then:

    <br />
e_x = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_x - \left( {r \cdot v} \right)v_x} \right]<br />

    <br />
e_y = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_y - \left( {r \cdot v} \right)v_y} \right]<br />

    <br />
e_z = \frac{1}{\mu }\left[ {\left( {v^2  - \frac{\mu }{{\left| r \right|}}} \right)r_z - \left( {r \cdot v} \right)v_z} \right]<br />

    where e=[e_x,e_y,e_z]

    RonL
    This looks good. Give me a few minutes to digest it. Ultimately, I'm after |e|, but that would just be pothagin' e I think.

    ** edit. Maybe more than a few minutes. I've got to find my old Physics book. I know we did dot products. No need to ask you to explain further since my book has this. I'll post tommorow, either thanking you, or asking you more q's.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Jul 2006
    Posts
    9
    I can only find 2-d examples of dot products.

    A*B = AxBx+AyBy

    Would I be correct to assume that:

    A*B*C = AxBxCx+AyByCy ?
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tony873004
    I can only find 2-d examples of dot products.

    A*B = AxBx+AyBy
    My earlier reply gave a definition of the dot product for 3-vectors,
    in general for N-vectors:

    <br />
\bold{a} \cdot \bold{b}=\sum_{i=1}^N a_ib_i<br />
,

    where \bold{a}=[a_1,a_2,\ ..\ ,a_n] and \bold{b}=[b_1,b_2,\ ..\ ,b_n]

    Would I be correct to assume that:

    A*B*C = AxBxCx+AyByCy ?
    No, this would be a triple dot or scalar product of some sort, which is not commonly used
    and to use a notation like \bold{a}\cdot \bold{b} \cdot \bold{c} for this would be a confusing abuse of notation.


    RonL
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Jul 2006
    Posts
    9
    So...

    A*B = AxBx+AyBy+AzBz

    ??
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jul 2006
    Posts
    9
    Quote Originally Posted by CaptainBlack
    My earlier reply gave a definition of the dot product for 3-vectors
    Sorry, I overlooked that. You did give it.

    If I'm understanding this correctly, I'd like to get rid of all r's and v's in the equation, replacing them with rx, ry, rz, vx, vy, vz so I can plug in the actual values.

    So solving for ex should look like:


    But I suspect I made a mistake somewhere because:
    Code:
    'Visual Basic 6.0
    'where mu=   1.32673637E+20 (mks units)
    '      Rx = -46720169584.3259 m
    '      Ry =  115742152531.547
    '      Rz =  0
    '      Vx =  -30938.7102458567 m/s
    '      Vy = -16802.9119738538
    
    
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rx - (Rx * Vx + Ry * Vy + Rz * Vz) * Vx)
    Ey = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Ry - (Rx * Vx + Ry * Vy + Rz * Vz) * Vy)
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rz - (Rx * Vx + Ry * Vy + Rz * Vz) * Vz)
    
    EccentricityVector = Sqr(Ex ^ 2 + Ey ^ 2 + Ez ^ 2)
    Eccentricity = Abs(EccentricityVector)
    'I should get Eccentricity = 0.2
    'Instead, I get Eccentricity = 9.08106826571385E-02
    Did I make a dumb mistake somewhere?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tony873004
    So...

    A*B = AxBx+AyBy+AzBz

    ??
    Yes
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by tony873004
    Sorry, I overlooked that. You did give it.

    If I'm understanding this correctly, I'd like to get rid of all r's and v's in the equation, replacing them with rx, ry, rz, vx, vy, vz so I can plug in the actual values.

    So solving for ex should look like:


    But I suspect I made a mistake somewhere because:
    Code:
    'Visual Basic 6.0
    'where mu=   1.32673637E+20 (mks units)
    '      Rx = -46720169584.3259 m
    '      Ry =  115742152531.547
    '      Rz =  0
    '      Vx =  -30938.7102458567 m/s
    '      Vy = -16802.9119738538
    
    
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rx - (Rx * Vx + Ry * Vy + Rz * Vz) * Vx)
    Ey = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Ry - (Rx * Vx + Ry * Vy + Rz * Vz) * Vy)
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rz - (Rx * Vx + Ry * Vy + Rz * Vz) * Vz)
    
    EccentricityVector = Sqr(Ex ^ 2 + Ey ^ 2 + Ez ^ 2)
    Eccentricity = Abs(EccentricityVector)
    'I should get Eccentricity = 0.2
    'Instead, I get Eccentricity = 9.08106826571385E-02
    Did I make a dumb mistake somewhere?
    Your code looks OK to me. Works OK for me:


    I assume Vz=0, is that right?


    Code:
    >..Euler console session:
    >
    >..Define R
    >..-------
    >R=[-46720169584.3259,115742152531.547,0]
     -4.67202e+10   1.15742e+11             0 
    >
    >..Define V
    >..-------
    >V=[-30938.7102458567,-16802.9119738538,0]
         -30938.7      -16802.9             0 
    >
    >..Define mu
    >..---------
    >mu=1.32673637E+20
      1.32674e+20 
    >
    >
    >..compute e
    >..----------
    >e=1/mu*((V.V'-mu/(sqrt(R.R')))*R-(R.V')*V)
        -0.178628     0.0908107             0 
    >
    >sqrt(e.e')
         0.200386 
    >
    So either your code has a error in it (I cant see it) )or there is a loss of
    precission somewhere. What is the default floating type in VB? Is
    it a double (64bit) or single(32bit)?

    RonL
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Senior Member
    Joined
    Apr 2006
    Posts
    399
    Awards
    1
    Quote Originally Posted by tony873004
    Sorry, I overlooked that. You did give it.

    If I'm understanding this correctly, I'd like to get rid of all r's and v's in the equation, replacing them with rx, ry, rz, vx, vy, vz so I can plug in the actual values.

    So solving for ex should look like:


    But I suspect I made a mistake somewhere because:
    Code:
    'Visual Basic 6.0
    'where mu=   1.32673637E+20 (mks units)
    '      Rx = -46720169584.3259 m
    '      Ry =  115742152531.547
    '      Rz =  0
    '      Vx =  -30938.7102458567 m/s
    '      Vy = -16802.9119738538
    
    
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rx - (Rx * Vx + Ry * Vy + Rz * Vz) * Vx)
    Ey = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Ry - (Rx * Vx + Ry * Vy + Rz * Vz) * Vy)
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rz - (Rx * Vx + Ry * Vy + Rz * Vz) * Vz)
    
    EccentricityVector = Sqr(Ex ^ 2 + Ey ^ 2 + Ez ^ 2)
    Eccentricity = Abs(EccentricityVector)
    'I should get Eccentricity = 0.2
    'Instead, I get Eccentricity = 9.08106826571385E-02
    Did I make a dumb mistake somewhere?
    There are two equations for Ex. The second one should be for Ez.

    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rx - (Rx * Vx + Ry * Vy + Rz * Vz) * Vx)
    Ey = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Ry - (Rx * Vx + Ry * Vy + Rz * Vz) * Vy)
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rz - (Rx * Vx + Ry * Vy + Rz * Vz) * Vz)
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by JakeD
    There are two equations for Ex. The second one should be for Ez.

    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rx - (Rx * Vx + Ry * Vy + Rz * Vz) * Vx)
    Ey = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Ry - (Rx * Vx + Ry * Vy + Rz * Vz) * Vy)
    Ex = (1 / mu) * ((Vx ^ 2 + Vy ^ 2 + Vz ^ 2 - (mu / Sqr(Rx ^ 2 + Ry ^ 2 + Rz ^ 2))) * Rz - (Rx * Vx + Ry * Vy + Rz * Vz) * Vz)
    That would explain the result nicely, as Ez is not not assigned and VB sets
    it by default to 0, Ex is reset to what Ez shoud have been (which is 0), so
    Ecentricity will be |Ey|=0.0908107

    RonL
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Newbie
    Joined
    Jul 2006
    Posts
    9
    Vz is 0. The program actually pulls them from text boxes, not the commented lines. All variables are "Dim as Double"

    After fixing the typo Jake found, it works for me now too, both for the input shown, and other input with known output that I've tested it against.

    Thanks, Captain Black . There's more orbital elements I want to compute, and thanks to you, my new understanding of vectors will come in handy.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. More Vector Questions
    Posted in the Algebra Forum
    Replies: 8
    Last Post: January 21st 2010, 06:34 PM
  2. Vector Questions
    Posted in the Geometry Forum
    Replies: 2
    Last Post: May 24th 2009, 02:26 PM
  3. vector questions
    Posted in the Pre-Calculus Forum
    Replies: 0
    Last Post: May 15th 2009, 10:17 AM
  4. vector questions
    Posted in the Pre-Calculus Forum
    Replies: 0
    Last Post: February 16th 2009, 04:41 PM
  5. vector questions
    Posted in the Calculus Forum
    Replies: 1
    Last Post: April 9th 2008, 12:28 AM

Search Tags


/mathhelpforum @mathhelpforum