Re: [MIT-Scheme-users] Constructing a differential function with ScmUtils
> On 9 Mar 2017, at 11:27, Taylor R Campbell wrote: > > pe ((D (n (up 'p_1 'p_2 'p_3 ...))) x)) Brilliant, definitely better. I forgot about using tuples. Now it's: (define bk7 (up 1.03961212 6.00069867e-3 0.231792344 2.00179144e-2 1.01046945 1.03560653e2)) ((D (n bk7)) 0.8) ___ MIT-Scheme-users mailing list MIT-Scheme-users@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-users
Re: [MIT-Scheme-users] Constructing a differential function with ScmUtils
> Date: Thu, 9 Mar 2017 10:55:07 +0200 > From: David Gray > > I'm going to deal with a few materials so I thought passing a vector > directly would be better, but I didn't manage to > differentiate the resulting function If you use the autocurrying notation, it may be easier: (define ((n p) x) ...) (pe ((D (n (up 'p_1 'p_2 'p_3 ...))) x)) Otherwise, you need *all* the arguments to go through a single vector in order to differentiate it, because scmutils has no way to know which arguments are scalars and which arguments are vectors. ___ MIT-Scheme-users mailing list MIT-Scheme-users@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-users
Re: [MIT-Scheme-users] Constructing a differential function with ScmUtils
I’m going to deal with a few materials so I thought passing a vector directly would be better, but I didn’t manage to differentiate the resulting function e.g.: (define (n parameter-vector x) …….) unless I explicitly passed each constant separately. ___ MIT-Scheme-users mailing list MIT-Scheme-users@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-users
Re: [MIT-Scheme-users] Constructing a differential function with ScmUtils
> Date: Thu, 9 Mar 2017 10:21:10 +0200 > From: David Gray > > 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) ___ MIT-Scheme-users mailing list MIT-Scheme-users@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-users