![]() | Matlab has a nice feature: mathematical formulas, written as text, can be turned into callable functions |
![]() | A similar feature in Python would be like
f = StringFunction_v1('1+sin(2*x)') print f(1.2) # evaluates f(x) for x=1.2 |
![]() | f(x) implies f.__call__(x) |
![]() | Implementation of class StringFunction_v1 is compact! (see next slide) |