Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help please, in python code. Thank you in advance! In addition to array creation and slicing, the video lectures introduced you to important ways to
Help please, in python code. Thank you in advance!
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=nparray([[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 bi21, where the bi are the elements of the array b. 2. The array formed by multiplying b with the scalar 100 . 3. The array formed by 2.0k in reverse order. (Note: the base 2.0 must be a floating point number; for integer values a ValueEr ror: 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 bi3, namely i=bi+13bi3 with 0iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started