Heeeeeellooooo people. And here I am, posting about the last quiz of this semester. I have to accept that I’m not a lover of the quizes buttt, they made me practice and learn a lot. In this quiz we had to make a program that calculates the dot product (or scalar product of vectors) for the numbers that the user choose.
First of all, What is the dot product?
A little explanation:
Scalar Product of Vectors
The scalar product and the vector product are the two ways of multiplying vectors which see the most application in physics and astronomy. The scalar product of two vectors can be constructed by taking the component of one vector in the direction of the other and multiplying it times the magnitude of the other vector. This can be expressed in the form:
If the vectors are expressed in terms of unit vectors i, j, and k along the x, y, and z directions, the scalar product can also be expressed in the form:
The scalar product is also called the “inner product” or the “dot product” in some mathematics texts.
So, we have to create two lists and the dot product has to multiply the N number of one list to the N number of the second list. It has to look like that:
LIST 1 LIST 2
1 x 6 =6
3 x 8
4 x 4 =16
And finally it has to add the results for all the dot product, in this case 46.
In the program we have to create the two lists using ARRAYS, FOR loops to get the addition of the results and with that you can get it.
Here the screenshots of my program:
And, it was a pleasure to show you my quizes, but that were all😀
DONT FORGET TO SEE MY CODES ON GITHUB DUDES:
Quiz 7 by eduardomoralesg is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.