Skip to content

error in solution to simultaneous equations for affine interpolant #31

@palisades-lakes

Description

@palisades-lakes

(solve
'[a0 a1]
(ex (= y0 (+ a0 (* a1 x0))))
(ex (= y1-y0 (* a1 x1-x0))))

returns
#{{ a1 (* y1-y0 (/ x1-x0)),
a0 (+ y0 (* -1 y1-y0 x1-x0 x0))}}

a1 is correct, though I would have expected (/ y1-y0 x1-x0)
a0 should be something equivalent to (- y0 (* (/ y1-y0 x1-x0) x0)).

PS:
I started with
(solve
'[a0 a1]
(ex (= y0 (+ a0 (* a1 x0))))
(ex (= y1 (+ a0 (* a1 x1)))))

But the answer wasn't useful:
#{{a1 (+ (* y1
(+ (/ x1)
(* (** (/ x1) 2)
-1
x0
(/ (+ (/ x1) (- x0) -1)))))
(* y0
(/ (+ (/ x1) (- x0) -1))
(/ x1))),
a0 (* (/ (+ (/ x1) (- x0) -1))
(+ (* y1 (/ x1) x0)
(- y0)))}}
So I tried re-arranging by hand, only to get an incorrect answer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions