Question: I'm not sure how to solve this problem. the second photo is what we are given. please help and explain this. Thank you 3.21 Vector

3.21 Vector inner product Write a python program to input two vectors and compute and print their inner product as follows: given v1=(x1.y1.z1) and V2=(x2,92,z2), inner_product(v1,v2)=x1 * x2 + y1 *y2 + z1 * 22. Input each vectct using a single input statement (details in template), e.g. enter xl, yl, zl :: 1,2,3 enter x2, y2, 22 :: 4,5,6 output a single line formatted to print the two input vectors and the inner product value, eg.: inner product of vi-(1.0, 2.0, 3.0], v2-[4.0, 5.0, 6.0] is 32.0 what data structure is best suited to store each vector? why? note that for computing the inner product, python's numpy package can be used: import numpy inner_product=numpy.inner (v1, v2) print (inner_product) we will see more of numpy in later sections... 354042226160 main.py 1 # arc 12 30 2020 compute inner product between two vectors 2 3 # read the x,y,z coordinates of vector 1 4 # note that we read all 3 coordinates as a string, and then 5 # use the split function to separate them by the ',' 6 # the split function is a very useful function for string manipulation 7 # TODO - error handling 8 v1=input("enter x1, y1,z1 :: ").split(',') 9 # what is the data type of vi after line 7 executes? 10 # convert vi to a list of floats 11 v1=list(map(float, v1)) 12 # print(v1) # printf debug line 13 14 # repeat for v2 15 16 # compute inner product 17 18 # print v1, v2 and inner product using a 1 line formatted print statement 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
