Question: a) Write a function called combo( ) that takes in P , Q , a , b . The variables P and Q are 2D

 a) Write a function called combo( ) that takes in P

a) Write a function called combo( ) that takes in P , Q , a , b . The variables P and Q are 2D NumPy arrays, and a and b are scalars. combo( ) should compute and return the following nonlinear combination: R = aP3 + bQ3. i.e. Rij = an + 12%. - You need to make sure that matrices P and Q have the same dimensions, and if they do not, then return a number 0. . You must use |oop(s) to perform the calculation and cannot use any built in Python commands or vectorization (i .e. colon notation for additions). En [ ]: import numpy as up b) Using the above function, calculate 2X 3 + 3Y3 where X, Y are given below and store the result in matrix 2. En [ ]: X = np.array([[49,5],[8,10]]) Y = np.array([[3,42],[48,31]) # Type in solution here Z = 0 print(Z)

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