Roots of a function: Difference between revisions

Content added Content deleted
(added Rust programming solution)
Line 2,805: Line 2,805:


find_roots(-1..3) { |x| x**3 - 3*x**2 + 2*x }</lang>
find_roots(-1..3) { |x| x**3 - 3*x**2 + 2*x }</lang>

=={{header|Rust}}==
<lang rust>// 202100315 Rust programming solution

use roots::find_roots_cubic;

fn main() {

let roots = find_roots_cubic(1f32, -3f32, 2f32, 0f32);

println!("Result : {:?}", roots);
}</lang>
{{out}}
<pre>
Result : Three([0.000000059604645, 0.99999994, 2.0])
</pre>


=={{header|Scala}}==
=={{header|Scala}}==