- The Modern C# Challenge
- Rod Stephens
- 259字
- 2021-08-13 15:23:59
22. Bisection root-finding
Root-finding algorithms find values (y) for which an equation y = F(x) equals zero. For example, the equation y = x2 – 4 has roots at x = 2 and x = -2 because at those values y = 0.
To find roots using binary subdivision, the program starts with an interval, x0 ≤ x ≤ x1, which we suspect contains a root. For the method to work, F(x0) and F(x1) must have different signs. In other words, one must be greater than zero and one must be less than zero.
To look for the root, the method picks the middle X value, xnew = (x0 + x1) / 2, and then calculates F(xnew). If the result is greater than zero, then you know that the root lies between xnew and whichever of x0 and x1 gives a value less than zero.
Similarly, if the result is less than zero, you know that the root lies between xnew and whichever of x0 and x1, whichever gives a value greater than zero.
Now, you update x0 and x1 to bound the new interval. You then repeat the process until F(x0) and F(x1) are within some maximum allowed error value.
Write a program that uses binary subdivision to find roots for equations. Make the equation a delegate parameter to the main method so you can easily pass the method different equations. Use the program to find the roots for the following equations:
For extra credit, make the program draw the equations and their roots.
- 432級臺階之第2級臺階
- Introduction to Blockchain and Ethereum
- 神奇的數(shù)學(xué)(二)
- 高等數(shù)學(xué)習(xí)題全解(下冊)
- 走近費(fèi)曼叢書:費(fèi)曼講物理:相對論
- 數(shù)理邏輯
- 數(shù)獨(dú)游戲全集
- 數(shù)學(xué)與決策:數(shù)學(xué)教你做決定
- 高等數(shù)學(xué)(下冊)
- 高等數(shù)學(xué)(上冊)
- 排序問題的數(shù)學(xué)規(guī)劃松弛方法
- 特殊函數(shù)概論習(xí)題解答
- 數(shù)學(xué)女孩5:伽羅瓦理論
- 現(xiàn)代啟發(fā)式優(yōu)化方法及其應(yīng)用
- 數(shù)學(xué)思維的力量