Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The question features working with arrays on Python Programming. All necessary information and direction is provided. I am confused on how to apply the array

The question features working with arrays on Python Programming. All necessary information and direction is provided. I am confused on how to apply the array methods for the following programming challenge.

image text in transcribedimage text in transcribedimage text in transcribed
9.8 CHALLENGE: Working with arrays In addition to array creation and slicing, the video lectures introduced you to important ways to use numpy arrays: . using array methods . array arithmetic . ufuncs (universal functions) Array arithmetic and ufuncs act on arrays in an element-wise fashion. They also make use of broadcasting to work with arrays of different sizes or arrays and scalars (a scalar is a simple number). Array methods Given the array a = np. array( [ [1, 2, 3] , [10, 20, 30], [100, 200, 300] ]), Compute and print 1. the "sums by rows", i.e., the sums go over the columns (should give [6, 60, 600]) (Hint: Use a . sum (axis=. . . ) where you have to choose the correct axis to sum over.) 2. the "sums by columns", i.e., the sums go over the rows (the sum in the first column is 111) 3. the maximum of the array 4. the maxima of all rows 5. the mean of the sub-array formed by omitting the first row and column 6. the products by columns (i.e., products over rows) but only including the first two columns (Hint: look for an appropriate ndarray method for the product.) See Basic reductions in the SciPy lecture notes for help and orientation. Array arithmetic Given the array b = np. arange (-6, 4) compute and print 1. The array formed by be - 1, where the by are the elements of the array b. 2. The array formed by multiplying b with the scalar 100.Array arithmetic Given the array]: = np.arange(-6, 4) compute and print 1. The array formed by b? 1. where the 6,: are the elements ofthe array 1:. 2. The array formed by multiplying h with the scalar 100. 3. The array formed by 2.0!\" in reverse order. (Note: the base 2.0 must be a oating point number; for integer values a ValueError: Integers to negative integer powers are not allowed . is raised.) 4. The array delta of length len ( b] -1 that contains the differences between subsequent entries of bit, namely ti; = bf\" bf with 0 E 2'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions