1
$\begingroup$

Suppose Subscript[x, #] & /@ {1, 3, 7} that returns {x_1,x_3,x_7}. Now how can I get x_1x_3x_7?

Tried it already...

enter image description here

P.s. I am trying to understand this thread deeper about converting binary mlfs to mlfs.

$\endgroup$

2 Answers 2

5
$\begingroup$

It is due to precedence. Need to use () in this case.

Times @@ (Subscript[x, #] & /@ {1, 3, 7})

Mathematica graphics

See this when-is-fg-not-the-same-as-fg topic for table of precedence in Mathematica.

$\endgroup$
1
  • $\begingroup$ Yes but my Mathematica is returning {x,3x,7x} -- oouch brackets missing?! So my version operated on the Subscript thing, not the whole thing. Thank you! +1 $\endgroup$
    – hhh
    Nov 10, 2013 at 19:27
3
$\begingroup$

Two more solutions:

Times @@ Thread@Subscript[x, {1, 3, 7}]

In the notebook it can be written more compactly

enter image description here

The second one shows the behavior of /@

Subscript[x, #] & /@ Unevaluated@Times[1, 3, 7]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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