Exercise

Discrete Function

Using GMSH API, build a code that:

  • Discretizes the segment [0,2π] with a mesh size of your choice
  • Computes, on each node of the mesh, the cosine of the 2*x-coordinate ($=\cos(2x)$)
  • Plot this function using, for example, Matplotlib

This program can obviously be done without GMSH (and way faster without!). It’s just a toy program!

Result