From 7b824e0268575e4c13c624b54b2a1280aa295f7f Mon Sep 17 00:00:00 2001 From: Yevhenii Shapovalov Date: Thu, 9 Nov 2017 13:39:24 +0200 Subject: add tests --- tests/Smoke/bisect.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/Smoke/bisect.lua (limited to 'tests/Smoke/bisect.lua') diff --git a/tests/Smoke/bisect.lua b/tests/Smoke/bisect.lua new file mode 100644 index 0000000..77ac36c --- /dev/null +++ b/tests/Smoke/bisect.lua @@ -0,0 +1,28 @@ +-- bisect.lua +-- bisection method for solving non-linear equations + +delta=1e-6 -- tolerance + +function bisect(f,a,b,fa,fb) + local c=(a+b)/2 + io.write(n," c=",c," a=",a," b=",b,"\n") + if c==a or c==b or math.abs(a-b)