Template:PartialQuotientCalculator

Template
Use this template to add a row to a table for calculating the partial quotients of the continued fraction of an irrational square root.

Usage
It is called by:
 *  

In order to work out what $a_{r - 1}$, $P_{r - 1}$ and $Q_{r - 1}$ actually are, the table can be built one row at a time.

The previous row having been built, those values can merely be read off the partly-generated page.

It needs to be called after PartialQuotientCalculator-Start.

Note that all this template does is evaluate $P_r$, $Q_r$ and $a_r$, and pass these and the other parameters to the call to PartialQuotientTableRow.

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.

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