1
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Instead of /.List->And you can just Apply And: And@@(Element[ #, Reals ]& /@ list). $\endgroup$ – march Aug 21 '15 at 16:50
  • 3
    $\begingroup$ Depends on what you want to do, but things like Assuming[{x, y} ∈ Reals, (* stuff *)] work, FYI. $\endgroup$ – J. M.'s technical difficulties Aug 21 '15 at 16:52
  • $\begingroup$ Ah ok, didn't know that! In the documentation it was only with the | or {x, y, z} \[Element] Ball[] $\endgroup$ – NOhs Aug 21 '15 at 16:55
  • 1
    $\begingroup$ Also a list of assumptions should work with Simplify and the like ... so Element[#, Reals] & /@ list should be enough. $\endgroup$ – Bichoy Aug 22 '15 at 5:32
  • 1
    $\begingroup$ 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. $\endgroup$ – m_goldberg Aug 29 '15 at 12:11
3
$\begingroup$

The most straight-forward adaptation of your code is the following:

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
|improve this answer|||||
$\endgroup$

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.