Mathematica mode

x
 
1
(* example Mathematica code *)
2
(* Dualisiert wird anhand einer Polarität an einer
3
   Quadrik $x^t Q x = 0$ mit regulärer Matrix $Q$ (also
4
   mit $det(Q) \neq 0$), z.B. die Identitätsmatrix.
5
   $p$ ist eine Liste von Polynomen - ein Ideal. *)
6
dualize::"singular" = "Q must be regular: found Det[Q]==0.";
7
dualize[ Q_, p_ ] := Block[
8
    { m, n, xv, lv, uv, vars, polys, dual },
9
    If[Det[Q] == 0,
10
      Message[dualize::"singular"],
11
      m = Length[p];
12
      n = Length[Q] - 1;
13
      xv = Table[Subscript[x, i], {i, 0, n}];
14
      lv = Table[Subscript[l, i], {i, 1, m}];
15
      uv = Table[Subscript[u, i], {i, 0, n}];
16
      (* Konstruiere Ideal polys. *)
17
      If[m == 0,
18
        polys = Q.uv,
19
        polys = Join[p, Q.uv - Transpose[Outer[D, p, xv]].lv]
20
        ];
21
      (* Eliminiere die ersten n + 1 + m Variablen xv und lv
22
         aus dem Ideal polys. *)
23
      vars = Join[xv, lv];
24
      dual = GroebnerBasis[polys, uv, vars];
25
      (* Ersetze u mit x im Ergebnis. *)
26
      ReplaceAll[dual, Rule[u, x]]
27
      ]
28
    ]
29

MIME types defined: text/x-mathematica (Mathematica).