Question: Create a Python program that handles vectors. It should contain the following functions: Write a function add Vectors (v1, v2) that takes two lists of

Create a Python program that handles vectors. It should contain the following functions: Write a function add Vectors (v1, v2) that takes two lists of numbers of the same length, and returns a new list containing the sums of the corresponding elements of each. Example: new Vector = add Vectors ([1, 2], [3, 4]); print (new Vector) # output is [4, 6] Example: new Vector = add Vectors ([1, 2, 3], [4, 4, 4]) print (new Vector) # output is [5, 6, 7] Write a function scalar Mult (s, v) that takes a number, s, and a list, v and returns the scalar multiple of v by s. Example: new Vector = scalar Mult (10, [2, 3]); print (new Vector) #output is [20, 30] Example: new Vector = scalar Mult (10, [-2, 3]); print (new Vector) #output is [-20, 30] Write a function dot Product (v1, v2) that takes two lists of numbers of the same length, and returns the sum of the products of the corresponding elements of each (the dot product) Example: ans = dot Product ([10, 3, -6], [4, -2, -5] print (ans) #output is 64 Explanation of dot product: (10*4) + (3 * -2) + (-6 * -5) = 40 + -6 + 30 = 64 BONUS: Write a function cross_product (v1, v2) that takes two lists of numbers of length 3 and returns their cross product. Calculate it this way (source: http://www.mathsisfun.com/algebra/vectors-cross-product.html) When a and b start at the origin point (0, 0, 0), the Cross Product will end at: c_x = a_yb_z - a_zb_y c_y = a_zb_x - a_xb_z c_z = a_xb_y - a_yb_x Create a main program to test these functions. It should be menu-driven. Keep printing the menu and allowing the user to enter their choice until the user chooses the option to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!