added first test case for general nevile

This commit is contained in:
sm
2014-01-12 21:28:52 -08:00
parent 1ed4830d51
commit b761ad7ddc
3 changed files with 80 additions and 0 deletions
+14
View File
@@ -2,6 +2,7 @@ package govector
import (
"errors"
"fmt"
)
// explicitly implements Neville's algorithm for three points at very
@@ -21,3 +22,16 @@ func Extrapolate(P []Point2d) (*Point2d, error) {
p012 := p01.ToVector().Scale(-1.0 / 2.0).ToPoint().Add(p12.ToVector().Scale(3.0 / 2.0))
return &p012, nil
}
func Neville(P []Point2d, ts []float64, t float64) (*Point2d, error) {
if len(P) != len(ts) {
return nil, errors.New(
fmt.Sprintf(
"Incompatable slice lengths len(P): %d != len(ts): %d",
len(P),
len(ts),
),
)
}
return nil, errors.New("smb")
}