There are two aspects in this problem depending on the exact definition of the task, and, as we shall see, both are completely solved by MMA without any additional facility.
The aspects are
a) calculate the interpolation of the definite integral $f=\int_0^t \sqrt{1+x^3} \, dx$
b) calculate the interpolation of the antiderivative $fad=\int\sqrt{1+x^3} \, dx$
Part a) interpolation of Jim's definite integral
There are no problems in interpolating your definite integral if you do it in two steps.
Step 1:
Calculate the definite integral (Mathematica does this exactly)
f = Integrate[Sqrt[1 + x^3], {x, 0, t}, Assumptions -> t >= -1]
(* -> (t^3)^(1/3) Hypergeometric2F1[-(1/2), 1/3, 4/3, -t^3] *)
Step 2:
Do the interpolation
fi = FunctionInterpolation[f, {t, 0, 10}]
(* -> InterpolatingFunction[{{0.`,10.`}},"<>"] *)
And finally check the equality of f and fi:
Plot[{f, fi[t]}, {t, 0, 10}]
(* skip the picture *)
For completeness:
$Version
(* -> "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *)
This procedure works fine also with many other functions, e.g. integer powers other than 3 under the sqrt.
Part b) interpolation of the antiderivative
The antiderivative is given by the indefinite integral :
fad = Integrate[Sqrt[1 + x^3], x]
$\frac{2 \left(x+x^4+(-1)^{1/6} 3^{3/4} \sqrt{-(-1)^{1/6} \left((-1)^{2/3}+x\right)} \sqrt{1+(-1)^{1/3} x+(-1)^{2/3} x^2} \text{EllipticF}\left[\text{ArcSin}\left[\frac{\sqrt{-(-1)^{5/6} (1+x)}}{3^{1/4}}\right],(-1)^{1/3}\right]\right)}{5 \sqrt{1+x^3}}$
This quantity, besides having a small imaginary part
fad /. x -> 1.25
(* -> 2.34276 - 1.17815*10^-16 I *)
has a dicontinuity in both Re and Im:
Plot[{Re[fad], Im[fad]}, {x, 0, 3}, PlotRange -> {-2, 5},
PlotLabel -> "Re and Im of the antiderivative fad of \!\(\*SqrtBox[\(1 + \
x^3\)]\)", AxesLabel -> {"x", "Re/Im[fad]"}]
Discontinuities of antiderivatives are quite common, and they have been discussed in this community several times (cf. for example Mismatch between numerical and analytic evaluation of an integral)
This could potentially cause a problem for FunctionInterpolate over an interval including the jump.
But it is not the case here !
Rather, the interpolation returns the correct complex valued function, with just announcing - as it should do - an accuracy problem connected with the jump:
fadi = FunctionInterpolation[fad, {x, 0, 5}]
FunctionInterpolation::ncvb: FunctionInterpolation failed to meet the prescribed accuracy and precision goals after 6 recursive bisections near x = {1.99219}. Continuing to refine elsewhere. >>
(* InterpolatingFunction[{{0.`,5.`}},"<>"] *)
Visualizing both Re and Im of the interpolation
Plot[{Re[fadi[t]], Im[fadi[t]]}, {t, 0, 3}, PlotRange -> {-2, 5}, PlotLabel ->
"Re and Im of the interpolation of the \nantiderivative fadi of \\!\(\*SqrtBox[\(1 + x^3\)]\)", AxesLabel -> {"x", "Re/Im[fadi]"}]
It shows agreement with the original function except, as expected, in the vicinity of the jumps.
Summarizing part b)
the interpolation of the true antiderivative is done perfectly well by Mathematica with only a justified accuracy error message due to the jump.
Conclusion
I have checked the complete code with a fresh kernel and can state that no problems are encountered in version 8 for both interpretations of the problem.
Best regards,
Wolfgang
FunctionInterpolation[Integrate[Sqrt[1 + x^3], {x, 0, t}], {t, 0, 10}]
does not give the errors you indicate, butFunctionInterpolation[Evaluate@Integrate[Sqrt[1 + x^3], {x, 0, t}], {t, 0, 10}]
does give them. (The reason has to do with theConditionalExpression
returned when theIntegrate
is evaluated without assumptions or a definite value fort
.) But can you confirm the same behavior? If not, what version of Mathematica are you using? $\endgroup$