MCPcopy Index your code
hub / github.com/cfgnunes/numerical-methods-python / example_solution_regula_falsi

Function example_solution_regula_falsi

main.py:133–156  ·  view source on GitHub ↗

Run an example 'Solutions: Regula Falsi'.

()

Source from the content-addressed store, hash-verified

131
132@print_docstring
133def example_solution_regula_falsi():
134 """Run an example 'Solutions: Regula Falsi'."""
135
136 def f(x):
137 return 2 * x ** 3 - math.cos(x + 1) - 3
138
139 a = -1.0
140 b = 2.0
141 toler = 0.01
142 iter_max = 100
143
144 print("Inputs:")
145 print(f"a = {a}")
146 print(f"b = {b}")
147 print(f"toler = {toler}")
148 print(f"iter_max = {iter_max}")
149
150 print("Execution:")
151 root, i, converged = solutions.regula_falsi(f, a, b, toler, iter_max)
152
153 print("Output:")
154 print(f"root = {root:.5f}")
155 print(f"i = {i}")
156 print(f"converged = {converged}")
157
158
159@print_docstring

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected