HP Forums
Lockup Calculating Arc Length of Ellipse - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Lockup Calculating Arc Length of Ellipse (/thread-2303.html)



Lockup Calculating Arc Length of Ellipse - mkspence - 10-16-2014 07:24 PM

I am calculating the following integral:


sqrt(4*(sin(t))^2 + (cos(t))^2) 0 < t 2*pi


My TI-89 calculates 9.68845 in about 25 seconds, but my Prime locks up and requires a hard reset.


RE: Lockup Calculating Arc Length of Ellipse - Tim Wessman - 10-16-2014 07:41 PM

Works fine here (hw/emu), so I suspect that has been resolved with later CAS versions. Returns 9.68844822


RE: Lockup Calculating Arc Length of Ellipse - Mark Hardman - 10-16-2014 07:59 PM

(10-16-2014 07:41 PM)Tim Wessman Wrote:  Works fine here (hw/emu), so I suspect that has been resolved with later CAS versions. Returns 9.68844822

I can reproduce the issue. If an approximate result is requested, then the definite integral immediately returns the result. However, if an exact answer is requested, then the current version (6031) of the emulator hangs.

[Image: attachment.php?aid=1136]


RE: Lockup Calculating Arc Length of Ellipse - parisse - 10-16-2014 08:08 PM

Checked with the latest version of Xcas:
int(sqrt(4*(sin(t))^2 + (cos(t))^2),t,0,2*pi)
returns integrate(sqrt(5/2-3/2*cos(2*t)),t,0,2*pi)
while
int(sqrt(4*(sin(t))^2 + (cos(t))^2),t,0.,2*pi)
returns 9.68844822055
I'll check tomorrow on the calc. The firmware is a bot old now compared to the latest version of Xcas, many bugs have been fixed in Xcas...


RE: Lockup Calculating Arc Length of Ellipse - Helge Gabert - 10-17-2014 04:16 AM

On the physical Prime, if one simplifies the integrand first with simplify(),

then int(sqrt(3*sin(x)^2+1),x,0,pi*2) does at least not hang the calculator (if that is any consolation) - - but it doesn't give an exact solution, either, rather an unnecessarily complicated integral of sqrt(-3/4*cos(2*x)+i*sin(2*x))+ ... with an info message "searching int of sqrt(...) where x is on the unit circle, using residues . . . sign error vector [<1,1>]". ?


RE: Lockup Calculating Arc Length of Ellipse - mkspence - 10-17-2014 05:07 AM

Unchecking EXACT fixes the problem and gives an instant result.

(had a similar problem with hangs when doing an inverse Laplace transform, except there, unchecking EXACT caused the problem)


RE: Lockup Calculating Arc Length of Ellipse - Helge Gabert - 10-17-2014 03:00 PM

Well, yes, but the idea (for me) is to obtain an exact solution, if possible . . . if you wanted the approximate solution in the first place, fine, but why not just calculate that in Home?


RE: Lockup Calculating Arc Length of Ellipse - Wes Loewer - 10-20-2014 08:10 AM

(10-17-2014 03:00 PM)Helge Gabert Wrote:  Well, yes, but the idea (for me) is to obtain an exact solution, if possible . . . if you wanted the approximate solution in the first place, fine, but why not just calculate that in Home?

I think this is one of those integrals that does not have a closed form solution.

Wolfram Alpha gives the exact answer as 4*E(-3) where E(x) is the "Complete Elliptic Integral of the Second Kind" which can be defined in terms an integral.

-wes


RE: Lockup Calculating Arc Length of Ellipse - Helge Gabert - 10-20-2014 02:20 PM

Yes, I know that. The prime could give that answer (4E-3), provided it knows about elliptic integrals, or an approximate value (after issuing an informational message), but certainly not lock up. However, my main point is, why work in CAS, when all you are after is an approximate solution? Do it in Home (or if you really like to work in CAS, put something like 2.0*pi into the limits in order to force an approximate solution). No CAS flags to change.


RE: Lockup Calculating Arc Length of Ellipse - parisse - 10-20-2014 06:04 PM

I don't plan to implement elliptic integrals now. Perhaps in the future, using the arithmetic-geometric mean.


RE: Lockup Calculating Arc Length of Ellipse - Helge Gabert - 10-20-2014 09:44 PM

Sounds good; thanks for the info!


RE: Lockup Calculating Arc Length of Ellipse - peacecalc - 10-21-2014 05:07 PM

Hallo all,

Quote:original from parisse:
Perhaps in the future, using the arithmetic-geometric mean.

Is the agm also a way to implement the incomplete elliptic integrals?

greetings
peaceglue