back

Solution to exercise 3.1.1

The implementation is straightforward : the difference of the area of a circle sector and a triangle. <sxh c>

  function A = csegarea(R, alpha)
     A = 1/2 * R^2 * alpha - 1/2*R^2*sin(alpha); 
  endfunction

</sxh>

However less operations are done if we slightly rearange the terms: <sxh c>

  function A = csegarea(R, alpha)
     A = R^2 * (alpha - sin(alpha)) / 2; 
  endfunction

</sxh>