Question: 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.,

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)

Step by Step Solution

3.51 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import math import numpy import matplotlibpyplot as plt from scipy import l... View full answer

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 Programming Questions!