How to compute length of a parametric curve by taking input from user in FREEFEM++?

I want to compute length of parametric curve r(t)=<x(t),y(t)> where t in [a,b]. Please help me to write an FREEFEM code where user can give any parametric curve. I should able to compute the length.

You have two possibilities:

  1. Construct the corresponding parametric curve as an inner border of your mesh. Basically the command border builds a parametric curve.
  2. Or you ca use levelset in you integration.

See the following code:

int Npts = 40; int NptsIn=20;
border circle1(t=0,2 * pi){x=cos(t); y=sin(t); label=0;};
border circle2(t=0,2 * pi){x=0.5 * cos(t); y=0.5 * sin(t); label=1;};
mesh Th=buildmesh(circle1(Npts)+circle2(NptsIn)) ;
real length1 = int1d(Th,1)(1.0);
real length2 = int1d(Th,levelset= (x^2 + y^2 -0.5^2) )(1.);
cout << length1 <<endl;
cout << length2 <<endl;

length1 is computed along the inner border
length2 is computed on the parametric curve giver by the levelset
in both cases you have the same length of an inner circle…