Write a program named vector_math.py that lets a user enter two vectors, A and B, of the same arbitrary length and store each vector
Write a program named vector_math.py that lets a user enter two vectors, A and B, of the same arbitrary length and store each vector as a Python list. Have the user enter each vector in one line with spaces between elements. Then, you should output the results of these computations using the format shown below. Print any resulting lists to include [] and,. The magnitude of vector A and the magnitude of vector B printed to five (5) decimal places A + B A-B The dot product (inner product) of A and B printed to two (2) decimal places Note: You should use lists (and loops) when solving this problem. You may NOT use sympy or numpy. Later we will see some other ways to work with vectors more directly. Example output using vectors A = [1, 2, 3] and B = [4, 5, 6]: Enter the elements for vector A: 1 2 3 Enter the elements for vector B: 4 5 6 The magnitude of vector A is 3.74166 The magnitude of vector B is 8.77496 A + B is [5.0, 7.0, 9.0] A - Bis [-3.0, -3.0, -3.0] The dot product is 32.00
Step by Step Solution
3.45 Rating (161 Votes )
There are 3 Steps involved in it
Step: 1
Heres a Python program named vectormathpy that performs the specified operations python import math ...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started