From 07141fb72a9b9b7f7291dd0ad3ea747e665bd167 Mon Sep 17 00:00:00 2001 From: Thomas Baruchel Date: Tue, 4 Oct 2022 18:29:50 +0200 Subject: [PATCH] Update --- thiele.lisp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/thiele.lisp b/thiele.lisp index 08184e4..7775224 100644 --- a/thiele.lisp +++ b/thiele.lisp @@ -31,6 +31,27 @@ ; Thiele's interpolation formula ; ============================== +; +; In the following example, we use Thiele's interpolation formula +; for computing the inverse cos function cos^(-1) from 32 points +; given by the cos function itself. +; +; We create two vectors: +; * the vector 'a' contains regularly spaced points in [0..1.55] +; * the vector 'b' contains cos(x) for each x in vector 'a' +; +; We set the keepfloat flag to true in order to prevent Maxima +; to replace the values with rational approximations. +; +; Then we compute the inverse function by using thiele(b,a); +; we evaluate this interpolation at 0.5 expecting some value +; close to pi/3. +; +; (%i1) a:makelist(0.05*i,i,0,31)$ +; (%i2) b:makelist(float(cos(0.05*i)),i,0,31)$ +; (%i3) keepfloat:true$ +; (%i4) subst(x=0.5, thiele(b,a))*3; +; (%o4) 3.14159265357928 (defun $thiele (u v) (loop for rh on