Advertisement
Guest User

Untitled

a guest
May 27th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.67 KB | None | 0 0
  1. let rec optimalRoot low high count =
  2.             let mid = (((high-low)/2.)+low)
  3.             if count>10 then
  4.                 mid
  5.             elif (sturmSeq sturm low mid) > 0 then
  6.                 optimalRoot low mid (count+1)
  7.             elif (sturmSeq sturm mid high) > 0 then
  8.                 optimalRoot mid high (count+1)
  9.             else
  10.                 infinity
  11.  
  12.  
  13. let rec NRap (t : float) rep oldFx =
  14.             if rep > 50 then
  15.                 None
  16.             else
  17.                let fx = solveMap t poly
  18.                if abs(fx)<1e-6 then
  19.                    Some(t)
  20.                else
  21.                    NRap (t-(fx/(solveMap t diffMap))) (rep+1) fx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement