aboutsummaryrefslogtreecommitdiff
path: root/src/integrands.sc
blob: 920d2579bdab5e385377794c9c64bde13f1b2527 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(pre-include "gsl/gsl_math.h")
(pre-include "gsl/gsl_poly.h")
(pre-include "integrands.h")

(define (polynomial-integrand r x -params) (double double (const gsl-vector*) void*)
  (let* ((params polynomial-integrand-params*
                 (convert-type -params polynomial-integrand-params*)))
    (return (gsl-poly-eval (: params coefficients)
                           (+ (: params degree) 1)
                           r))))

(define (gaussian-integrand r x -params) (double double (const gsl-vector*) void*)
  (return (exp (- (/ (gsl-pow-2 r) 2)))))

(define (x-coordinate-integrand r x -params) (double double (const gsl-vector*) void*)
  (return (fabs (* r (gsl-vector-get x 0)))))