The key to the Caltha Programming Language, as it existed at the time, was the fact that multiple statements could be placed inside a single pair of parentheses. Note that in the formula above, if r > h, then three statements are executed: the assignment y:= f(x), the update of x and r, and the recursive invocation of root. I no longer like this notation, however, for the simple reason that the resulting formulas become too large.
![]()
The algorithm itself has not changed, though we now have three small formulas instead of one large one. Note that the lower two formulas are indented. The indentation affects the scope of each variable. It ensures, for example, that the arguments of root can be used in the definition of x', r', and y. The indentation also ensures that x', r', and y will be re-evaluated each time root is re-evaluated.
![]()
Note that when the definition of root is separated from the definition of x' and r', the indentation is lost. This is why we must add the context identifier <<root>> to the second formula. We could separate y:= f(x) as well, if we wanted to, in which case we would give it the context identifier <<root; [x', r']>> (or <<...; [x', r']>>, with "..." meaning "the context of the previous formula").
The function root approximates the root of its argument function f. The initial guess x must be within a distance r of the actual root, and we assume that f is increasing in the interval between x - r and x + r. The result of root is the final approximation, which will be within a distance h of the actual root. As shown below, if r is at most h, then x is the final approximation. Otherwise, root is evaluated recursively with an updated guess x' and an updated distance r'. ![]()
The updated guess x' and an updated distance r' are calculated as follows. If f(x) is zero, then x is the root and we can define r' as 0. If f(x) is positive or negative, we can define x' as x translated by r/2 in the appropriate direction. In that case r' is r/2. ![]()