Quiz 07 “Dot Product”

One usually learns this chapter in Physics, were we are suppose to get the dot product of two vectors to later get the magnitude of such vector. This can be calculated by multipling the axis values of the first vector with the corresponding axis value of the second vector. Example: V1[x1 , y1 , z1] & V2[x2 , y2 , z2]  then Dp = [x1*x2,y1*y2, z1*z2]. And then the Magnitude is calculated by the square root of  the sum of the values squared. Or something like that, I do not know, do not ask me how I am doing in physics.

knowledge

Why I am telling this? Because we have to make a program that does this for you of course! However, at the end, we are only going to calculate the sum of the Dot Product and not it’s magnitude, shame. Remember that you can check out Ken’s instructions with more precision in his TC101 blog post.

This was succesfully done by the use of two empty list that the user fills by using forin range and inputs inside that operation. After the two list are full, the program multiplies the content of the list by cardinality. Cardinality is used with the symble “[]” such as List1[Cardinality]. This means when cardinality = 1 then it will use the first value of list one and so on. We also had to make the use of conditionals since there is a possibility that the user has one list longer than the other. When that happens, there is a number that misses a pair from the other list to be multiplied by. In this case, the program returns ‘NaN’ which means ‘Not a Number’. This is how the program looks and runs, and remember to keep checking my Github since we

quiz07.png
Hey

writting bigger codes that may look incomplete in a screenshot.

quiz07.png

Now let’s talk about the song of the day. This one is called “Hey” by Pixies. Released in 1989 as part of Doolittle. This song may be two short for its awesomeness; however, it still lasts longer than most of Pixies’ songs. I’ve heard Pixies in different places during my lifetime, so it was just a matter of time where my curiosity made me search some of their songs.

Hey

CC BY-SA 4.0 Quiz 07 “Dot Product” by rhcpalmarichie is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.