1
$\begingroup$

I have the list R:

R={{-π, -π}, {-π, -(π/2)}, {-π, 0}, {-π, π/2}, 
{-(π/2), -π}, {-(π/2), -(π/2)}, {-(π/2), 0}, {-(π/2), π/2}, 
{0, -π}, {0, -(π/2)}, {0, 0}, {0, π/2}, 
{π/2, -π}, {π/2, -(π/2)}, {π/2, 0}, {π/2, π/2}, 
{-π, -π}, {-π, -(π/2)}, {-π, 0}, {-π, π/2}, 
{-(π/2), -π}, {-(π/2), -(π/2)}, {-(π/2), 0}, {-(π/2),π/2}, 
{0, -π}, {0, -(π/2)}, {0, 0}, {0, π/2}, 
{π/2, -π}, {π/2, -(π/2)}, {π/2, 0}, {π/2, π/2}} 

How can I produce the list $(1_{(-\pi,-\pi)}, 1_{(-\pi/2,-\pi/2)}, \dots, 1_{(-\pi,-\pi)}, \dots, 1_{(\pi/2,\pi/2)}) $, i.e make the elements of the list R indices of the elements of another list with the same Length?

Can I also add a superscript to the elements of the new list? E.g $(1^{a}_{(-\pi,-\pi)}, 1^{a}_{(-\pi/2,-\pi/2)}, \dots, 1^{b}_{(-\pi/2,-\pi/2)},\dots, 1^{b}_{(\pi/2,\pi/2)}) $

$\endgroup$

1 Answer 1

3
$\begingroup$

You mean something like:

Subscript[1, ##] & @@@ R

and:

MapThread[
 Subsuperscript[1, Row[#1, ","], #2]&,
 {
  R,
  Join[
    ConstantArray["a", Length[R]/2], 
    ConstantArray["b", Length[R]/2]
  ]
 }
]

?

Edit

If you want parentheses around the subscripts, you can use:

Subsuperscript[1, Row[{"(", Row[#1, ","], ")"}], #2]&

in the MapThread instead.

$\endgroup$
2
  • $\begingroup$ Can I include the subscripts in parentheses or curly brackets e.g $1_{(-\pi,-\pi)}$ or $1_{\{-\pi,-\pi\}}$? $\endgroup$
    – geom
    Jan 19, 2021 at 11:13
  • 1
    $\begingroup$ You can use Subsuperscript[1, #1, #2]& in the 2nd code block instead if you want curly brackets. Subsuperscript[1, Row[{"(", Row[#1, ","], ")"}], #2]& gives you parentheses. $\endgroup$ Jan 19, 2021 at 11:21

Your Answer

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

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