Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using a user-defined function, write a Python program that determines the index of the maximum entry of an array of arbitrary size and its corresponding
Using a user-defined function, write a Python program that determines the index of the
maximum entry of an array of arbitrary size and its corresponding value. Have your program print out the matrix, the index of the maximum value, and the value of the entry at that index. Test your code twice, using the two matrices given below. 70.5 6.6 0.7 1 3 4 1 12 13 10 1 A= 2 6 17 4 and B = 0 0.1 4 12 11 10 10 10.3 0.1 0 (3 12) 14 Your code should look exactly like the output shown below: Matrix: [[ 0.5 6.6 0.7 1. ] [ 2. 6. 17. 4. ] [ 0.3 0.1 0. 14. ]] The max entry is located at index (1,2) A(1,2) is 17.0 [[ 3. 13. 10. Matrix: 4. 1. 12. 1. 12. ] [ 0. 0.1 4. 12. 11. 10. 10. 1. ]] The max entry is located at index (0,4) B(0,4) is 13.0 Figure 1: Output for Q1 part a. Your code should output this exactly (10%) b) As part of a larger set of iterative calculations, we need to calculate the matrix F = DE where matrix E is always equal to matrix D but with the element at position (i,j) equal to x, a variable that is defined by the user. Write a Python program with a user-defined function called modifymatrix () that performs such a calculation for a given i, j, and x. Test your code in the case of i = j = 1 and x = -5 using the following D matrix and have your code print out E and the result F. (Note here that I am not asking for user input - just hardcode the values for i, j, and x). 2 1 D= 2 14 6 -2 -1 04 1Step 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