Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

Explain how the sense of smell works.

Answered: 1 week ago