Roots of a function: Difference between revisions

m
m (→‎{{header|Tcl}}: Noted that approximation is inherent)
Line 499:
user 0m0.062s
sys 0m0.030s</pre>
A more elegant solution (and faster, because you can usually make the initial search coarser) is to use brute-force iteration and then refine with [http[wp://en.wikipedia.org/wiki/Newton's_methods method|Newton-Raphson]], but that requires the differential of the function with respect to the search variable.
<lang Tcl>proc frootsNR {f df {start -3} {end 3} {step 0.001}} {
set res {}
Anonymous user