The textbook Fundamentals of Numerical Computation: Julia Edition
Computers represent real numbers using . Understanding how they work prevents precision errors. fundamentals of numerical computation julia edition pdf
\sectionRoot-Finding \subsectionBisection Method The bisection method is robust but converges linearly. \beginlstlisting function bisection(f, a, b, tol=1e-12) @assert f(a)*f(b) < 0 "Function must change sign" while (b - a) > tol c = (a + b) / 2 if f(c) == 0 return c elseif f(a)*f(c) < 0 b = c else a = c end end return (a + b) / 2 end f(x) = x^3 - 2 root = bisection(f, 1.0, 2.0) println("∛2 ≈ ", root, ", error = ", root - cbrt(2)) \endlstlisting \beginlstlisting function bisection(f
While many users search for a "PDF" version, it is important to note the available formats: tol=1e-12) @assert f(a)*f(b) <
x = A \ b is the standard way to solve linear systems.