Hi All --
I'm hoping the answer to the question below will serve as an intro to macros, a
subject I've been interested in for awhile but haven't had time to look into
much. Here goes, fingers crossed:
Given a list of constants (a0, a1… an) and a list of x-values (x0, x1,….xn), I
want to desig
Hi All —
Given a list of constants (a0, a1… an) and a list of x-values (x0, x1,….xn), I
want to write a function in Racket that produces the function p(x) = a0 + a1(x
- x0) + a2(x - x0)(x - x1) + a3(x - x0)(x - x1) (x - x2) + ….+ an(x - x0)(x -
x1)…(x - xn), or the interpolating polynomial in N
> On Nov 6, 2015, at 9:07 PM, dyrueta wrote:
>
> Hi All --
>
> I'm hoping the answer to the question below will serve as an intro to macros,
> a subject I've been interested in for awhile but haven't had time to look
> into much. Here goes, fingers crossed:
>
> Given a list of constants (a0
Yes, I can see at least two significant errors in my description. The first is
in the sequence definitions. They should be
list of constants (a0, a1… an) and a list of x-values (x0, x1,….x(n-1))
Similarly, the def of p(x) should read
p(x) = a0 + a1(x - x0) + a2(x - x0)(x - x1) + a3(x - x0)(x
#lang racket
;; -
;; the macro approach
(module macro-server racket
(provide
;; syntax: (make-p number? (number? ...) (number? ...))
;; in (make-p a0 (a ...) (x ...)) must be of equal length
;; the result i
Use Horner's rule.
/Jens Axel
2015-11-06 22:27 GMT+01:00 Dave Yrueta :
> Hi All —
>
> Given a list of constants (a0, a1… an) and a list of x-values (x0,
> x1,….xn), I want to write a function in Racket that produces the function
> p(x) = a0 + a1(x - x0) + a2(x - x0)(x - x1) + a3(x - x0)(x - x1)
6 matches
Mail list logo