Message Boards Message Boards

0
|
8730 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Make a Module that calculates the arc length of a function?

So I have project in Mathematica and to be honest I have no Idea how to do this: I have to make a Module which should calculate the arc length of this function enter image description here

Is there someone who could help me?

POSTED BY: Ohran Ahmed
5 Replies

Well, the answer of Tasneem is cool, but I suppose not very helpful.

You have a vector X[ t ], its variation is d X[ t ] = D[ X[ t ], t ] dt, where D[..., t ] ist the differentiation with repect to t. The length of this variation is Sqrt[ d X[ t ] . d X[ t ] ] dt , where the . indicates the scalar product of two vectors. This expression ist to be integrated between t1 and t2 to get the length you are looking for.

In[9]:= X[t] = { t^2, (1 - t)^2, 2 t};
dx = D[X[t], t]
dx2 = dx.dx // Expand
jj = Sqrt[dx2]
arc = Integrate[jj, {t, t1, t2}]


Out[10]= {2 t, -2 (1 - t), 2}

Out[11]= 8 - 8 t + 8 t^2

Out[12]= Sqrt[8 - 8 t + 8 t^2]

Out[13]= If[((Im[t2] Re[t1] <= Im[t1] Re[t2] && 
      Im[t1] >= Im[t2]) || (Im[t2] Re[t1] >= Im[t1] Re[t2] && 
      Im[t1] <= Im[t2])) && ((Im[t2] Re[t1] - 
       Im[t1] Re[t2])^2/(Re[t1] - Re[t2])^2 == 
     1 || (Im[t2] Re[t1] - Im[t1] Re[t2])^2/(Re[t1] - Re[t2])^2 <= 
     1), -((2 (-1 + 2 t1) Sqrt[1 - t1 + t1^2] - 
    3 ArcSinh[(1 - 2 t1)/Sqrt[3]])/(2 Sqrt[2])) + (
  2 (-1 + 2 t2) Sqrt[1 - t2 + t2^2] - 3 ArcSinh[(1 - 2 t2)/Sqrt[3]])/(
  2 Sqrt[2]), 
 Integrate[Sqrt[8 - 8 t + 8 t^2], {t, t1, t2}, 
  Assumptions -> ! (((Im[t2] Re[t1] <= Im[t1] Re[t2] && 
          Im[t1] >= Im[t2]) || (Im[t2] Re[t1] >= Im[t1] Re[t2] && 
          Im[t1] <= Im[t2])) && ((Im[t2] Re[t1] - 
           Im[t1] Re[t2])^2/(Re[t1] - Re[t2])^2 == 
         1 || (Im[t2] Re[t1] - Im[t1] Re[t2])^2/(Re[t1] - Re[t2])^2 <=
          1))]]
POSTED BY: Hans Dolhaine

This is pretty easy to use. For general limiting points:

ArcLength[{t^2, (1 - t)^2, 2 t}, {t, a, b}]

enter image description here

and for say interval {0,1}:

ArcLength[{t^2, (1 - t)^2, 2 t}, {t, 0, 1}]

enter image description here

POSTED BY: Sam Carrettie
Posted 9 years ago

Hello

To add to Hans Dolhaine answer with some assumptions the arc length expression simplifies a lot:

 arc = Integrate[jj, {t, t1, t2}, 
 Assumptions -> {t1 \[Element] Reals && t2 \[Element] Reals  && 
 t2 > t1}]

 (2 Sqrt[1 - t1 + t1^2] - 4 t1 Sqrt[1 - t1 + t1^2] -   (* answer *)
2 Sqrt[1 - t2 + t2^2] + 4 t2 Sqrt[1 - t2 + t2^2] - 
3 ArcSinh[(-1 + 2 t1)/Sqrt[3]] + 
3 ArcSinh[(-1 + 2 t2)/Sqrt[3]])/(2 Sqrt[2])
POSTED BY: Jan Potocki

ok, the output after the integration seems a bit puzzling. but we can ask mma to skip generating conditions and get the same result as Sam:

X[t] = {t^2, (1 - t)^2, 2 t};
dx = D[X[t], t] 
dx2 = dx.dx // Expand 
jj = Sqrt[dx2] 
SetOptions[Integrate, GenerateConditions -> False]
arc = Integrate[jj, {t, a, b}] // FullSimplify   

Out[2]= {2 t, -2 (1 - t), 2}

Out[3]= 8 - 8 t + 8 t^2

Out[4]= Sqrt[8 - 8 t + 8 t^2]

Out[5]= {Assumptions :> $Assumptions, GenerateConditions -> False, 
 PrincipalValue -> False}

Out[6]= (1/(2 Sqrt[2]))(2 (1 - 2 a) Sqrt[1 + (-1 + a) a] + 
  2 (-1 + 2 b) Sqrt[1 + (-1 + b) b] - 3 ArcSinh[(-1 + 2 a)/Sqrt[3]] + 
  3 ArcSinh[(-1 + 2 b)/Sqrt[3]])

But for sure there is a lot of cases where the (symbolic) integration is simpliy not feasible. In this case you should use numeric integration. for example

In[8]:= narc = NIntegrate[jj, {t, 1, 2.5}]
Out[8]= 6.54418
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract