I am trying to check if a function remains unevaluated.
For example
$$\int \ln ^5(3 x) \sec (3 x) \, dx$$
remains unevaluated in Mathematica, instead $$\int \sec (3 x) \, dx$$ doesn't.
What I tried is
func = Log[3 x]^5*Sec[3 x];
IntFunc = With[{function = func}, HoldForm[Integrate[function, x]]];
SameQ[IntFunc,ReleaseHold[IntFunc]]
which returns False
. I also tried
Equal[IntFunc,ReleaseHold[IntFunc]]
which remains unevaluated. I am pretty sure that this has to do with Hold
$(*)$ but I don't understand how to fix this. Is there a way to test if a function remains unevaluatd? In other words, get True
if it's unevaluated and False
if it's evaluated?
$(*)$ Because when I try:
SameQ[Integrate[func, x], ReleaseHold[IntFunc]]
it returns True
.
ValueQ
should do the trick. $\endgroup$ValueQ[expr]
givesTrue
if a value has been defined forexpr
, and givesFalse
otherwise.ValueQ
givesFalse
only ifexpr
would not change if it were to be entered as Wolfram Language input. $\endgroup$