subject
Computers and Technology, 10.04.2020 20:33 hfkdnd

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• 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 sqrt(x^2 + y^2) might look at math. hypot for this!, Question: Your Tasks is to Make a vector class. Provide the operators with documentation.__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 bothmagnitude # magnitude of the vector. One arg, self. Returns a float

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
question
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
Here are some of the operations you can perform on a vector.• vector addition. If V1 is (x, y) and V...
Questions
question
English, 22.07.2021 23:50
Questions on the website: 13722363