Marie D.

asked • 06/08/21

Python Problem 70

Use Python:

Define the following vectors and matrices:


vec1 = np.array([ -1., 4., -9.])

mat1 = np.array([[ 1., 3., 5.], [7., -9., 2.], [4., 6., 8. ]]


1. You can multiply vectors by constants. Compute


vec2 = (np.pi/4) * vec1


2. The cosine function can be applied to a vector to yield a vector of cosines.

Compute

vec2 = np.cos( vec2 )


3. You can add vectors and multiply by scalars. Compute


vec3 = vec1 + 2 * vec2


4. The Euclidean norm of a matrix or a vector is available using la.norm.

Compute


la.norm(vec3)


5. You can do row-column matrix multiplication. Compute the product of

mat1 and vec3 and set vec4 equal to the result.


6. Compute the transpose of mat1.


7. Compute the determinant of mat1.


8. Compute the trace of mat1.


9. Find the smallest element in vec1.



1 Expert Answer

By:

Jonathan S. answered • 02/20/23

Tutor
5 (3)

Experienced Math Educator and Former Google Software Engineer

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.