MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Denoting a Cartesian Product

  • To: mathgroup at
  • Subject: [mg91061] RE: [mg90937] Denoting a Cartesian Product
  • From: "Jose Luis Gomez" <jose.luis.gomez at>
  • Date: Tue, 5 Aug 2008 04:01:06 -0400 (EDT)
  • Organization: ITESM
  • References: <>

Dear Bruce

We use \[CircleTimes] for the input and output of "Quantum Products" and
"Quantum Powers" of Quantum-Computing qubits in our Quantum Mathematica
Add-on. As you can see in this part Quantum's documentation, they behave =
a similar way to the sigma notation for sums and the exponent notation =
arithmetic powers:

Below I include internal programming code from that add-on.
I hope this code can be useful for you
(*Attributes for zz020TensorProduct: *)

SetAttributes[zz020TensorProduct, {HoldAll}];

(*Rules for zz020TensorProduct
notice in the following definition the weird way
to check that some of the patterns are integer.
This is because of the HoldAll attribute:those patterns must be
or evolve to integers,but I need HoldAll because I need two
pattens that must not evolve,j and data[j],to shield
from possible global variable with
the same name as the dummy index j *)

zz020TensorProduct[data_, {j_Symbol, ini_, end_}] :=
     Reverse[Table[data, {j, ini, end}]]]) /;
   ((Head[ini] === Integer) && (Head[end] === Integer));

(*The final user will be able to
obtain the tensor product template
by pressing [ESC]tprod[ESC]
after evaluating next code*)

 InputAliases -> {"tprod" ->
        TagBox[RowBox[{"\[Placeholder]", "=", "\[Placeholder]"}],
         Editable -> True, Selectable -> True],
        TagBox["\[Placeholder]", zz020TPend,
         Editable -> True, Selectable -> True]],
       TagBox["\[Placeholder]", zz020TPdat,
        Editable -> True, Selectable -> True]}],
     zz020TP, Editable -> False, Selectable -> False]}]

(*The template that was programmed above will
be transformed into a Mathematica expression
after evaluating next code *)

       TagBox[RowBox[{j_, "=", ini_}],
        zz020TPini, opts1___],
       TagBox[end_, zz020TPend, opts2___]],
      TagBox[data_, zz020TPdat, opts3___]}],
    zz020TP, opts0___], form_] :=
   RowBox[{"zz020TensorProduct", "[", data,
     ",{", j, ",", ini, ",", end, "}]"}],

(*Output of zz020TensorProduct:
if the template did Not evaluate
(maybe because the end value is
not an integer, but a variable),
then zz020TensorProduct will produce
again the same template
zz020TensorProduct /:
   zz020TensorProduct[data_, {j_, ini_, end_}], form_] :=
      TagBox[RowBox[{MakeBoxes[j, form],
         "=", MakeBoxes[ini, form]}],
       zz020TPini, Editable -> True, Selectable -> True],
      TagBox[MakeBoxes[end, form], zz020TPend,
       Editable -> True, Selectable -> True]],
     TagBox[RowBox[{"(", MakeBoxes[data, form], ")"}],
      zz020TPdat, Editable -> True, Selectable -> True]}],
   zz020TP, Editable -> False, Selectable -> False];

-----Mensaje original-----
De: Bruce Colletti [mailto:bwcolletti at]
Enviado el: Mi=E9rcoles, 30 de Julio de 2008 02:54
Para: mathgroup at
Asunto: [mg90937] Denoting a Cartesian Product

Re Mathematica 6.0.3 under WinXP.

In a text cell, how would I denote the n-fold Cartesian Product of set B
(without saying B x B x ... x B)?

I've used the basic input palette's summation button, replacing sigma by =
but the look isn't right (by setting ScriptLevel to 0, indexing appears =
and under the X).  Am hoping there's an easy way.



  • Prev by Date: Re: Incoherent value for partial derivative
  • Next by Date: Evaluate part of rhs of RuleDelayed
  • Previous by thread: Re: Denoting a Cartesian Product
  • Next by thread: Can not run Mathematica 6.0.3 on Fedora 9