I have a list ep = {I Sqrt[2], {{I, 1/GoldenRatio, Sqrt[2]}, {1, 0, 1}}} and I want to write a function that will output the list ep in the following forms:




Playing in the Mathematica Notebook, I did the following:

myOutputForm[ep_List] := 
    Module[{ep1, epe, r},
        ep1 = Map[HoldForm[#] &, ep[[2]][[1]]]; 
        epe = Map[HoldForm[#] &, ep[[2]][[2]]];
        r = Apply[Times, MapThread[Power, {ep1, epe}]]

myOutputForm[ep] gives this as output


Which is a bit closer to OutFormNotOverK.

How do I make this function to achieve what I have in




Any suggestion will be much appreciated.

  • 1
    $\begingroup$ The simpleset way is using the Text cell(shortcut for Alt+7), then you can use the shortcup Ctrl+9 to write your formula. See here $\endgroup$
    – xyz
    Commented Nov 23, 2015 at 14:16

1 Answer 1


Here are two equivalent suggestions to obtain your first form that are slightly more compact than what you have already:

ep[[1]] == Inner[Defer@*Power, Sequence @@ ep[[2]], Times]
ep[[1]] == Times @@ MapThread[Defer@*Power, ep[[2]]]

Mathematica graphics

And here is a suggestion for your second format:

With[{base = ep[[1]]}, HoldForm@Power[base, k]] ==
   Map[Power[#, k] &, HoldForm /@ ep[[2, 1]]], ep[[2, 2]],

Mathematica graphics

As for the ordering of factors on the right hand side of these expressions, that is the canonical order that Mathematica likes. Although that is not what you wrote, hopefully that is not an issue, because trying to change that is probably a hopeless battle.

  • $\begingroup$ the order is not a problem at all. My challenge is actually making the output exactly the same (up to the ordering) as presented in the images. In particular, I want the parenthesis and the dots also. $\endgroup$
    – wisedoe
    Commented Nov 23, 2015 at 13:31
  • $\begingroup$ @evansdoe Just to make sure, do you really need to generate this programmatically though? If the format is what you want, could you just type in the formulae exactly as you like them? Could you provide some context as to what you need this for? $\endgroup$
    – MarcoB
    Commented Nov 23, 2015 at 15:00
  • $\begingroup$ This is the format I want them. Note that I use LaTeX in writing the format of the output. ` ( i \sqrt{2} )^{k} == ( ( i )^{k} )^{1} \cdot ( ( \sqrt{2} )^{k} )^{1} \cdot ( ( \frac{1}{GoldenRation} )^{k} )^{0} ` and the second one is as follows ` i \sqrt{2} == ( i )^{1} \cdot ( \sqrt{2} )^{1} \cdot ( \frac{1}{GoldenRation} )^{0} ` I need it for a project I am working on. The objects we treat are viewed differently at each level. In particular we, consider ( i \sqrt{2} )^{k} as sequences where k runs over a specified range. This is all I can say. $\endgroup$
    – wisedoe
    Commented Nov 23, 2015 at 21:22
  • $\begingroup$ I have attached a file indicating the exact output format I require. drive.google.com/file/d/0B_EVcKlnBFPcNFByVDhRaEUyVVk/… $\endgroup$
    – wisedoe
    Commented Nov 23, 2015 at 21:35
  • 1
    $\begingroup$ @evansdoe the latex format that you provided here is not in the same order as with the initial question. $\endgroup$
    – mahmoh
    Commented Apr 11, 2017 at 21:03

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.