In case I want to know whether a given function $f(t)$ have some property, I tried to write something like this:

IsSuppFun[f_[t_]] := Resolve[
ForAll[t, 0 <=t <= 2&&t\[Element] Reals,
 f[t] + D[f[t], {t, 2}] >= 0]]

Which means, if the given function satisfies the condition: $f(t)+f''(t)\geq 0$ for all $0\leq t\leq 2$, then return TRUE, else return False.

The problem is that it is not work as I supposed, for example, if I define


then the output is:

IsSuppFun[-3 + t^2]

If I separate the code as

Resolve[ForAll[t, 0 <= t <= 2 Pi && t \[Element] Reals, F[t] + F''[t] >= 0]]

Which will get the Right Answer!

Where did I go wrong?

Solution is use the HoldAll attribute for the function IsSuppFun, Please see below for the answer!

there is my another problem in the same line: If I have tried to add another condition as:

SetAttributes[IsSuppFun, HoldAll]
IsSuppFun[f_[t_]] := 
Resolve[ForAll[t, 0 <= t <= 2 && t \[Element] Reals, (f[t] + D[f[t], {t, 2}] >= 0)&&(f[0]==f[2])]]

then with the same test function:

F[t_] := t^2 - 3

the output is not as desired True or False, but as:

\!\(\*SubscriptBox[\(\[ForAll]\), \(t\)]\(! \((0 <= t <= 2 &&  t \[Element] Reals)\)\)\)

May be I should change the last question as (to make things clear and simple):

SetAttributes[{IsSuppFun}, HoldAll]
IsSuppFun[f_[t_]] := Resolve[
0<= t <= 2 && t \[Element] Reals,
f[1] >= 0]

with the test function as:

F[t_] := Sin[t]

then the output of


is True; But if I have change it as

SetAttributes[{IsSuppFun}, HoldAll]
IsSuppFun[f_[t_]] := Resolve[
0<= t <= 2 && t \[Element] Reals,
f[1] <= 0]

Then the same test function gives neither True nor False. (I Suppose it False!) Why?

  • $\begingroup$ I think the problem is specifying the function's argument in IsSuppFun. Try : bigF[t_] = t^2 - 3; IsSuppFun[bigF]. $\endgroup$ Oct 19, 2012 at 10:38
  • $\begingroup$ van abel, I think you are still confusing the second and third arguments of ForAll perhaps? In your added example you are essentially doing: Resolve[ForAll[t, 0 <= t <= 2 && t \[Element] Reals, False]] because F[0]==F[2] is False. $\endgroup$
    – Mr.Wizard
    Oct 19, 2012 at 11:21

3 Answers 3


This answer intends to answer both parts of the question. Originally it answered only the first part. Below is the original answer. Scroll down for the second part.

I interchanged the third and second argument of ForAll and gave the function IsSuppFun attribute HoldAll, and it worked!

So I wrote

SetAttributes[IsSuppFun, HoldAll]
IsSuppFun[f_[t_]] := 
   0 <= t <= 2 ,
   f[t] + D[f[t], {t, 2}] >= 0


f[t_] := t^4



Evaluates to True.

Second part

I removed the t \[Element] Reals, because it seemed redundant, or possibly wrong syntax. As it turned out, the new function worked.

SetAttributes[IsSuppFunGE, HoldAll]
IsSuppFunGE[f_[t_]] :=
  Resolve[ForAll[t, 0 <= t <= 2, f[1] >= 0]];

(* testcases*)
f[t_] := Sin[t];
g[t_] := Sin[t] - 2;
h[t_] := Cos[t] + 1;

Given these definitions,

{IsSuppFunGE[f[x]] , IsSuppFunGE[g[x]], IsSuppFunGE[h[x]]}

evaluates to

{True, False, True}

The question may arise if Mathematica is still using real numbers, as this is now not specified. The fact that the expression

Resolve[ForAll[t, 0 <= t <= 4, t != Pi]]

evaluates to False, may add confidence that it does indeed use real numbers (already).

  • $\begingroup$ Jacob, you can select your block of code in the editor and click the { } symbol above it to format your code. $\endgroup$
    – Mr.Wizard
    Oct 19, 2012 at 10:44
  • $\begingroup$ Ok, I will try. Thanks! $\endgroup$ Oct 19, 2012 at 10:47
  • $\begingroup$ Don't miss this: mathematica.stackexchange.com/editing-help $\endgroup$
    – Mr.Wizard
    Oct 19, 2012 at 10:48
  • $\begingroup$ Yes, I have made some mistake in the first edition, in which I have misplace the second and third parameter of ForAll. $\endgroup$
    – van abel
    Oct 19, 2012 at 10:48
  • $\begingroup$ @Mr.Wizard thanks, I have checked it out. Now, as our answers are equivalent (I guess t \[Element] Reals only makes a difference if it is put before the inequalities), I suppose I should delete my answer. Correct? $\endgroup$ Oct 19, 2012 at 11:09

You may be able to get what you want by setting a Hold attribute on your function:

SetAttributes[IsSuppFun, HoldAll]

IsSuppFun[f_[t_]] := 
 Resolve[ForAll[t, 0 <= t <= 2 && t \[Element] Reals, f[t] + D[f[t], {t, 2}] >= 0]]

f[t_] := t^2 - 3



  • $\begingroup$ That works, Thanks! $\endgroup$
    – van abel
    Oct 19, 2012 at 10:46
  • $\begingroup$ Sorry, there still some problem, if I replace f by F in the test case, then the output has changed! $\endgroup$
    – van abel
    Oct 19, 2012 at 10:51
  • $\begingroup$ @vanabel your comment got cut off -- I changed F to f just as a matter of habit, but I forgot to try it the other way first. I'll do that now. $\endgroup$
    – Mr.Wizard
    Oct 19, 2012 at 10:53
  • $\begingroup$ @van abel it seems to still work the same for me. Perhaps you could to do a ClearAll[IsSuppFun, f, F, t] and test it again? $\endgroup$
    – Mr.Wizard
    Oct 19, 2012 at 10:55
  • $\begingroup$ Yes, I have tested again, it works for me too! Thanks, but there is another problem, if I have tried to add a condition to the third parameter, why it not works? :(f[t] + D[f[t], {t, 2}] >= 0) && (f[0] == f[2]) $\endgroup$
    – van abel
    Oct 19, 2012 at 11:02

I would use this Convert an expression to a Function as follows

 IsSuppFun[F_] := Module[{t,f= extractPureFunction[F]}, Resolve[
      ForAll[t, 0 <=t <= 2&&t\[Element] Reals,
      f[t] + D[f[t], {t, 2}] >= 0]]]

so that I don't have to worry about which variable is used.

The credit for the extractPureFunction that I use goes to Daniel Lichtblau


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.