Closed schoppmp closed 4 months ago
To interpolate f(x) linearly between f(x0) and f(x1), the correct equation is f(x) = 1 / (x1 - x0) * (x1 - x) * f(x0) + (x - x0) * f(x1). With x1 - x0 = 1 and diff := x - x0, this means f(x) = (1 - diff) * f(x0) + diff * f(x1).
f(x)
f(x0)
f(x1)
f(x) = 1 / (x1 - x0) * (x1 - x) * f(x0) + (x - x0) * f(x1)
x1 - x0 = 1
diff := x - x0
f(x) = (1 - diff) * f(x0) + diff * f(x1)
thanks, ill merge this soon.
To interpolate
f(x)
linearly betweenf(x0)
andf(x1)
, the correct equation isf(x) = 1 / (x1 - x0) * (x1 - x) * f(x0) + (x - x0) * f(x1)
. Withx1 - x0 = 1
anddiff := x - x0
, this meansf(x) = (1 - diff) * f(x0) + diff * f(x1)
.