Question: Write a program that computes a new matrix B by calculating the natural logarithm ( log ( X ) ) for any element of A

Write a program that computes a new matrix B by calculating the natural logarithm (log(X)) for any element of A that is greater than or equal to 1. Otherwise, add 20 to any element of A that is less than 1. You will need to use two for loops within each other and an IF-ELSE statement within the INNER-most loop. You will also need to utilize 2-dimensional indexing to refer to elements within matrices A and B.
Write a program that computes a new matrix B by calculating the natural logarithm (log(X)) for any element of A that is greater than or equal to 1. Otherwise, add 20 to any element of A that is less than 1. You will need to use two for loops within each other and an IF-ELSE statement within the INNER-most loop. You will also need to utilize 2-dimensional indexing to refer to elements within matrices A and B.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!