consider the following Python functions: def lam_t(T): #calculates lam(t) at giv
ID: 3607448 • Letter: C
Question
consider the following Python functions:
def lam_t(T): #calculates lam(t) at given t
Lambda=[]
t=T
for i in range(len(T)):
Lambda.append(0.8+0.4*np.sin(0.2*np.pi*t[i]))
return Lambda
def Non_hom_poisson(T,n,N):
time=np.arange(0.1,10.1,0.1)
Lambda_t=lam_t(time)
max_lam=[max(Lambda_t[x:(x+19)]) for x in range(0,len(time),20)]
min_lam=[min(Lambda_t[x:(x+19)]) for x in range(0,len(time),20)]
max_min_lam=[(max_lam[x]-min_lam[x]) for x in range(len(max_lam))]
max_min_lam=np.tile(max_min_lam,60)
min_lam=np.tile(min_lam,60)
NH=Non_hom_poisson(600,5,1)
when I call max_lam=[max(Lambda_t[x:(x+19)]) for x in range(0,len(time),20)], I'm getting the following error : 'int' object is not callable. Any idea of how to solve this?
Explanation / Answer
I am not getting any such error in executing line you have mentioned
See below
>>> max_lam=[max(Lambda_t[x:(x+19)]) for x in range(0,len(time),20)]
>>> max_lam
[1.1719105943553005, 1.2000000000000002, 1.0143307179915988, 0.54503040410052428, 0.77488379218827474]
>>>
>>> min_lam=[min(Lambda_t[x:(x+19)]) for x in range(0,len(time),20)]
>>> min_lam
[0.82511620781172534, 1.0549695958994758, 0.58566928200840129, 0.40000000000000002, 0.42808940564469938]
>>> max_min_lam=[(max_lam[x]-min_lam[x]) for x in range(len(max_lam))]
>>> max_min_lam
[0.34679438654357519, 0.14503040410052437, 0.4286614359831975, 0.14503040410052426, 0.34679438654357536]
>>> max_min_lam=np.tile(max_min_lam,60)
>>> max_min_lam
array([ 0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439,
0.34679439, 0.1450304 , 0.42866144, 0.1450304 , 0.34679439])
>>>
>>> min_lam=np.tile(min_lam,60)
>>> min_lam
array([ 0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941,
0.82511621, 1.0549696 , 0.58566928, 0.4 , 0.42808941])
>>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.