# Expression for higher order element

**URL:** <https://fenicsproject.discourse.group/t/expression-for-higher-order-element/1750>\
**Category:** Uncategorized\
**Created:** [October 18, 2019, 4:43pm UTC](https://fenicsproject.discourse.group/t/expression-for-higher-order-element/1750 "2019-10-18T16:43:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grayson3455](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/grayson3455/32/502_2.png) [@Grayson3455](https://fenicsproject.discourse.group/u/Grayson3455)\
**Post date:** [October 18, 2019, 4:43pm UTC](https://fenicsproject.discourse.group/t/expression-for-higher-order-element/1750/1 "2019-10-18T16:43:57Z")

</div>

Hi all,

I guess the `Expression`s in FEniCS are only evaluated on the mesh grid points but not on the interior degrees of freedom? For example, when evaluating the `|x|` on a single quadratic reference element returns the line of `x = 1`, and I think that may lead to the `Expression` always be the piecewise linear polynomials no matter how high the element degree is.

I found this when trying to reproduce the Runge phenomenon on a single element, and I am wondering if there is any way to force the `Expression` to take accounts for all the degrees of freedom?

Thanks

---

<div class="post-metadata">

**Author:** ![kamensky](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kamensky](https://fenicsproject.discourse.group/u/kamensky)\
**Post date:** [October 18, 2019, 6:45pm UTC](https://fenicsproject.discourse.group/t/expression-for-higher-order-element/1750/2 "2019-10-18T18:45:07Z")

</div>

My guess is that you’re trying to plot to check, which always interpolates to linears. You can see the various behaviors of `Expression` in the following example:

```python
from dolfin import *

# Mesh with one element:
mesh = IntervalMesh(1,-1,1)

# Create quadratically-interpolated Expression for |x|:
absx = Expression("fabs(x[0])",degree=2)

# Evaluating it directly works as expected:
from numpy import array
print(absx(array([-1+DOLFIN_EPS,])))
print(absx(array([0,])))
print(absx(array([1-DOLFIN_EPS,])))
print(absx(array([0.5,]))) # Clearly NOT interpolated to quadratic space!

# The "degree" comes into play when using it in integrands; you can see that
# this is not the correct integral of |x|, but rather of x^2, which is the
# interpolant of |x| into a finite element space of the specified degree:
print(assemble(absx*dx(domain=mesh)))

# Plotting always interpolates to linears:
from matplotlib import pyplot as plt
plot(absx,mesh=mesh)
plt.show()

```
