Consider the following matrix with 4 rows (rows 1 to 4) and 4 columns (columns 1...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following matrix with 4 rows (rows 1 to 4) and 4 columns (columns 1 to 4) x = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (a) Create a Python array from the matrix above. What are the dimension and shape of x? (b) Using the array created in the question just above, provide a SINGLE com- mand to produce the following arrays and print your results (Hint: try to solve them without using a computer and then use Python to validate your results): i. select the third column of ii. extract the first and second elements of the last row of x. (Note: the command should include negative slicing) iii. select first and last columns of a using boolean data type iv. select the first three elements in the diagonal of v. evaluate the first row of a raised to the power 2 vi. select the maximum of r along the horizontal axis vii. select data in first two columns of rows 1 to 2 of x viii. select data in last two columns of rows 1 to 2 of ix. evaluate the sum of the arrays in vii. and viii. x. select the first three columns of rows 1 to 2 of x and transpose it xi. select the first three columns of rows 1 to 2 ofa and reshape it into an array with shape (32) xii. evaluate the product of the array in the first two columns of x and [[3, 0], [0, 2]] Consider the following matrix with 4 rows (rows 1 to 4) and 4 columns (columns 1 to 4) x = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (a) Create a Python array from the matrix above. What are the dimension and shape of x? (b) Using the array created in the question just above, provide a SINGLE com- mand to produce the following arrays and print your results (Hint: try to solve them without using a computer and then use Python to validate your results): i. select the third column of ii. extract the first and second elements of the last row of x. (Note: the command should include negative slicing) iii. select first and last columns of a using boolean data type iv. select the first three elements in the diagonal of v. evaluate the first row of a raised to the power 2 vi. select the maximum of r along the horizontal axis vii. select data in first two columns of rows 1 to 2 of x viii. select data in last two columns of rows 1 to 2 of ix. evaluate the sum of the arrays in vii. and viii. x. select the first three columns of rows 1 to 2 of x and transpose it xi. select the first three columns of rows 1 to 2 ofa and reshape it into an array with shape (32) xii. evaluate the product of the array in the first two columns of x and [[3, 0], [0, 2]]
Expert Answer:
Answer rating: 100% (QA)
Solution to the image a To create a Python array from the matrix above we can use the following code python import numpy as np matrix nparray1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 printmatrix Output 1 ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
A test tube filled with liquid of uniform density ?, as shown in the figure, is spun in a centrifuge with angular frequency ?. (Figure 1) The test tube lies perpendicular to the axis of rotation of...
-
(20 points)Write a program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, convert the sum to the nearest integer, and print the result....
-
Create the following vector A. A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18] Then using the MATLAB's built-in reshape function create the following matrix B from the vector A: By writing one...
-
A standard "35-mm" slide measures 24.0 mm by 36.0 mm. Suppose a slide projector produces a 60.0-cm by 90.0-cm image of the slide on a screen. The focal length of the lens is 12.0 cm. (a) What is the...
-
Use the following information for a firm. Target capital structure = 40% debt and 60% equity Cost of debt = 8% Cost of equity = 12% Tax rate = 40% 1) Find the firm's WACC. 2) As a manager, you...
-
What is an intangible asset? Provide some examples.
-
During operation, the compressor unit of a refrigerator, with mass \(75 \mathrm{~kg}\) and rotational speed \(900 \mathrm{rpm}\), experiences a dynamic force of \(200 \mathrm{~N}\). The compressor...
-
The income statement of Paxson Company is presented here. Additional information: 1. Accounts receivable decreased $380,000 during the year, and inventory decreased $300,000. 2. Prepaid expenses...
-
A two-dimensional array consists of patients' names and IDs in a private clinic is given in Figure 4. Replace "YourName" and "YourStudentNumber" with your particulars. data[9][2] {"YourName",...
-
The irreversible first-order (wrt partial pressure of A) gas-phase reaction A B is carried out isothermally in a "fluidized" catalytic CSTR containing 50 kg of catalyst. Currently, 50% conversion is...
-
Problem 1: Transactions 1st January 2019, Miss Nancy opens a business. The transaction incurred as follows:- 1) Invested RM 10,000 cash to start the business. 2) Purchase equipment for RM 5,000 in...
-
In the new normal, companies may become more innovative by building an Agile foundation. This crisis has proven that adaptability is a key element for operational function and survival. write...
-
Question 1) List 2 planned experience you do that will foster creativity in children you are required to allow children to be exposed to Aboriginal and/or Torres Strait Islander peoples' art forms...
-
The uganda supplier of electric bicycle - "Airliftt" imposes a fixed ordering cost of $120 per order, regardless of the order quantity. Young Lee has estimated the inventory holding cost for electric...
-
Company Description:1.1. Describe the business activities performed by the company.1.1.1. In which sector/industry the company operates?1.1.2. What are the products and services produced and offered...
-
You represent a large U.S. corporation that manufactures rubber tires, and you want to begin manufacturing and distribution in another country. Choose a country that you think you would want to start...
-
Interest payments and interest received must be reported as operating cash flows using: Multiple Choice Neither U.S. GAAP nor IFRS. Both U.S. GAAP and IFRS. IFRS. U.S. GAAP.
-
Do the three planes x + 2x + x 3 = 4, X X 3 = 1, and x + 3x = 0 have at least one common point of intersection? Explain.
-
While preparing Massie Miller's 2012 Schedule A, you review the following list of possible charitable deductions provided by Massie: Cash contribution to a family whose house burned...
-
On February 2, 2012, Alexandra purchases a personal computer for her home. The computer cost $3,000. Alexandra uses the computer 80 percent of the time in her accounting business, 10 percent of the...
-
During 2012, Palo Fiero purchases the following property for use in his manufacturing business: Palo uses the accelerated depreciation method under MACRS, if available, and does not make the election...
-
Why do sample surveys have predetermined margins of error?
-
A newly established noodle house has suffered low sales lately. The owner of the noodle house wants to research to collect information that will help him solve the problem at hand and design a...
-
Active-Ingredients is a company supplying baking ingredients in major hypermarkets that are facing intense competition from many local and foreign brands. Active-Ingredients is thinking of using a...
Study smarter with the SolutionInn App