Write a function matrix_op(X, n, m) which takes the arguments 'X' (a number), 'n' (an integer...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function matrix_op(X, n, m) which takes the arguments 'X' (a number), 'n' (an integer greater than 1), and 'm' (an integer greater than 0), and constructs the matrices A and B of size n x n as below A₁ = 2(i + X) + 3(j - X), where i and j are the row and column indices (starting at zero). After calculating A and B, the function should return the matrix product B" A, where all the elements of the answer are rounded to two decimal digits. Hints: • Use np.around() for rounding. • You can assume that X will always be such that √j + X is real. B" should be understood as a matrix power. For instance, for m = 3, we have B³ = BBB, that is the matrix B multiplying itself 3 times (in terms of a matrix product, not element-wise). • For example: Test Result print (matrix_op(6, 2, 3)) [[414.19 163.24] [250.05 98.55]] print (matrix_op (2, 3, 2)) [[ 6.03 33.89 61.76] [2.51 11.06 19.61] [-1. -11.77 -22.54]] Answer: (penalty regime: 10, 20, 30, 40, 50, 60 %) Reset answer 1 import numpy as np 2 3 def matrix_op(X, n, m): 4 5 6 7 TIT B₁j=i-√√j+X, Returns the matrix B^m A as instructed. #your code here Precheck Check li Write a function matrix_op(X, n, m) which takes the arguments 'X' (a number), 'n' (an integer greater than 1), and 'm' (an integer greater than 0), and constructs the matrices A and B of size n x n as below A₁ = 2(i + X) + 3(j - X), where i and j are the row and column indices (starting at zero). After calculating A and B, the function should return the matrix product B" A, where all the elements of the answer are rounded to two decimal digits. Hints: • Use np.around() for rounding. • You can assume that X will always be such that √j + X is real. B" should be understood as a matrix power. For instance, for m = 3, we have B³ = BBB, that is the matrix B multiplying itself 3 times (in terms of a matrix product, not element-wise). • For example: Test Result print (matrix_op(6, 2, 3)) [[414.19 163.24] [250.05 98.55]] print (matrix_op (2, 3, 2)) [[ 6.03 33.89 61.76] [2.51 11.06 19.61] [-1. -11.77 -22.54]] Answer: (penalty regime: 10, 20, 30, 40, 50, 60 %) Reset answer 1 import numpy as np 2 3 def matrix_op(X, n, m): 4 5 6 7 TIT B₁j=i-√√j+X, Returns the matrix B^m A as instructed. #your code here Precheck Check li
Expert Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
This is a case about Marketing Analytics, so use your text on this topic as a benchmark for your responses. REMEMBER this case is not about pricing, promotion, social media, or advertising (which is...
-
Use the table below to find: (fog)(-10) = (fof) (11) = X -10 f(x) -1 g(x) 4 -1 -7 -4 -7 11 (gof)(-4)= (gog)(7) = 4 7 15 4 7 -4 11 -4 15 7 -1 15 -10 -7 -10 11
-
On Apr 5, 2021 Carter was in Omaha, Nebraska attending a seminar and was a guest at the Blue beiger Inn. At the end of the first day of the seminar, Carter took a swim in the motel's pool. Following...
-
Prepare journal entries to record each of the following sales transactions of TFC Merchandising. TFC uses a perpetual inventory system and the gross method. May 1 9 Sold merchandise for $600, with...
-
Solve Prob. 6.96 assuming that the 90-kip load has been removed. G, -7.2ft 3.6 t
-
(a) Graph the curve with parametric equations (b) Show that the curve lies on the hyperboloid of one sheet 144x 2 + 144y 2 25z 2 = 100. x = % sin 8t sin 18t 27 26 y = - cos 18t 27 26 cos 8t + 39 z...
-
Unless needed for screening purposes, why shouldn't demographic questions be asked up front in questionnaires?
-
1. What other management development approaches could the firm use to improve managerial skills other than I-MBA programs? 2. What criteria should the firm use to determine if it will pay for...
-
Please choose a green brand and develop and answer a report answering the following questions: 1) How do you see the green "sensibility" in their ads - analyze the message 2) Analyze the brand...
-
American Auto is evaluating their marketing plan for the sedans, SUVs, and trucks they produce. A TV ad featuring this SUV has been developed. The company estimates that each showing of this...
-
Solve the equation ln(2x - 1) = In (3x + 5)
-
Simplify: 49m6.
-
Simplify x + -5 x
-
How can organizations foster a culture of diversity, equity, and inclusion within teams, proactively addressing systemic biases and promoting equitable access to opportunities for professional growth...
-
How might the implementation of continuous feedback mechanisms and performance metrics, coupled with regular reflection sessions and developmental coaching interventions, facilitate ongoing learning...
-
Suppose 4 adults produce 125.6 lb of garbage in one week. At this rate, how many pounds will 50 adults produce in one week? 50 adults will produce lb of garbage in one week. 3
-
Define metagenesis or alternation of generation. Give example
-
Consider the function f and its graph. a. Estimate the zeros of the area function b. Estimate the points (if any) at which A has a local maximum or minimum. c. Sketch a graph of A, for 0 x 10,...
-
A sequence is bitonic if it monotonically increases and then monotonically decreases, or if by a circular shift it monotonically increases and then monotonically decreases. For example the sequences...
-
What does EXTENDED-EUCLID (F k+1, F k ) return? Prove your answer correct.
-
Suppose that a flow network G = (V, E) violates the assumption that the network contains a path s t for all vertices V. Let u be a vertex for which there is no path s u t. Show that there must...
-
The control volume shown in Figure \(P 2.15\) has steady, incompressible flow, and all properties are uniform at the inlet and outlet. For \(u_{1}=1.256 \mathrm{MJ} / \mathrm{kg}\) and...
-
(a) List the forces exerted on the spring-cart system of Figure 15.1 right after it is released, and draw a freebody diagram for each object in the system. (b) Which of these forces do work on the...
-
(a) In Figure 15.2e, the cart's displacement from the equilibrium position is maximum. Is the \(x\) component of the cart's acceleration at that instant positive, negative, or zero? (b) At which...
Study smarter with the SolutionInn App