diff options
| author | Lua Team <team@lua.org> | 1997-07-01 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 1997-07-01 12:00:00 +0000 |
| commit | 4f8c5d0f284e1f4da717aea5008915f185cd2e05 (patch) | |
| tree | 5671acf8a2cacf0c0524ce96d22959590a3aa5af /test/bisect.lua | |
| parent | 47a298a24ad3a8202440051de5938618502302a0 (diff) | |
| download | lua-github-3.0.tar.gz | |
Lua 3.03.0
Diffstat (limited to 'test/bisect.lua')
| -rw-r--r-- | test/bisect.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/bisect.lua b/test/bisect.lua index cfb1bbfd..8b720654 100644 --- a/test/bisect.lua +++ b/test/bisect.lua @@ -2,7 +2,7 @@ $debug -- bisection method for solving non-linear equations function bisect(f,a,b,fa,fb) -print(n.." a="..a.." fa="..fa.." b="..b.." fb="..fb) + write(n," a=",a," fa=",fa," b=",b," fb=",fb,"\n") local c=(a+b)/2 if abs(a-b)<delta then return c end n=n+1 @@ -15,7 +15,7 @@ function solve(f,a,b) delta=1e-6 -- tolerance n=0 local z=bisect(f,a,b,f(a),f(b)) - print(format("after %d steps, root is %.10g",n,z)) + write(format("after %d steps, root is %.10g\n",n,z)) end -- our function |
