Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
57
Task/Steffensens-method/EasyLang/steffensens-method.easy
Normal file
57
Task/Steffensens-method/EasyLang/steffensens-method.easy
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
proc deCasteljau c0 c1 c2 t . r .
|
||||
s = 1 - t
|
||||
c01 = s * c0 + t * c1
|
||||
c12 = s * c1 + t * c2
|
||||
r = s * c01 + t * c12
|
||||
.
|
||||
proc xConvexLeftPar t . r .
|
||||
call deCasteljau 2 (-8) 2 t r
|
||||
.
|
||||
proc yConvexRightPar t . r .
|
||||
call deCasteljau 1 2 3 t r
|
||||
.
|
||||
proc implicitEq x y . r .
|
||||
r = 5 * x * x + y - 5
|
||||
.
|
||||
proc f t . r .
|
||||
call xConvexLeftPar t x
|
||||
call yConvexRightPar t y
|
||||
call implicitEq x y r
|
||||
r += t
|
||||
.
|
||||
proc aitken p0 . r .
|
||||
call f p0 p1
|
||||
call f p1 p2
|
||||
p1m0 = p1 - p0
|
||||
r = p0 - p1m0 * p1m0 / (p2 - 2 * p1 + p0)
|
||||
.
|
||||
proc steffAitken p0 tol maxiter . p .
|
||||
for i to maxiter
|
||||
call aitken p0 p
|
||||
if abs (p - p0) < tol
|
||||
break 2
|
||||
.
|
||||
p0 = p
|
||||
.
|
||||
p = number "nan"
|
||||
.
|
||||
for i to 11
|
||||
numfmt 1 0
|
||||
write "t0 = " & t0 & " : "
|
||||
call steffAitken t0 0.00000001 1000 t
|
||||
numfmt 3 0
|
||||
if t <> t
|
||||
# nan
|
||||
print "no answer"
|
||||
else
|
||||
call xConvexLeftPar t x
|
||||
call yConvexRightPar t y
|
||||
call implicitEq x y r
|
||||
if abs r <= 0.000001
|
||||
print "intersection at (" & x & " " & y & ")"
|
||||
else
|
||||
print "spurious solution"
|
||||
.
|
||||
.
|
||||
t0 += 0.1
|
||||
.
|
||||
Loading…
Add table
Add a link
Reference in a new issue