Question: this is for my python programming course eerorth be in force. 1. Assume vectors x and y are stored as lists of floats. In the

 this is for my python programming course eerorth be in force.1. Assume vectors x and y are stored as lists of floats.

In the module file, define functions that compute def sum (x,y): the

this is for my python programming course

eerorth be in force. 1. Assume vectors x and y are stored as lists of floats. In the module file, define functions that compute def sum (x,y): the sum of two vectors def diff(x, y): the difference of two vectors (i.e. x -y) def scale (c, x): scalar multiplication def 1incomb (x1, x2, x3,..., cl, c2, c3,...): t turning he linear combination of vectors re- Here the function accepts variable length parameters. def dot (x, y): the dot product def proj(x,y): the projection of x onto y. def perp (x, y) : the perpendicular part of x to y (i.e. ,#x-Prolyx.) def refl (x, y): the reflection of x across the line/plane perpendicular to y. def angle(x,y, s): the angle between x and y. The optional parameter s allows the user to output the angle in radians 'r' or degrees 'd', or not specify which and get the default. Here you will need math.acos to compute arccos. You receive extra credit for implementing your own version of arccos. Make sure to include a docstring with each of the above, explaining the function's purpose and imple- mentation details. For example def sum (x,y): """Returns the sum of two vectors. x and y are lists of floats representing vectors of the same length. Uses list comprehension (as should you!)." return t xi + yi for (xi,yi) in zip(x, y) We see the docstring by calling >>help (sum). tto narh funetion Instructions: Solve using the Python programming language. Submit two files-a module and a script-with the names LastNameFirstName.Lab 3mod.py LastNameFirstName Lab3scr.py The module contains the function definitions of this lab, as described below. The script imports the module, and illustrates the functions with examples. Remember, you can always use import LastNameFirstName.Lab3mod as vec to shorten names, for example We see the docstring by calling >>>nelp (sum) . 2. In your script file, import the module containing the above function definitions. Illustrate each function, preferably in the above order, by meaningful examples. (Examples that use only two-dimensional vectors would be least meaningful.) You receive extra credit for illustrating your functions proj, perp, refl with two-dimensional (or three-dimensional!) plots

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!