GFem language documentation -- 3.6 Integrals

Previous: 3.5 Global operators
Up: 3 The Gory Details
Next: 3.7 Solving an equation

## 3.6 Integrals

- effect:

  `intt` returns a complex or real number, an integral with respect to `x,y` `int` returns a complex or real number, an integral on a curve

- syntax:

  `intt[f]` or `intt(n1)[f]` or `intt(n1,n2)[f]` or `intt(n1,n2,n3)[f]` `int(n1)[f]` or `int(n1,n2)[f]` or `int(n1,n2,n3)[f]`

  where `n1,n2,n3` are boundary or subdomain identification numbers and where `f` is an array function.

      border(1)...  end;  /* a border has number 1 */
      ... buildmesh(...);

      f = 2 * x;

      /*
       * nx,ny are the components of the boundary normal
       */
      g = f * (nx + ny);

      /*
       * can't do r:= int[2*x]
       */
      r:= int[f];
      s:=int(1)[g];

      /*
       * this is the only way to display the result
       */
      save('r.dta',r);
      save('s.dta',s);

- Restrictions:

  `int` and `intt` are global operators, so the values of the integrands are needed at all vertices at once, therefore you can't put an expression for the integrand, it must be a function.

  Be careful to check that the region number are correct when you use `intt(n)[f]` .

  Unfortunately freefem does not store the edges numbers. Hence there are ambiguities at vertices which are at the intersections of 2 boundaries. The following convention is used: `int(n)[g]` computes the integral of `g` on all segments of the boundary (both ends have id boundary number !=0) with one vertex boundary id number = n. (Remember that you can control the boundary id number of the boundary ends by the order in which you place the corresponding `border` call or by an extra argument in `border` )