mit-scheme-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MIT-Scheme-users] Constructing a differential function with ScmUtil


From: Taylor R Campbell
Subject: Re: [MIT-Scheme-users] Constructing a differential function with ScmUtils
Date: Thu, 9 Mar 2017 08:39:59 +0000

> Date: Thu, 9 Mar 2017 10:21:10 +0200
> From: David Gray <address@hidden>
> 
> I'm doing some calculations for GVD in various dielectrics, and I
> thought to ask here if anyone knows if there is a less clunky method
> of constructing the differential function with a list of constants:

What do you find clunky about this?  Would you rather pass in a vector
of constants?  Would you rather use the autocurrying notation to avoid
naming n and nofx separately?

(define ((n p1 p2 p3 p4 p5 p6) l)
  (define (d t b l2)
    (/ (* t l2) (- l2 b)))
  (let ((l2 (square l)))
    (sqrt (+ 1 (d p1 p2 l2) (d p3 p4 l2) (d p5 p6 l2)))))
(define n_symbolic (n 'p1 'p2 'p3 'p4 'p5 'p6))
(define n_numeric (n 1.03961212 ...))
(pe ((D n_symbolic) 'x))
((D n_numeric) 0.8)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]