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

**URL:** <https://community.freefem.org/t/how-to-compute-length-of-a-parametric-curve-by-taking-input-from-user-in-freefem/2714>\
**Category:** General Discussion\
**Created:** [September 19, 2023, 3:47pm UTC](https://community.freefem.org/t/how-to-compute-length-of-a-parametric-curve-by-taking-input-from-user-in-freefem/2714 "2023-09-19T15:47:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)\
**Post date:** [September 19, 2023, 3:47pm UTC](https://community.freefem.org/t/how-to-compute-length-of-a-parametric-curve-by-taking-input-from-user-in-freefem/2714/1 "2023-09-19T15:47:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![julienG](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/julieng/32/222_2.png) [@julienG](https://community.freefem.org/u/julienG)\
**Post date:** [September 19, 2023, 4:37pm UTC](https://community.freefem.org/t/how-to-compute-length-of-a-parametric-curve-by-taking-input-from-user-in-freefem/2714/2 "2023-09-19T16:37:46Z")

</div>

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…
