3
$\begingroup$

I have an unknown multivariate function entry[x,y,z], which is positive. Then how to get FALSE and entry[1,2,3] in the following evaluations?

FullSimplify[entry[1, 2, 3] < 0, entry[_, _, _] > 0]
FullSimplify[Sqrt[entry[1, 2, 3]^2], entry[_, _, _] > 0]
$\endgroup$
4
  • 1
    $\begingroup$ Related: (6182) $\endgroup$
    – Mr.Wizard
    Commented Apr 8, 2015 at 15:37
  • $\begingroup$ Very closely related, probably a duplicate: Unknown function with arbitrary arguments assumption $\endgroup$
    – Jens
    Commented Apr 8, 2015 at 16:55
  • $\begingroup$ The accepted answer to the question I linked earlier also works for this case. So I would say it's a duplicate. You just have to do your simplifications wrapped by AssumingAll[entry[__]>0, ...] $\endgroup$
    – Jens
    Commented Apr 9, 2015 at 4:14
  • $\begingroup$ @Jens Thanks! Maybe I agree this is a duplicate. I am such a novice in Mathematica that I cannot immediately comprehand the commands in that "AssumingAll" function. So I gave my own poor solution beneath. I guess that "AssumingAll" is more advanced in functionality. It will be so nice of you to say something about that. $\endgroup$
    – xiaohuamao
    Commented Apr 9, 2015 at 4:27

2 Answers 2

1
$\begingroup$

This might be what you want:

myfullsimplify[expr_, assum_] := Module[
  {pat, tmp, seq},
  pat = FirstCase[Level[assum, Infinity], p[_]] /. p[x_] -> x;
  tmp = FirstCase[Level[expr, Infinity], pat];
  seq = {expr, assum} /. {pat -> #, p[_] -> #};
  FullSimplify @@ seq /. # -> tmp
]

It's used as follows:

myfullsimplify[entry[1, 2, 3] < 0, p[entry[_, _, _]] > 0]
myfullsimplify[Sqrt[entry[1, 2, 3]^2], p[entry[_, _, _]] > 0]

You'd have to wrap your pattern with p[...] though.

$\endgroup$
1
$\begingroup$

Here comes a simple solution, perhaps. The two cases characterize the usage well.

expr = Sqrt[f[y[qq], z]^2] + Sqrt[DD[2, 3, 4]^2] + (f[1, 2] > 0);

FullSimplify[expr, Thread[Cases[expr, x_[___] /; ! ValueQ[x], Infinity] > 0]]
FullSimplify[expr, Thread[Cases[expr, f[___] /; ! ValueQ[f], Infinity] > 0]]

Out[94]= True + DD[2, 3, 4] + f[y[qq], z]
Out[95]= True + Sqrt[DD[2, 3, 4]^2] + f[y[qq], z]
$\endgroup$
2
  • $\begingroup$ The output doesn't seem to make mathematical sense because addition of logical values isn't defined. $\endgroup$
    – Jens
    Commented Apr 9, 2015 at 4:04
  • $\begingroup$ Yes. I just want to show the possible usage. $\endgroup$
    – xiaohuamao
    Commented Apr 9, 2015 at 4:13

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