Steffensen's method: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 58: Line 58:


That is easier said than done.
That is easier said than done.

There are excellent ways to solve this problem, but we will not be using those. Our purpose, after all, is to illustrate Steffensen's method: both its advantages and its drawbacks. Let us look at an advantage: to use Steffensen's method (which requires only function values, not derivatives), we do not actually have to expand that polynomial in <math>t</math>. Instead, we can evaluate <math>x(t)</math> and <math>y(t)</math> and plug the resulting numbers into the implicit equation. What is more, we do not even need to write <math>x(t)</math> and <math>y(t)</math> as polynomials, but instead can evaluate them directly from their control points, using [[wp:De_Casteljau's_algorithm|de Casteljau's algorithm]]:

fun de_casteljau
(c0 : double, (* control point coordinates (one axis) *)
c1 : double,
c2 : double,
t : double) (* the independent parameter *)
: double = (* value of x(t) or y(t) *)
let
val s = 1.0 - t
val c01 = (s * c0) + (t * c1)
val c12 = (s * c1) + (t * c2)
val c012 = (s * c01) + (t * c12)
in
c012
end
fun x_convex_left_parabola (t : double) : double =
de_casteljau (2.0, ~8.0, 2.0, t)
fun y_convex_left_parabola (t : double) : double =
de_casteljau (1.0, 2.0, 3.0, t)