Thanks for all the suggestions and comments!!
I will try all those suggestions just to I can figure out how they
work. For phase 1 of this project, I will probably go with the eval.
thanks again, happy hacking...
jr
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
> On 12 Dec 2005 21:38:23 -0800, "Jacob Rael" <[EMAIL PROTECTED]> wrote:
>
>> 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 exampl
On 12 Dec 2005 21:38:23 -0800, "Jacob Rael" <[EMAIL PROTECTED]> wrote:
>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'
"Jacob Rael" <[EMAIL PROTECTED]> writes:
> In CppSim, classes are defined that allow various functions to be
> defined, like amplifiers. In some cases they are linear:
>
> y = A*x
>
> some have offsets:
>
> y = A*x + off
>
> some are non-linear
>
> y = A*x - C*x**3
>
> The coefficients and the func
"Jacob Rael" <[EMAIL PROTECTED]> writes:
> I read about the security concerns involved in using eval(). I don't
> expect this project to grow to the point where I require a web
> interface. However, since I am learning, I might as well learn the
> right way.
I think you're going to have to write a
Another example is a filter. From the CppSim doc:
Filter filt("1+1/(2*pi*fz)s","C3*s +
C3/(2*pi*fp)*s^2","C3,fz,fp,Ts",1/gain,fz,fp,Ts);
jr
--
http://mail.python.org/mailman/listinfo/python-list
Overall I am trying to learn OOP by porting
CppSim (http://www-mtl.mit.edu/~perrott) to Python.
In CppSim, classes are defined that allow various functions to be
defined, like amplifiers. In some cases they are linear:
y = A*x
some have offsets:
y = A*x + off
some are non-linear
y = A*x - C*x
"Jacob Rael" <[EMAIL PROTECTED]> writes:
> 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
Jacob Rael wrote:
> 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}