Math thread, let's share and discuss interesting math. Did you know that a dot product can be used to calculate the angle between vectors as well as calculate the projection of one vector onto another. This is particularly useful in computer graphics and physics.
>>16474310>Did you know that a dot product can be used to calculate the angle between vectors as well as calculate the projection of one vector onto another.No, how so
>>16474354a⋅b=∥a∥∥b∥cosθ = a1b1+a2b2This extends into 3 or more dimensions, pretty neat!
>>16474374Whats the dot, what's the product?
>>16474310>as well as calculate the projection of one vector onto another.Whats that mean
>>16474774if you look at the picture it's projecting a along b, so for instance if you wanted to know the intensity light was hitting a surface at you could project the direction of the light source onto the surface normal and use the result as part of the calculation to color the fragment
>>16474310Yes in high school we learnt that
>>16475053not every vectorspace comes equipped with an inner product
>>16475105At this level noone knows what a vector space is
>>16475067>>16475117wow i guess my math isn't advanced enough for you. you must be really smart
>>16474310Now explain why you can compute that by doing pic related
>>16475215start with law of brosines[math]\| \vec{b} - \vec{a} \|^2 = \|\vec{a}\|^2 + \|\vec{b}\|^2 - 2 \| \vec{a}\| \|\vec{b}\| \cos \theta [/math]expand dong on left side[math]\| \vec{b} - \vec{a} \|^2 = \sum_i [b_i - a_i]^2 = \sum_i b_i^2 - 2 \sum_i a_i b_i + \sum_i a_i^2 = \|\vec{b}\|^2 - 2 \sum_i a_i b_i + \|\vec{a}\|^2[/math]forcefully insert imto first equation and cancel terms to get[math]\sum_i a_i b_i = \|\vec{a}\| \|\vec{b}\| \cos \theta[/math]define dot product as[math]\vec{a} \cdot \vec{b} \equiv \|\vec{a}\|\|\vec{b}\|\cos\theta[/math]
>>16474310You need to take the arccosine to find the angle, which can be a slow computation. Might be more efficient to express angles as rotation matrices instead, depends on your application.
>>16475105When you work with computer graphics you can generally impose a euclidean metric, which generates an inner product at every point in the space.
retard here: What is the simplest way to obtain the golden ratio? I mean, plotting and all that.
>>16474310There is a more general version of the dot product called the "inner product" that takes in 2 arbitrary objects and returns a number. It can let you write an arbitrary object as a linear combination of other arbitrary objects. for instance you can derive fourier series very easily using the inner product for functions, where you essentially treat functions like vectors. the following video explains the motivation of the inner product, although you may want to start on the video before in the playlist for context. https://www.youtube.com/watch?v=ZXOzKHq3-YA&list=PLlXfTHzgMRULZfrNCrrJ7xDcTjGr633mm&index=5
>>16478248>arbitrary objectsWell, they still have to be elements of the same vector space