What's new? | Help | Directory | Sign in
Google
  
  
  
  
    
Search
for
Updated Jun 17, 2008 by jpivarski
Labels: Reference, Version1
DefFuncRtoR2  
Convert a "f(t), g(t)" string to a function acceptable for Curve

(This page applies only to the 1.x branch of SVGFig.)

funcRtoR2

Converts a "f(t), g(t)" string to a function acceptable for Curve. If you pass a string to Curve, funcRtoR2 will be used to convert it to a function.

Arguments

funcRtoR2(expr, var, globals, locals)

expr required string in the form "f(t), g(t)"
var default="t" 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 math library are in scope, so you can say things like "cos(t), sin(t)".

Example use of globals.

>>> funcRtoR2("c*t, c*t**2", globals={"c": 12})

This does the same thing.

>>> c = 12
>>> funcRtoR2("c*t, c*t**2", globals=globals())

Sign in to add a comment