Thread: December 2019
View Single Post
Old 2019-12-06, 05:45   #8
yae9911's Avatar
Jul 2019

31 Posts

The behavior of PARI's intnum is not unexpected, because of the discontinuity of derivative of abs(x) at zero. _num_ means numerical integration and unless the method automatically splits the interval, it will try to approximate the integrand by smooth functions or some other approximation. If you help intnum by splitting the interval, everything works fine:
(intnum(x=-1,0,(abs(x) - (x+1)/2)^2) + intnum(x=0,1,(abs(x) - (x+1)/2)^2) ) / 2
gives result 0.166666666666666666666666666666666666666666...

PARI can do formal integration for certain integrands
intformal((x - (x+1)/2)^2) = 1/12*x^3 - 1/4*x^2 + 1/4*x
intformal((-x - (x+1)/2)^2) = 3/4*x^3 + 3/4*x^2 + 1/4*x
Just plug in the integration limits and you get the same result - hopefully identical to the one obtained by pencil and paper.

Summary: PARI's intnum is perfectly suitable to determine if a solution is meeting the > 0.0001 criterion.
yae9911 is offline   Reply With Quote