mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
Cleanup of poly an numeric modules
Removed some test code
This commit is contained in:
@@ -86,28 +86,3 @@ proc brent*(xmin,xmax:float ,function:TOneVarFunction, rootx,rooty:var float,tol
|
||||
rootx=b
|
||||
rooty=fb
|
||||
return true
|
||||
|
||||
|
||||
|
||||
when isMainModule:
|
||||
var rootx=0.0
|
||||
var rooty=0.0
|
||||
var err=0.0
|
||||
|
||||
var cnt=0
|
||||
proc myf(x:float):float=
|
||||
inc cnt
|
||||
echo ($cnt & " : " & $x)
|
||||
return x*x-200
|
||||
|
||||
|
||||
var suc=brent(-10000.0,0.2,myf,rootx,rooty,1.0e-3)
|
||||
|
||||
|
||||
echo suc
|
||||
echo rootx
|
||||
echo rooty
|
||||
|
||||
|
||||
|
||||
discard(readline(stdin))
|
||||
|
||||
@@ -371,41 +371,3 @@ proc roots*(p:TPoly,tol=1.0e-9,zerotol=1.0e-6,mergetol=1.0e-12):seq[float]=
|
||||
addRoot(p,res,x0,x1,tol,zerotol,mergetol)
|
||||
|
||||
return res
|
||||
|
||||
when isMainModule:
|
||||
var ply=initPoly(1.0,-6.0,5.0,2.0)
|
||||
var ply2 =initPoly(4.0,5.0,6.0)
|
||||
|
||||
echo ply
|
||||
echo ply2
|
||||
echo ply2-ply
|
||||
|
||||
|
||||
|
||||
|
||||
var rts=ply.roots
|
||||
if rts!=nil:
|
||||
for i in rts:
|
||||
echo formatFloat(i,ffDefault,0)
|
||||
|
||||
|
||||
discard readLine(stdin)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user