6
$\begingroup$

Often I make simplifications or other operations with assumptions. Sometimes the assumptions simply state that all parameters involved are positive.

I wonder, if there is a short notation for such a situation?

Just to give some code

Simplify[expr[a,b,c,d,e,g,f],{a>0,b>0,c>0d>0,e>0,f>0}]

I dream about something like

 Simplify[expr[a,b,c,d,e,g,f],All>0]

This expression is, of course, a nonsense, but may be something in this direction.

Do you know something of this sort?

$\endgroup$
  • 1
    $\begingroup$ Simplify[expr[Sequence @@ #], Thread[# > 0]] &@{a, b, c, d, e, g, f} ? $\endgroup$ – Dr. belisarius Dec 8 '14 at 15:54
  • $\begingroup$ @belisarius Why do not you format this as the answer? $\endgroup$ – Alexei Boulbitch Dec 8 '14 at 16:14
  • $\begingroup$ @belisarius That's not really saving key strokes... $\endgroup$ – Sjoerd C. de Vries Dec 8 '14 at 16:31
  • $\begingroup$ @SjoerdC.deVries True, but you can pack it as in the last example in my answer below $\endgroup$ – Dr. belisarius Dec 8 '14 at 16:56
4
$\begingroup$

If you have version 10, you can also use AllTrue:

h[x__] :=Sign@Times[x]

Simplify[h[Sequence @@ #], AllTrue[#, Negative]] &@{a, b, c}
(* -1 *)

Simplify[h[Sequence @@ #], AllTrue[#, Negative]] &@{a, b, c, d}
(* 1 *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you, AllTrue is what I looked for. Thank you for pointing it out. $\endgroup$ – Alexei Boulbitch Dec 9 '14 at 11:56
  • $\begingroup$ @Alexei, thanks for the accept. $\endgroup$ – kglr Dec 9 '14 at 11:58
6
$\begingroup$

One way is:

Simplify[expr[Sequence @@ #], Thread[# > 0]] &@{a, b, c, d, e, g, f}

(* expr[a, b, c, d, e, g, f] .... Simplify has nothing to do in this simple case*)

g[x_, y_] := x + Abs@y
Simplify[g[Sequence @@ #], Thread[# > 0]] &@{a, b}

( a + b *)

packing it:

g[x_, y_] := x + Abs@y
simpWithAssump[symb_, vars_] := Simplify[symb[Sequence @@ #], Thread[# > 0]] &@vars
simpWithAssump[g, {a, b}]
(* a + b *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you, it is, indeed a way. I should have thought about it. Thank you. $\endgroup$ – Alexei Boulbitch Dec 9 '14 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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