We describe here a simple example for the one dimensional heat equation, over the domain . We set , where the final time is fixed. The control is either (i) over a part of the domain, with Dirichlet conditions, or (ii) at the boundary by the Neumann condition. So the state equation is in case (i)

where , and is the characteristic function of , and in case (ii)

The cost function is, for and :

We discretize in space by standard finite difference approximations.

*Numerical simulations: problem heat*

*As an example, we take 50 space variables, with , , and a final time T=20.*

* The discretization method is implicit Euler with 200 steps.*

* We set here , which gives a singular arc for the control.*

* We display on Fig. 1 the results in the case of the Dirichlet boundary condition .*

* Fig. 2 shows the Neumann case, this time with .*

* We can clearly see the differences between the boundary conditions and .*

Figure 1: Heat equation, Dirichlet condition, and .

Figure 2: Heat equation, Neumann condition, and .