HP Forums

Full Version: Fractional Part - A Difficult Integral
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here some results for integrating FP from zero to 5.8:


Maple V Release 3.0

evalf(int(frac(x), x=0..5.8)) 2.820001887

Maxima 5.23.2

quad_qags(x-floor(x), x, 0, 5.8) [2.720000001263673,1.5265947617137954*10^-
8,3171,0]

PARI 2.4.2

intnum(x=0,5.8,frac(x)) 2.770657207613055496607250297

WolframAlpha 2011-5-28

integrate(frac(x),x,0,5.8) 2.82

CASIO fx-9860GII (& fx-5800P)

∫_0^5.8▒〖Frac X〗 dx 2.72

HP 42S

Gauss-Lagrange 16 point:

Divisions: 1 2.32
2 2.71441362769
3 2.95110930932
4 2.84122268726
5 2.72066778956
6 2.8405122545

HP 50G

Inbuilt integration programme: ∫_0^5.8▒〖FP(X)〗 dX

FIX 6 2.820116 in 1,232.15 seconds

Gauss-Lobatto 4 point formula with 7 and 13 point Kronrod extensions:

FIX 2 2.80
3 2.819
4 2.8199
5 2.82000
6 2.820000 in 12.34 seconds





SHARP EL-9650

∫_0^5.8▒〖fpart X〗 dxX 2.419454779

TI-84 Plus 2.53MP

fnInt(fPart(X),X,0,5.8) 2.720014333

TI-86 (tol = 1E-5)

fnInt(fPart x,x,0,5.8) 2.71992436738

TI-89 (& voyage 200 & 92(plus))

∫_0^5.8▒〖fPart (x)〗 dx 2.72000000036
(06-29-2014 11:36 AM)Gerald H Wrote: [ -> ]Here some results for integrating FP from zero to 5.8:

Another example (apart from WolframAlpha) where a pencil and paper approach is better. Wink
(06-29-2014 11:36 AM)Gerald H Wrote: [ -> ]Here some results for integrating FP from zero to 5.8:
WP34s:
2.819612562 after several minutes
Change the upper limit to 6.4 and try evaluating with the built-in integrator on any HP calculator that has one.
(06-29-2014 06:17 PM)kakima Wrote: [ -> ]Change the upper limit to 6.4 and try evaluating with the built-in integrator on any HP calculator that has one.

Link for the lazy: Numerical Integration on the 35S.
This is another example where most HP-calculators fail.

Cheers
Thomas
(06-29-2014 06:17 PM)kakima Wrote: [ -> ]Change the upper limit to 6.4 and try evaluating with the built-in integrator on any HP calculator that has one.

HP 50G Gauss-Lobatto 4 point formula with 7 and 13 point Kronrod extensions:

3.0489 in 20.8 sec
(06-29-2014 06:47 PM)Thomas Klemm Wrote: [ -> ]
(06-29-2014 06:17 PM)kakima Wrote: [ -> ]Change the upper limit to 6.4 and try evaluating with the built-in integrator on any HP calculator that has one.

Link for the lazy: Numerical Integration on the 35S.
This is another example where most HP-calculators fail.

Cheers
Thomas

What about to use a simple Monte Carlo method as a "pre-processor" to get a "rough estimate", ie.:

Code:
NIntegrate[x - Floor[x], {x, 0, 6.4}, 
 Method -> {"MonteCarloRule", "Points" -> 1000}]

returns always nice results around 3.08. So we can see whether the specific "precise" integration method with some "difficult" integrands has failed or not..

PS: another example from above posts:
Code:
NIntegrate[
 x*x*(x*x - 47*47)*(x*x - 88*88)*(x*x - 117*117), {x, -128, 128}, 
 Method -> {"MonteCarloRule", "Points" -> 1000}]
gives for example results around 2.72*10^16..
Numerical integration of things like Frac(x)dx do not gain by using high-order rules (Simpson's, Gauss, etc.) because the first derivative is not continuous.

Monte Carlo (and quasi Monte Carlo) does no worse than its usual performance (which isn't that good anyway) as the variance (or variation) is small.

One QMC example is to use the points (2j-1)/2N for j=1,N as an N-point integration formula. Another is to use Frac(N*Sqrt(2)) as a sequence to integrate these types of functions.

The last sequence is easy to compute; just add Frac(Sqrt(2)) at each step and reduce below 1.
Reference URL's