Results 1 to 4 of 4

Math Help - how this code calculates the dot product

  1. #1
    Newbie
    Joined
    Mar 2010
    Posts
    5

    Cool how this code calculates the dot product

    I'm having trouble understanding how this code calculates the dot product which I understand as |A||B|cos Ɵ
    Multiplying the cordinates together seems too easy
    /**
    * Calculates the dot product of this vector and another given vector.
    * @param v2 Another Vector2D instance.
    * @return Number The dot product of this vector and the one passed in as a parameter.
    */
    public function dotProd(v2:Vector2D):Number
    {
    return _x * v2.x + _y * v2.y;
    }
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Apr 2010
    Posts
    11

    Dot Product

    The Dot product can also be calculated by (the asterisk should be a dot):

    <x_1,x_2> * <y_1,y_2> = x_1y_1 + x_2y_2.

    Or for a nth dimensional vector space:

    <x_1,x_2,...,x_n> * <y_1,y_2,...,y_n> = \displaystyle\sum_{i=0}^{n}x_iy_i.

    Hope this helps, and what language is the code by the way. I've only programed in ADA
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2010
    Posts
    5
    actionscript 3
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Mar 2010
    Posts
    5
    That doesn't seem the same as

    Calculating the Dot Product In 2D
    Define your two vectors. Vector1 (x1, y1) and Vector2 (x2, y2).


    DotProduct = (x1*x2 + y1*y2)


    from
    Dot Product
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 6
    Last Post: September 7th 2010, 09:03 PM
  2. Code help
    Posted in the Discrete Math Forum
    Replies: 0
    Last Post: November 24th 2009, 09:42 AM
  3. multivariable differential for inner product(scalar product)?
    Posted in the Differential Geometry Forum
    Replies: 2
    Last Post: October 23rd 2009, 05:40 PM
  4. Replies: 4
    Last Post: September 2nd 2009, 04:07 AM
  5. Replies: 1
    Last Post: May 14th 2008, 11:31 AM

Search Tags


/mathhelpforum @mathhelpforum