Extracting value of the Expression

What would be the way to getting a value of the Expression as a float for a given values of parameters? For example,

y = Expression(‘exp( a * x )’, degree = 1, a = 1, x = 0)

y.a = 2
y.x = 3

How can I get the value of y now? Thank you!

An expression has to be interpolated into a suitable function space for you to extract values at certain points. Please note that as your expression is not spatially varying, you should consider using a Constant instead.

1 Like