added first test case for general nevile
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user