diff --git a/polynomial.lisp b/polynomial.lisp index b826f0fb36434865c15b6caa7f9f27efc77678b3..e97c6ffb3f3294d6641febbeda20b780c207cac7 100644 --- a/polynomial.lisp +++ b/polynomial.lisp @@ -3,7 +3,7 @@ ; description: Polynomials ; date: Tue Mar 21 2006 - 18:33 ; author: Liam M. Healy -; modified: Wed Mar 22 2006 - 10:06 +; modified: Wed Mar 22 2006 - 10:23 ;******************************************************** ;;; $Id: $ @@ -18,8 +18,7 @@ ;;;; Polynomial Evaluation ;;;;**************************************************************************** -(export 'polynomial-eval) -(defun polynomial-eval (coefficients x) +(defunx-map polynomial-eval "gsl_poly_eval" (coefficients x) "Evaluate the polyonomial with coefficients at the point x." (let ((len (length coefficients))) (cffi::with-foreign-array (coef coefficients :double (list len)) @@ -39,10 +38,7 @@ ;;; get-divided-difference, eval-divided-difference or taylor-divided-difference ;;; in the body. -(export - '(with-divided-difference get-divided-difference - eval-divided-difference taylor-divided-difference)) - +(export '(with-divided-difference)) (defmacro with-divided-difference ((dd xa ya) &body body) "Compute the divided difference and bind dd to it. This variable may then be passed to divided-difference @@ -71,14 +67,15 @@ :int)) (list dd xac size))) -(defun get-divided-difference (dd) +(defunx get-divided-difference (dd) "Convert the divided difference into an array." (cffi::foreign-array-to-lisp (first dd) :double (list (third dd)))) -(defun eval-divided-difference (dd x) +(defunx-map eval-divided-difference "gsl_poly_dd_eval" (dd x) "Evaluate the polynomial stored in divided-difference form - at the point @var{x}." + at the point @var{x}. Call only within a + with-divided-difference form." (cffi:foreign-funcall "gsl_poly_dd_eval" :pointer (first dd) @@ -87,9 +84,10 @@ :double x :double)) -(defun taylor-divided-difference (dd xp) +(defunx-map taylor-divided-difference "gsl_poly_dd_taylor" (dd xp) "Convert the divided-difference representation of a polynomial - to a Taylor expansion about the point xp." + to a Taylor expansion about the point xp. Call only within a + with-divided-difference form." (let ((cc (foreign-alloc :double :count (third dd))) (workspace (foreign-alloc :double :count (third dd)))) (unwind-protect @@ -125,8 +123,11 @@ (defun-sf solve-quadratic-complex ((a :double) (b :double) (c :double)) "gsl_poly_complex_solve_quadratic" :documentation - "The complex roots of the quadratic equation a x^2 + b x + c = 0." - :return (gsl-complex gsl-complex)) + "The complex roots of the quadratic equation a x^2 + b x + c = 0. + Two values are always returned; if a root does not exist, the + value returned will be NIL." + :return (gsl-complex gsl-complex) + :return-code :number-of-answers) ;;;;**************************************************************************** ;;;; Cubic Equations @@ -148,7 +149,7 @@ "Find the real roots of the cubic equation, x^3 + a x^2 + b x + c = 0 with a leading coefficient of unity. The roots are given in ascending order. Three values are always returned; - if a roots is not real, the value returned for it will be NIL." + if a root is not real, the value returned for it will be NIL." :return (:double :double :double) :return-code :number-of-answers) @@ -156,6 +157,7 @@ "gsl_poly_complex_solve_cubic" :documentation "Find the complex roots of the cubic equation, x^3 + a x^2 + b x + c = 0 - with a leading coefficient of unity. The real roots are returned. - No special indication is given if there is only one real root." - :return (gsl-complex gsl-complex gsl-complex)) + with a leading coefficient of unity. Three values are always returned; + if a root does not exist, the value returned for it will be NIL." + :return (gsl-complex gsl-complex gsl-complex) + :return-code :number-of-answers)