Just to be clear, does eval being to ufl?
Presuming you mean belong. No, it's Python that evaluates a string in the current environment.
Eg
x=5print eval("x")=> 5
On 7 Oct 2014 21:52, "Lawrence Mitchell" <lawrence.mitchell@imperial.ac.uk> wrote:
On 7 Oct 2014, at 21:34, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
> Dear all,
> I'm looking for a way to convert Sympy expressions into UFL expressions, where the symbols are Python functions. Any tips?
The sympy expression printers are tree visitors. You could write one that visits the tree and produces a UFL tree.
Or, ugly but simpler in the short term:
stringify, replace the functions with the names of the appropriate UFL functions. eval the resulting string. urgh.
i.e.
x = Symbol('x')
string = str(exp(-x**2))
from firedrake import *
x = Function(V)
ufl_expr = eval(string)
Lawrence
_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake