this is my code…

Question Answered step-by-step this is my code… Image transcription textSolve the following problems. Use numpy and numpyarrays when possible. Problem 1: tanc function Definethe function tana tance : as a Python functi… Show more… Show morethis is my code ——————————————————————————– import numpy as npimport mathdef theta(t,w,theta0=(math.pi/6),omega0=0):”’  it takes array of time to calculate theta at different time ,frequence,  theta0 and omega 0  it returns the calculated value of theta at a specific time in form of array.”’a=math.sqrt((theta0*theta0)+((omega0/w)*(omega0/w)))b=(omega0/w)fi=-math.atan(b/theta0)y=np.array([])for i in t:  ans=a*math.cos(w*i+fi)  y=np.append(y,ans)return ydef tanc(x):y=np.array([])for i in x:  if i ==0:    y=np.append(y,1)  else:    y=np.append(y,math.tan(i)/i)return yx=np.pi*np.array([0,0.25,1])print(tanc(x))z=np.array([1,2,3])print(theta(z,2)) import numpy as npdef tanc(x):if isinstance(x,np.ndarray): #checks if the input is numpy array or not arr = np.zeros(len(x)) #creates empty array and initialize 0 for index,val in enumerate(x): #enumerates(x) returns enumerate object    if val==0: #checks if the value is 0 then insert 1 in the array   arr[index] = 1  else:   arr[index]= np.tan(val)/val #calculate tanx value and store in numpy array return arrelse: if x==0: #checks if the value is 0 then return 1    return 1 else:  return  np.tan(x)/x #calculate tanx value and return ————————————————————————————————-Unit test Fix the following exception (for theta): theta() got an unexpected keyword argument ‘omega’Image transcription text6: Unit test: theta defaults A 0/5 [ 1. 00000000e+001.27323954e+00 -3. 89817183e-17] Your output [-0.21789397-0.342247 0.50274399] Test feedback Fix the f… Show more… Show more  Computer Science Engineering & Technology Python Programming PHY 3106 Share QuestionEmailCopy link Comments (0)