# How to assert that a list of variables is real in a nice and clean way

You can use the function Element to say e.g. $x,y,z\in\mathbb{R}$ via Element[x | y | z, Reals].

Now if I have a list of elements and want to say that they are all real I could do:

list = Array[x @ # &, 8]
Element[#, Reals]& /@ list /. List -> And


However, that seems unnecessarily complicated. Is there an easier way? Easier meaning shorter but also clear and easy to understand.

• Instead of /.List->And you can just Apply And: And@@(Element[ #, Reals ]& /@ list). Commented Aug 21, 2015 at 16:50
• Depends on what you want to do, but things like Assuming[{x, y} ∈ Reals, (* stuff *)] work, FYI. Commented Aug 21, 2015 at 16:52
• Ah ok, didn't know that! In the documentation it was only with the | or {x, y, z} \[Element] Ball[]
– NOhs
Commented Aug 21, 2015 at 16:55
• Also a list of assumptions should work with Simplify and the like ... so Element[#, Reals] & /@ list should be enough. Commented Aug 22, 2015 at 5:32
• The FullForm of {x, y} ∈ Reals is (x | y) ∈ Reals, so list ∈ Reals is by far the "nicest and cleanest" way to write your assertion. Commented Aug 29, 2015 at 12:11

list = Array[x, 8];
Apply[And, Element[#, Reals]& /@ list
(* x[1] ∈ Reals && x[2] ∈ Reals && x[3] ∈ Reals && x[4] ∈ Reals && x[5] ∈ Reals && x[6] ∈ Reals && x[7] ∈ Reals && x[8] ∈ Reals *)


Also, you can do

Element[Alternatives @@ list, Reals]


You can also do (according to GuessWhoItIs),

list ∈ Reals


Often, lists of assumptions are fine, so you can use (according to Bichoy)

Element[#, Reals] & /@ list