Question: write a python program to input two vectors. compute and print their inner product as follows: given v1= and v2=, inner_product(v1,v2)=x1 x2+y1 y2+z1*z2. input each

write a python program to input two vectors. compute and print their inner product as follows:

given v1= and v2=, inner_product(v1,v2)=x1x2+y1y2+z1*z2.

input each vector using a single input statement (details in template), e.g.

enter x1,y1,z1 :: 1,2,3 enter x2,y2,z2 :: 4,5,6 

output a single line formatted to print the two input vectors and the inner product value. e.g.:

inner product of v1=[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)

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!