# How to get the boolean value of an inequality involving an InterpolatingFunction?

Here's the code:

yan = FunctionInterpolation[x^2, {x, -1, 1}];
FullSimplify[yan[x] > -1, -1 < x < 1]

Needless to say, what I expect to see in the output is "True", but FullSimplify doesn't seem to work. What function should I turn to?

@J.M. @belisarius @acl

yan = FunctionInterpolation[x^2, {x, -1, 1}];
MinValue[{yan[x], -1 < x < 1},x]>-1
-

Huh? "seems not to work" is correct? I just delete it because of my language sense…OK, let me add it back. – xzczd Aug 6 '12 at 5:55
"doesn't seem to work" as you added is more standard, but in my opinion "seems not to work" is also acceptable and understandable. – Mr.Wizard♦ Aug 6 '12 at 6:10
In fact I've become confused after I searched the Internet, so I turned to the standard form to be on the safe side 囧. – xzczd Aug 6 '12 at 6:47

## 2 Answers

The following is basically the same @acl did, but using the package InterpolatingFunctionAnatomy which (in principle) will behave better than peeking at the internal structures when Mma version changes.

Needs["DifferentialEquationsInterpolatingFunctionAnatomy"];
yan = FunctionInterpolation[x^2, {x, -1, 1}];

yin = InterpolatingPolynomial[Transpose[Flatten /@
{InterpolatingFunctionCoordinates@yan,
InterpolatingFunctionValuesOnGrid@yan}], x];
FullSimplify[yin > -1, -1 < x < 1]
(*
True
*)
-
very nice. how come I have less votes than you though, despite being first and explaining details?! Not fair! :) – acl Aug 5 '12 at 19:38
@acl That was because I forgot to upvote your answer. Easy to correct! :D – belisarius Aug 5 '12 at 19:40
really, I was joking! – acl Aug 5 '12 at 19:48

1
In fact, you don't need to load the package if you remember the actual syntax being used internally; in this case, it's yan["Coordinates"] and yan["ValuesOnGrid"] that can be used directly. Still, this works only because the original function was well approximated by a polynomial. In general, a polynomial interpolant can be more oscillatory than the piecewise polynomial interpolant used by InterpolatingFunction[]; be careful! – J. M.♦ Aug 5 '12 at 23:48
@J.M. yes, it was intended just for this case – belisarius Aug 5 '12 at 23:52
show 5 more comments

You can do this by explicitly constructing the InterpolatingPolynomial corresponding to yan, and then using FullSimplify:

yin = InterpolatingPolynomial[Transpose[Flatten /@ {yan[[3]],yan[[4]]}],x];
FullSimplify[yin > -1, -1 < x < 1]
(*True*)

Why does this work? Because yan actually has a list of points:

FullForm[yan]

so I can extract them with Transpose[Flatten /@ {yan[[3]],yan[[4]]}] and use them to construct a polynomial, which does the same thing as the interpolation function but which FullSimplify can now handle.

Maybe there's a better way to construct the InterpolatingPolynomial but this works.

-
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9109182357788086, "perplexity_flag": "middle"}