Data update

This commit is contained in:
Ingy döt Net 2023-09-16 17:28:03 -07:00
parent 5af6d93694
commit 796d366b97
455 changed files with 7413 additions and 1900 deletions

View file

@ -1,52 +1,52 @@
proc deCasteljau c0 c1 c2 t . r .
func deCasteljau c0 c1 c2 t .
s = 1 - t
c01 = s * c0 + t * c1
c12 = s * c1 + t * c2
r = s * c01 + t * c12
return s * c01 + t * c12
.
proc xConvexLeftPar t . r .
call deCasteljau 2 (-8) 2 t r
func xConvexLeftPar t .
return deCasteljau 2 (-8) 2 t
.
proc yConvexRightPar t . r .
call deCasteljau 1 2 3 t r
func yConvexRightPar t .
return deCasteljau 1 2 3 t
.
proc implicitEq x y . r .
r = 5 * x * x + y - 5
func implicitEq x y .
return 5 * x * x + y - 5
.
proc f t . r .
call xConvexLeftPar t x
call yConvexRightPar t y
call implicitEq x y r
r += t
func f t r .
x = xConvexLeftPar t
y = yConvexRightPar t
r = implicitEq x y
return r + t
.
proc aitken p0 . r .
call f p0 p1
call f p1 p2
func aitken p0 .
p1 = f p0 p1
p2 = f p1 p2
p1m0 = p1 - p0
r = p0 - p1m0 * p1m0 / (p2 - 2 * p1 + p0)
return p0 - p1m0 * p1m0 / (p2 - 2 * p1 + p0)
.
proc steffAitken p0 tol maxiter . p .
func steffAitken p0 tol maxiter .
for i to maxiter
call aitken p0 p
p = aitken p0
if abs (p - p0) < tol
break 2
return p
.
p0 = p
.
p = number "nan"
return number "nan"
.
for i to 11
numfmt 1 0
write "t0 = " & t0 & " : "
call steffAitken t0 0.00000001 1000 t
t = steffAitken t0 0.00000001 1000
numfmt 3 0
if t <> t
# nan
print "no answer"
else
call xConvexLeftPar t x
call yConvexRightPar t y
call implicitEq x y r
x = xConvexLeftPar t
y = yConvexRightPar t
r = implicitEq x y
if abs r <= 0.000001
print "intersection at (" & x & " " & y & ")"
else