J
Jacob Rael
Hello,
I would like write a function that I can pass an expression and a
dictionary with values. The function would return a function that
evaluates the expression on an input. For example:
fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min':
-2.0} )
2
so fun would act as if I did:
def fun(x):
A = 3
off = -0.5
Max = 2
Min = -2
y = min(Max,max(Min,A*x + off))
return(y)
Any ideas?
jr
I would like write a function that I can pass an expression and a
dictionary with values. The function would return a function that
evaluates the expression on an input. For example:
fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min':
-2.0} )
2
so fun would act as if I did:
def fun(x):
A = 3
off = -0.5
Max = 2
Min = -2
y = min(Max,max(Min,A*x + off))
return(y)
Any ideas?
jr