Templates

 

Templates

There follows a full list of template definitions.

The display shows where the parameters will be placed in the equations, the parameters being represented by the letters "a", "b", "c", etc. e.g. typing

int{sin ~x, ~x = 0, ~x = &infty., d~x}

in the HTML text, will produce the following to be displayed on the web page:

int{sin ~x,~x = 0,~x = &infty.,d~x}

i.e. in this example

  • a = "sin ~x",
  • b = "~x = 0",
  • c = "~x = &infty.",
  • d = "d~x".

Compare this with the description of "inf" in the list:

Templates - Full List

 

Templates - XML Source

template definitions are saved in an XML file. You can view the XML file by clicking on this link.

Templates are ultimately translated by into HTML tables. Each <Template> tag will have a <Name> subtag, which is the name used in your HTML source, and a <Descript> subtag giving a short description. The <RowCount> and <ColCount> tags tell the number of rows and columns in the HTML table.

The template consists of a number of <Element> tags. Each element corresponds to one cell of the HTML table and has the following properties:

  • <ERow>   Which row of the HTML table the cell belongs to.
  • <ECol>   Which column of the HTML table the cell belongs to.
    [Note the rows and columns are numbered from 0 in accordance with JavaScript indexing convention. So the cell in the first column of the first row of the table will have ERow = 0, ECol = 0.]
     
  • <EType>   The type can be "X" or "T" for text (the difference is historic), "W" for vertically repeatable symbols, such as the middle part of integral sign or brackets, "S" for scaleable or stretchable symbols, such as sum (Σ) which will be expanded depending on the "content". Finally "B" is a blank cell whose width is given by EVal.
     
  • <EVal>   Apart from a type B element, where this represents the width of the table cell, this property contains the text to be written to the table. Symbols can be included in this text, but they must be encoded as "*$name." instead of "&name." , since XML reserves the &amp. character.
    For type T or X elements, one of the input parameters can also be included in the text, coded as "%nnn", nnn is the 3-digit number of the parameter in the input arguments (starting from 001).
     
  • <ERowSpan>   the number of rows this cell spans (see properties of the HTML <td> tag).
  • <EColSpan>   the number of columns this cell spans.
     
  • <EVertAlign>   Vertical alignment: "T" - top, "M" - middle, "B" - bottom.
  • <EHorizAlign>   Horizontal alignment: "L" - left, "C" - centre, "R" - right.
     
  • <EScale>   A number showing how much the text in this cell is to be scaled up or down, 1 being 100% ( = no scaling), 2 is 200% (double size), 0.5 is 50% (half size).
     
  • <EStyle>   A CSS style to be applied to the cell (<td> tag). For example "color:red" or "lineHeight:70%". (Note that DOM naming rules apply to style names - see W3Schools DOM Style reference .)

Arrays and Matrices

Drawing arrays and matrices on your web page is a doddle with .

Only templates with a fixed layout can be defined completely in the template dictionary. Arrays and matrices can have many different dimensions, and it would require a dictionary entry for each one. Instead this type of structure is defined dynamically to accomodate the dimensions implicit in the input parameters.

Arrays

For the moment lets take arrays as an example. An array is a number of rows each with a number of elements. In an array is defined using the array{ } template. The parameters of array{ } represent the contents of the array. The rows are separated by a forward slash or oblique, "/", and each element within a row is separated by a comma. A simple example:

array{a_1 , a_2 , a_3 / b_1 , b_2 , b_3 / c_1 , c_2 , c_3  }
array{a_1 , a_2 , a_3 / b_1 , b_2 , b_3 / c_1 , c_2 , c_3 }

If some rows are shorter than others, spaces will appear at the end of the row:

array{a_1 , a_2  / b_1 , b_2 , b_3 / c_1 , c_2 }
array{a_1 , a_2 / b_1 , b_2 , b_3 / c_1 , c_2 }

If you want blank elements within a row, just leave the element out (but retain the comma as a placeholder):

array{a_1 , a_2 , a_3 / , , b_3 , b_4, b_5/ c_1 , c_2 }
array{a_1 , a_2 , a_3 / , , b_3 , b_4, b_5/ c_1 , c_2 }

Matrices

From a display point of view, a matrix is just an array within brackets. Use the matrix{ } template to draw a matrix. The parameters are exactly as for array{ }, so here are just a few examples for illustration:

Example 1

B _ _ = _ _ matrix{1,3,-2,8/0,-3,5,6/-2,0,0,4 }
B _ _ = _ _ matrix{1,3,-2,8/0,-3,5,6/-2,0,0,4 }

Example 2

A _ _ = _ _ matrix{~a_{1,1} , ~a_{1,2}, ~a_{1,3}  / ~a_{2,1} , 
   ~a_{2,2}, ~a_{2,3} / ~a_{3,1} , ~a_{3,2}, ~a_{3,3} }
A _ _ = _ _ matrix{~a_{1,1} , ~a_{1,2}, ~a_{1,3} / ~a_{2,1} , ~a_{2,2}, ~a_{2,3} / ~a_{3,1} , ~a_{3,2}, ~a_{3,3} }

Example 3

I_~n _ _ = _ _ matrix{1,0, ... ,0/0,1, ... , 0/:,:,^.._.,:/0,0, ... ,1}
I_~n _ _ = _ _ matrix{1,0, ... ,0/0,1, ... , 0/:,:,^.._.,:/0,0, ... ,1}

Example 4

matrix{ 2, -6, 1/ 6, 0, -2} matrix{ 1, 3, -2, 8/ 0, -3, 5, 6/ -2, 0, 0, 4} 
   _ _ = _ _ matrix{ 0, 24, -34, -16/ 10, 18, -12, 40}
matrix{ 2, -6, 1/ 6, 0, -2} matrix{ 1, 3, -2, 8/ 0, -3, 5, 6/ -2, 0, 0, 4} _ _ = _ _ matrix{ 0, 24, -34, -16/ 10, 18, -12, 40}

This last example will just allow me to plug another product. If you're doing a lot of numerical matrix calculations why not have a look at the ? Here's the previous example, but now the computer does all the calculation:

<script  type="text/javascript">
   cMatrix_Precision = 0;
   var matA = new cMatrix("2,-6,1/6,0,-2");
   var matB = new cMatrix("1,3,-2,8/0,-3,5,6/-2,0,0,4");
   document.write(matA.McPrint() + " " + matB.McPrint() + " _ _ = _ _ " + matA.Mult(matB).McPrint() );
</script>

Elegant or what?!

also does matrix addition, inverse, determinants, scalar product and lots more!

Determinants

A determinant is just a matrix behind bars!

Example 1
det{ 2, 3, -1/ 6, 1, -3/ 0, 2, 5}  _ _ = _ _  -80
det{ 2, 3, -1/ 6, 1, -3/ 0, 2, 5} _ _ = _ _ -80

Oh! Did I mention that also works out determinants?

<script  type="text/javascript">
   var matC = new cMatrix("2,3,-1/6,1,-3/0,2,5");
   document.write("the determinant of _ " + matC.McPrint() + " _ is _  " + matC.Determinant());
</script>

 

Example 2
det{1,&lambda;_1, ... ,&lambda;_1^{~r - 1}/:,:,,:/1,&lambda;_{~r},
   ... ,&lambda;_{~r}^{~r - 1}} _ _ is called #~{Vander Monde's Determinant}.
det{1,λ_1, ... ,λ_1^{~r - 1}/:,:,,:/1,λ_{~r}, ... ,λ_{~r}^{~r - 1}} _ _ is called #~{Van der Monde's Determinant}.