# Wikiup example

All the pages in this website were done with **wikiup**. The post-commit script
in the CVS server executes **parsewikiup** on the modified files, using site
templates to update the pages.

Here is an example of a short article with equations, figures and computer code:

= Newton's method = Given a function _f_, we want to find its *roots*. Namely, the values of _x_ such that: $f(x) = 0$ We choose an arbitrary initial value $x_0$ and from it we calculate a new value $x_1$ which is the point where the tangent of _f_, at $x_0$, passes through the $x$ axis: [fig19-1.png] $x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}$ We now repeat the process recursively: $x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} \qquad n = 0, 1, 2, \ldots$ In an interval where the function is continuous and increasing, that sequence will approach the nearest root on the left of the starting value. If the function is continuous and decreasing, the sequence will approach the nearest root on the right. == Example == _Compute the square root of 5, using Newton's method_. The number we want to compute is: $x = \sqrt{5}$ let us rewrite that equation as $x^2-5 = 0$ Thus, our problem is equivalent to finding the roots of the function $f(x) = x^2-5$ The recurrence relation becomes: $x_{n+1} = x_n - \frac{x_n^2 - 5}{2x_n} = \frac{1}{2}\left(x_n + \frac{5}{x_n}\right)$ Using `Maxima` (http://maxima.sourceforge.net), and an initial value of 1, we can find the first terms in the sequence: --- x : 1; for i thru 10 do (x: float((x + 5/x)/2), print(x)); --- The sequence seems to converge rather fast: --- 3.0 2.333333333333334 2.238095238095238 2.236068895643363 2.236067977499978 2.23606797749979 2.23606797749979 2.23606797749979 2.23606797749979 2.23606797749979 ---

We can generate two different HTML versions, of different sizes, using

the following commands:

parsewikiup --style=example1.css --output=example1.html example1 parsewikiup -s example1.css -o example1-big.html -z 1.5 -e "bigeq-" example1

Notice how we had to change the equation prefix in the second case, to obtain the equations in two different sizes. The same figure was used in both cases. We could send the output into two different directories, where we would have the figures in different sizes; in that case we could use the same equation prefix for both.

The HTML pages obtained can be seen in: example1.html and example1-big.html. The style sheet used is here: example1.css.