|
[Date Index]
[Thread Index]
[Author Index]
RE: Denoting a Cartesian Product
- To: mathgroup at smc.vnet.net
- Subject: [mg91061] RE: [mg90937] Denoting a Cartesian Product
- From: "Jose Luis Gomez" <jose.luis.gomez at itesm.mx>
- Date: Tue, 5 Aug 2008 04:01:06 -0400 (EDT)
- Organization: ITESM
- References: <200807300753.DAA17781@smc.vnet.net>
(*
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 =
in
a similar way to the sigma notation for sums and the exponent notation =
for
arithmetic powers:
http://homepage.cem.itesm.mx/lgomez/quantum/tprodtpow/tprodtpow.html
Below I include internal programming code from that add-on.
I hope this code can be useful for you
Jose
Mexico
*)
(*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_}] :=
(Apply[zz075NonCommutativeTimes,
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*)
SetOptions[InputNotebook[],
InputAliases -> {"tprod" ->
TagBox[RowBox[{UnderoverscriptBox["\[CircleTimes]",
TagBox[RowBox[{"\[Placeholder]", "=", "\[Placeholder]"}],
zz020TPini,
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 *)
MakeExpression[
TagBox[
RowBox[{UnderoverscriptBox["\[CircleTimes]",
TagBox[RowBox[{j_, "=", ini_}],
zz020TPini, opts1___],
TagBox[end_, zz020TPend, opts2___]],
TagBox[data_, zz020TPdat, opts3___]}],
zz020TP, opts0___], form_] :=
MakeExpression[
RowBox[{"zz020TensorProduct", "[", data,
",{", j, ",", ini, ",", end, "}]"}],
form];
(*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 /:
MakeBoxes[
zz020TensorProduct[data_, {j_, ini_, end_}], form_] :=
TagBox[
RowBox[{UnderoverscriptBox["\[CircleTimes]",
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 verizon.net]
Enviado el: Mi=E9rcoles, 30 de Julio de 2008 02:54
Para: mathgroup at smc.vnet.net
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 =
X,
but the look isn't right (by setting ScriptLevel to 0, indexing appears =
over
and under the X). Am hoping there's an easy way.
Thanks.
Bruce
*)
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
|