- #1
jackmell
- 1,807
- 54
I can't figure out how to format a variable isomorphic expression in Mathematica so that it will look nice. The best I can do will put parentheses around everything and expand powers. For example, given the array ##\{2,4,4,3,3\}##, I'd like Mathematica to write:
##\mathbb{Z}_2\times\mathbb{Z}_{2^2}\times \mathbb{Z}_{2^2}\times \mathbb{Z}_3\times \mathbb{Z}_3##
but the subscripts and number of them would be variable. This code:
will output
##(((\mathbb{Z}_2\times\mathbb{Z}_{16})\times\mathbb{Z}_{16})\times\mathbb{Z}_3\times\mathbb{Z}_3##. and that's not ok; I need to keep the exponents in their un-expanded format like ##2^2##, and also separate the prime powers and eliminate the parenthesis or preferably, put parenthesis only around like prime powers . Is there anyway to modify my code so that the output will look like the first format? If I try to convert everything to strings, the subscripts are much too low and don't look nice. Basically, my objective is to construct an isomorphic expression like above for variable ##n=p_1^{e_1}p_2^{e_2}\cdots p_n^{e_n}##
Ok thanks for reading,
Jack
##\mathbb{Z}_2\times\mathbb{Z}_{2^2}\times \mathbb{Z}_{2^2}\times \mathbb{Z}_3\times \mathbb{Z}_3##
but the subscripts and number of them would be variable. This code:
Code:
mySubscripts = {2, 2^4, 2^4, 3, 3};
expression =
SubscriptBox["\[DoubleStruckCapitalZ]", mySubscripts[[1]]] //
DisplayForm;
For[i = 2, i <= Length[mySubscripts], i++,
expression =
expression \[Cross]SubscriptBox["\[DoubleStruckCapitalZ]",
mySubscripts[[i]]] // DisplayForm;
];
Style[expression, 40]
will output
##(((\mathbb{Z}_2\times\mathbb{Z}_{16})\times\mathbb{Z}_{16})\times\mathbb{Z}_3\times\mathbb{Z}_3##. and that's not ok; I need to keep the exponents in their un-expanded format like ##2^2##, and also separate the prime powers and eliminate the parenthesis or preferably, put parenthesis only around like prime powers . Is there anyway to modify my code so that the output will look like the first format? If I try to convert everything to strings, the subscripts are much too low and don't look nice. Basically, my objective is to construct an isomorphic expression like above for variable ##n=p_1^{e_1}p_2^{e_2}\cdots p_n^{e_n}##
Ok thanks for reading,
Jack
Last edited: