# Javascript Error: IPython is not defined / Object cannot be plotted directly, projecting to piecewise linears

I am trying to solve Linear thermoelasticity but i recieve those 2 errors avascript Error: IPython is not defined / Object cannot be plotted directly, projecting to piecewise linears.

#!/usr/bin/env python

# In[1]:

from dolfin import *
from mshr import *
import matplotlib.pyplot as plt
get_ipython().run_line_magic(‘matplotlib’, ‘notebook’)

L, H = 5, 0.3
mesh = RectangleMesh(Point(0., 0.), Point(L, H), 100, 10, “crossed”)

def lateral_sides(x, on_boundary):
return (near(x[0], 0) or near(x[0], L)) and on_boundary
def bottom(x, on_boundary):
return near(x[1], 0) and on_boundary
def top(x, on_boundary):
return near(x[1], H) and on_boundary

# In[2]:

VT = FunctionSpace(mesh, “CG”, 1)
T_, dT = TestFunction(VT), TrialFunction(VT)
Delta_T = Function(VT, name=“Temperature increase”)
LT = Constant(0)*T_*dx

bcT = [DirichletBC(VT, Constant(50.), bottom),
DirichletBC(VT, Constant(0.), top),
DirichletBC(VT, Constant(0.), lateral_sides)]
solve(aT == LT, Delta_T, bcT)
plt.figure()
p = plot(Delta_T, mode=“contour”)
plt.colorbar(p)
plt.show()

# In[3]:

E = Constant(50e3)
nu = Constant(0.2)
mu = E/2/(1+nu)
lmbda = Enu/(1+nu)/(1-2nu)
alpha = Constant(1e-5)
f = Constant((0, 0))
def eps(v):
def sigma(v, dT):
return (lmbdatr(eps(v))- alpha(3lmbda+2mu)dT)Identity(2) + 2.0mueps(v)
Vu = VectorFunctionSpace(mesh, ‘CG’, 2)
du = TrialFunction(Vu)
u_ = TestFunction(Vu)
Wint = inner(sigma(du, Delta_T), eps(u_))*dx
aM = lhs(Wint)
LM = rhs(Wint) + inner(f, u_)*dx
bcu = DirichletBC(Vu, Constant((0., 0.)), lateral_sides)
u = Function(Vu, name=“Displacement”)

# In[4]:

solve(aM == LM, u, bcu)
plt.figure()
p = plot(1e3*u[1],title=“Vertical displacement [mm]”)
plt.colorbar(p)
plt.show()
plt.figure()
p = plot(sigma(u, Delta_T)[0, 0],title=“Horizontal stress [MPa]”)
plt.colorbar(p)
plt.show()

# In[5]:

rho_g = 2400*9.81e-6
f.assign(Constant((0., -rho_g)))
solve(aM == LM, u, bcu)

plt.figure()
p = plot(1e3*u[1],title=“Vertical displacement [mm]”)
plt.colorbar(p)
plt.show()
plt.figure()
p = plot(sigma(u, Delta_T)[0, 0],title=“Horizontal stress [MPa]”)
plt.colorbar(p)
plt.show()