I have the following code written in python 2.7.
Here I've defined two function, a cosine function and an exponential function
and I need to multiply these functions to a float Value, but I am getting this error.
I assume we can't multiply a float value to a function in list()
format...
I would be grateful if someone tell me how can I do this.
Thanks in advance.
Here is my code :
import numpy as np
import math
import cmath
delta = 2.0*math.pi*1.46*((1.0/1530)-(1.0/1550))
#defining main func
def apFunc(x):
return np.exp(-4*math.log(2)*((x-(5/2))/5)**2)*(1+math.cos((2*math.pi/0.001)*x))
Domain = list(np.arange(0,5,0.001))
APF = map(apFunc,Domain)
#defining modulation function
def modFunc(x):
return (1+math.cos((2*math.pi/0.001)*x))
d = list(np.arange(0,5,0.001))
mod = map(modFunc,d)
#making sig and kaa functions
sgima = (2*math.pi/1530)*APF
sig = sigma + delta
kaa = (math.pi/l1530)*mod
gamma = math.sqrt(sig**2 + kaa**2)