On Jul 18, 2008, at 12:04 PM, aniura wrote: > Hi, > > I have no experience in sage, I began to use it two days ago because I > need arbitrary precision arithmetic and Octave is not so god for > that. > > I wanted to write a script where I evaluate a function which is also > written in a script. this can be done in Octave , f. ex. by using > "feval", but I have not found anything similar in sage. could anybody > give some suggestion? > > thanks in advance,
In Python (and hence Sage) functions are first-level objects, so one can pass them around like anything else, so there's no need for feval. For example, I can write def foo(f, x): return f(x) + f(f(x)) sage: foo(sin, 3) sin(sin(3)) + sin(3) sage: foo(sqrt, 20) 2*sqrt(5) + sqrt(2)*5^(1/4) - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---