GWU Making a 2D Vector Class Phyton Program File You should make sure that the code is running correct and include commentsRubric – Code runs, is fully tes

GWU Making a 2D Vector Class Phyton Program File You should make sure that the code is running correct and include commentsRubric – Code runs, is fully tested, and includes sufficient comments and supporting documentationI will attach you the assignment instruction below. Assignment 3
The Problem
We are going to experiment with making our own class. We are going to make a 2D vector
class.
Some Background
Here is a little background on two-dimensional vectors. A vector is basically an arrow that has a
magnitude (a length) and a direction (an angle with respect to typically the x axis). It usually is
represented as an x,y pair, where the origin of the vector is a 0,0 and the end of the vector is at
the listed pair.
x,y
V+W
V+W
W
V
0,0
A vector
V+W
V+V=2*V
W
V
V-W
-W
V*2
Here are some of the operations you can perform on a vector.

Vector Addition: If V1 is (x,y) and V2 is (a,b), the V+W is (x+a,y+b), a vector

Vector Multiplication by a scalar. if V1 is (x,y), the V*n is (x*n,y*n), a vector

Vector Subtraction V-W is the same as V+(W*-1), a vector (note that this definition
uses addition and multiplication).

Vector Multiplication with another vector. There are two possibilities, dot product or
cross product. We’ll do dot product. If V=(x,y) and W=(a,b), then V*W = x*a + y*b, a
scalar. Thus, the dot product yields a scalar, not a vector

Vector Magnitude. The magnitude based on the Pythagorean theorem for a V=(x,y)
says that the magnitude is ! # + # . You might look at math.hypot for this.
Your Tasks
Make a vector class. Provide the operators
__init__
# constructor, takes 3 args: self,x,y . No return
__str__
# for printing, takes 1 arg self. Returns a string
__add__
# vector + vector. Takes 2 args, self and vector. Returns a new vector
__sub__
# vector – vector. Takes 2 args, self and vector. Returns a new vector
__mul__
# two possibilities. vector*integer or vector*vector (dot product). Get it to do
just one of # the two at first, then see if you can use introspection to do both
magnitude() # magnitude of the vector. One arg, self. Returns a float

Purchase answer to see full
attachment

Don't use plagiarized sources. Get Your Custom Essay on
GWU Making a 2D Vector Class Phyton Program File You should make sure that the code is running correct and include commentsRubric – Code runs, is fully tes
Just from $13/Page
Order Essay
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.