Roots of a function: Difference between revisions

Content added Content deleted
(→‎Tcl: Added version that uses Newton-Raphson to go much faster, at a cost of needing the functional derivative of the input function)
m (→‎{{header|Tcl}}: Noted that approximation is inherent)
Line 476: Line 476:


=={{header|Tcl}}==
=={{header|Tcl}}==
This simple brute force iteration marks all results, with a leading "~", as approximate.
This simple brute force iteration marks all results, with a leading "~", as approximate. This version always reports its results as approximate because of the general limits of computation using fixed-width floating-point numbers (i.e., IEEE double-precision floats).
<lang Tcl>proc froots {lambda {start -3} {end 3} {step 0.0001}} {
<lang Tcl>proc froots {lambda {start -3} {end 3} {step 0.0001}} {
set res {}
set res {}