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
F[t_]:=t^2-3
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[
ForAll[t,
0<= t <= 2 && t \[Element] Reals,
f[1] >= 0]
]
with the test function as:
F[t_] := Sin[t]
then the output of
IsSuppFun[F[t]]
is True; But if I have change it as
SetAttributes[{IsSuppFun}, HoldAll]
IsSuppFun[f_[t_]] := Resolve[
ForAll[t,
0<= t <= 2 && t \[Element] Reals,
f[1] <= 0]
]
Then the same test function gives neither True nor False. (I Suppose it False!) Why?
IsSuppFun. Try :bigF[t_] = t^2 - 3; IsSuppFun[bigF]. – b.gates.you.know.what Oct 19 '12 at 10:38ForAllperhaps? In your added example you are essentially doing:Resolve[ForAll[t, 0 <= t <= 2 && t \[Element] Reals, False]]becauseF[0]==F[2]isFalse. – Mr.Wizard Oct 19 '12 at 11:21