I would like to compute the arc length of the function f computed in the code below.
> g := sin(Pi*x)^(1/6); > A := evalf(Int(g,x=0..1)); > f := g/A; > fp := diff(f,x); > arclength := evalf(Int(sqrt(1+fp^2),x=0..1));
I realize that the integral for the arclength is improper at both endpoints, so Maple must deal with the singularities. However, Maple just sits and sits and sits working on this problem. I have tried adding the option to reduce the number of digits of precision with no effect.
I have tried adding the flag to specify the method. I was able to get an answer at one point, though I am now unable to replicate that success. Either I give up waiting for Maple, or Maple reports that it cannot handle the singularity.
Mathematica gives the numerical value in a few seconds. The problem occurs with both release 5.0 and 6.0. I’m using Maple on a pentium machine.
So is there anything I can do to get Maple to do this integration? This is just one example
from several that came up when my students worked on a project to find arc length of
functions that have area 1 on interval [0,1]
(hence the calculation of A above) and are 0 at
both x=0 and x=1.
Since Maple seems to be having trouble dealing with the singularity, you might
try a do-it-yourself approach. First of all, use symmetry to reduce the problem
to integrating on 0..1/2
. Now the integrand has the following series near x =
0:
> S:= series(sqrt(1+fp^2),x,15);
Approximate the integral on, say, 0 .. 0.05
by the integral of this series (by examining the
terms, it appears that the convergence of the series on this interval is sufficiently
rapid).
> J1:= int(convert(S,polynom),x=0..0.05); J1 := .8205287812
On the rest of the interval, numerical integration has no problem.
> J2:= evalf(Int(sqrt(1+fp^2),x=0.05 .. 0.5));
The result is:
> J:= 2*(J1+J2); J := 2.789958073
My run of mma does give an answer but it gives warnings about the accuracy. I used mma version 3.0
and by taking limits {x,0.00000000000000001,0.9999999999999999}]
got warnings and
result as follows:
In[44]:= N[%] NIntegrate::"slwcon": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration being 0, oscillatory integrand, or insufficient WorkingPrecision. If your integrand is oscillatory try using the option Method->Oscillatory in NIntegrate." NIntegrate::"slwcon": "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration being 0, oscillatory integrand, or insufficient WorkingPrecision. If your integrand is oscillatory try using the option Method->Oscillatory in NIntegrate." NIntegrate::"ncvb": "NIntegrate failed to converge to prescribed accuracy after \!\(7\) recursive bisections in \!\(x\) near \!\(x\) = \!\(0.999999999999999822`\)." Out[44]= 2.78505
Using Maple 6, I did the arc length from x=0.2 to x=0.8
, then added twice the arc length
of the inverse function from the limits 0 .. to 1.016907...
and got
2.789958072
.
I have the files here: if you are interested then I can easily send you them as email attachments.
Can you change the variable so that there is no singularity at one end?