-
Notifications
You must be signed in to change notification settings - Fork 10
DefFuncRtoR
Jim Pivarski edited this page Mar 15, 2015
·
1 revision
- summary Convert a "f(x)" string to a function acceptable for Curve
- labels Reference,Version1
_(This page applies only to the 1.x branch of SVGFig.)_
Converts a "f(x)" string to a function acceptable for [ClassCurve Curve].
- funcRtoR(expr, var, globals, locals)*
expr | _*required*_ | string in the form "f(x)" | ||||
var | _default_="x" | name of the independent variable | ||||
globals | _default_=None | dict of global variables used in the expression; you may want to use Python's builtin `globals()` | ||||
locals | _default_=None | dict of local variables |
All symbols from Python's [http://docs.python.org/lib/module-math.html math library] are in scope, so you can say things like "sin(x)".
Example use of globals.
>>> funcRtoR("c*x**2", globals={"c": 12})
This does the same thing.
>>> c = 12 >>> funcRtoR("c*x**2", globals=globals())