Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

For each instruction below, show the code and the results from running the code following each of the instructions below. Answer any questions. a) Creating

  1. For each instruction below, show the code and the results from running the code following each of the instructions below. Answer any questions.

  2. a) Creating Arrays
    1) Make a one-dimensional array named "basic_arr" that contains four integer values.
  3.  
  4. 2) Make an array named 'main_arr" that contains 16 values from 10 to 25 that are formatted as four rows and four columns.

  5. 3) Make an array named 'sub_arr" that contains 16 random values that are formatted as four rows and four columns.

  6. Question:
    • How does a vector and matrix differ?

  7. b) Accessing Array Elements and Attributes

  8. 1) Use "main_array" and indexing to display the different elements in the array

  9. 2) Display "main_arr"'s attributes:
    dimension
    size
    shape
    data type

  10. c) Aggregate Functions

  11. 1) Display the following statistical information about the data stored in "main_arr":
    Sum
    mean
    median
    minimum value
    maximum value
    standard deviation

  12. d) Arithmetic Operations, Matrix Operations, Broadcasting, and Comparisons

  13. 1) Use "main_arr" and "sub_array" to demonstrate the following arithmetic operations:
    addition
    subtraction
    multiplication
    division

  14. 2) Use "main_arr" and "sub_array" to demonstrate finding the matric product of the two arrays.

  15. Question:
    • How do matrix operations differ from normal arithmetic operations?
  16.  
  17. 3) Use "main_arr" and "basic_array" to demonstrate broadcasting using addition

  18. Question:
    • What does broadcasting do?

  19. 4) Using "main_arr" to demonstrate comparison. Find all of the values that are greater than or equal to 7

  20. Question:
    • What modifications to the code would be required to save all of the values greater than or equal to 7 in a new array?

  21. e) Joining, Splitting, and Splicing Arrays

  22. 1) Use "main_arr" and "sub_array" to demonstrate joining two arrays both horizontally and vertically.

  23. 2) Use "main_arr" to demonstrate splitting the array as follows:
    Two 2 x 4 arrays
    Two 4 x 2 arrays

  24. 3) Use "main_arr" to demonstrate slicing the array as follows:
    An array that contains just the data from the third row
    An array that contains data from the third column

  25. Question:
    • How does splitting differ from slicing?

  26. f) Saving and Loading Arrays

  27. 1) Save "sub_arr" to an external file named "saved_sub.npy".

  28. 2) Load an external file named "saved_sub.npy".

  29. Question:
    • Why might a text file be used to save data rather than a binary file?

Step by Step Solution

3.23 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

a Creating Arrays 1Make a onedimensional array named basicarr that contains four integer values output basicarr 1 2 3 4 2 Make an array named mainarr that contains 16 values from 10 to 25 that are for... 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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students explore these related Programming questions

Question

d. Is the program accredited?

Answered: 3 weeks ago