Question: Consider the array A. Write a program that computes the array B by computing the natural logarithm of all the elements of A whose value

Consider the array A.

3 -4 A = - 8 -1 33 -17 - 17 6. - 9


Write a program that computes the array B by computing the natural logarithm of all the elements of A whose value is no less than 1, and adding 20 to each element that is equal to or greater than 1. Do this in two ways:

a. By using a for loop with conditional statements.

b. By using a logical array as a mask.

3 -4 A = - 8 -1 33 -17 - 17 6. - 9

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Here is a Python program that computes the array B using a for loop with conditional statements import numpy as np import math A nparray35481331769 ... View full answer

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 Introduction Mechanical Engineering Questions!