Template:ConvergentCalculator-Start

Template
Use this template to start a table for calculating the convergents of the continued fraction of an irrational square root.

It writes the first two lines of the table, whose structure is different from the subsequent lines.

Usage
It is called by:

Note that all this template does is evaluate $p_1$ and $\dfrac {p_1} {q_1}$ and pass them and $a_0$ and $a_1$ as parameters to the call to ConvergentTable-Start.

The reason for this two-stage process is that you cannot use the  #expr  function within math delimiters, and you appear not to be able to use temporary variables within the context of a Template. Hence when using this technique, all the fields needed to be presented in the actual table are pre-calculated in this template and then passed into a second template, which is designed never to be actually called directly.

Subsequent rows of this table are added by calls to ConvergentCalculator.

The table is completed by adding  |}  to the page on which this template is invoked.

For an example of its use, see Continued Fraction Expansion of Irrational Square Root/Examples/13/Convergents.