尝试(只要剪切和粘贴):
Needs["Notation`"]
Notation[ParsedBoxWrapper[
RowBox[{"A_", " ", "\[FilledSmallCircle]", " ",
"B_"}]] \[DoubleLongLeftRightArrow] ParsedBoxWrapper[
RowBox[{"Which", "[",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "A_", "]"}], "||",
RowBox[{"VectorQ", "[", "A_", "]"}]}], ")"}], "&&",
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "B_", "]"}], "||",
RowBox[{"VectorQ", "[", "B_", "]"}]}], ")"}]}], ",",
RowBox[{"A_", " ", ".", "B_"}], ",",
RowBox[{
RowBox[{"!",
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "A_", "]"}], "||",
RowBox[{"VectorQ", "[", "A_", "]"}]}], ")"}]}], "&&",
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "B_", "]"}], "||",
RowBox[{"VectorQ", "[", "B_", "]"}]}], ")"}]}], ",",
RowBox[{"A_", "[", "B_", "]"}], ",",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "A_", "]"}], "||",
RowBox[{"VectorQ", "[", "A_", "]"}]}], ")"}], "&&",
RowBox[{"!",
RowBox[{"(",
RowBox[{
RowBox[{"MatrixQ", "[", "B_", "]"}], "||",
RowBox[{"VectorQ", "[", "B_", "]"}]}], ")"}]}]}], ",",
RowBox[{"Transpose", "[",
RowBox[{"B_", "[",
RowBox[{"Transpose", "[", "A_", "]"}], "]"}], "]"}]}], "]"}]]]
现在,我已经与Notation
调色板进入了这个,所以实际上它看起来像这样在屏幕上:
(调色板插入各种盒,其中必要)。由于所有内容的显式字符串表示,我剪切和粘贴时看起来很糟糕。
编辑:也就是说:"Needs["Notation
型“]`,造成调色板出现点击第一个按钮,于是这个
![enter image description here](https://i.stack.imgur.com/A5J1A.png)
出现中的第一个黄色框中键入A_ \[FilledSmallCircle] B_
,并在。第二,
Which[(MatrixQ[A_]||VectorQ[A_])&&(MatrixQ[B_]||VectorQ[B_]),A_ .B_,!(MatrixQ[A_]||VectorQ[A_])&&(MatrixQ[B_]||VectorQ[B_]),A_[B_],(MatrixQ[A_]||VectorQ[A_])&&!(MatrixQ[B_]||VectorQ[B_]),Transpose[B_[Transpose[A_]]]]
结果看起来是这样的 ![enter image description here](https://i.stack.imgur.com/IoqMq.png)
,并在评估时定义你想要的。或者,在Needs
位之后,只需剪切并粘贴上面给出的内容即可。
左手边被解释(如果你把A_'和'\ [FilledSmallCircle]''之间有一个空格)作为'时报[\ [FilledSmallCircle],模式[A,空白[]],模式[B,空白[]]]'。你需要创建一个中缀符号。请参阅下面的各种答案。 – Simon