Cleanup of poly an numeric modules
Removed some test code
This commit is contained in:
parent
85dbc2d306
commit
d1a90c6ec6
2 changed files with 0 additions and 63 deletions
|
|
@ -86,28 +86,3 @@ proc brent*(xmin,xmax:float ,function:TOneVarFunction, rootx,rooty:var float,tol
|
||||||
rootx=b
|
rootx=b
|
||||||
rooty=fb
|
rooty=fb
|
||||||
return true
|
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)
|
addRoot(p,res,x0,x1,tol,zerotol,mergetol)
|
||||||
|
|
||||||
return res
|
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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue