File modules/editor/codemirror/mode/mathematica/index.html

Last commit: Sun Dec 17 01:14:09 2017 +0100	Jan Dankert	Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 <!doctype html> 2 3 <title>CodeMirror: Mathematica mode</title> 4 <meta charset="utf-8"/> 5 <link rel=stylesheet href="../../doc/docs.css"> 6 7 <link rel=stylesheet href=../../lib/codemirror.css> 8 <script src=../../lib/codemirror.js></script> 9 <script src=../../addon/edit/matchbrackets.js></script> 10 <script src=mathematica.js></script> 11 <style type=text/css> 12 .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} 13 </style> 14 <div id=nav> 15 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> 16 17 <ul> 18 <li><a href="../../index.html">Home</a> 19 <li><a href="../../doc/manual.html">Manual</a> 20 <li><a href="https://github.com/codemirror/codemirror">Code</a> 21 </ul> 22 <ul> 23 <li><a href="../index.html">Language modes</a> 24 <li><a class=active href="#">Mathematica</a> 25 </ul> 26 </div> 27 28 <article> 29 <h2>Mathematica mode</h2> 30 31 32 <textarea id="mathematicaCode"> 33 (* example Mathematica code *) 34 (* Dualisiert wird anhand einer Polarität an einer 35 Quadrik $x^t Q x = 0$ mit regulärer Matrix $Q$ (also 36 mit $det(Q) \neq 0$), z.B. die Identitätsmatrix. 37 $p$ ist eine Liste von Polynomen - ein Ideal. *) 38 dualize::"singular" = "Q must be regular: found Det[Q]==0."; 39 dualize[ Q_, p_ ] := Block[ 40 { m, n, xv, lv, uv, vars, polys, dual }, 41 If[Det[Q] == 0, 42 Message[dualize::"singular"], 43 m = Length[p]; 44 n = Length[Q] - 1; 45 xv = Table[Subscript[x, i], {i, 0, n}]; 46 lv = Table[Subscript[l, i], {i, 1, m}]; 47 uv = Table[Subscript[u, i], {i, 0, n}]; 48 (* Konstruiere Ideal polys. *) 49 If[m == 0, 50 polys = Q.uv, 51 polys = Join[p, Q.uv - Transpose[Outer[D, p, xv]].lv] 52 ]; 53 (* Eliminiere die ersten n + 1 + m Variablen xv und lv 54 aus dem Ideal polys. *) 55 vars = Join[xv, lv]; 56 dual = GroebnerBasis[polys, uv, vars]; 57 (* Ersetze u mit x im Ergebnis. *) 58 ReplaceAll[dual, Rule[u, x]] 59 ] 60 ] 61 </textarea> 62 63 <script> 64 var mathematicaEditor = CodeMirror.fromTextArea(document.getElementById('mathematicaCode'), { 65 mode: 'text/x-mathematica', 66 lineNumbers: true, 67 matchBrackets: true 68 }); 69 </script> 70 71 <p><strong>MIME types defined:</strong> <code>text/x-mathematica</code> (Mathematica).</p> 72 </article>
Download modules/editor/codemirror/mode/mathematica/index.html
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.