Question: Your task is to write a Python function q 2 _ func with the following def line: def q 2 _ func ( x ,
Your task is to write a Python function qfunc with the following def line:
def qfuncxy:
The function inputs x and y are assumed to be dimensional numpy arrays of the same shape. The function is required to compute and return a numpy array which has the same shape as both x and y In the following description, we will refer to the numpy array to be returned by the variable name z
Let xi yi and zi be the element indexed by i in respectively, the arrays x y and z
The relationship between xi yi and zi is given by the following pseduocode:
if absolute value of xi absolute value of yi zi xi yi else zi yi xi
For examples:
If xi is and yi is then zi should take on the value of
If xi is and yi is then zi should take on the value of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
