官术网_书友最值得收藏!

  • The Modern C# Challenge
  • Rod Stephens
  • 233字
  • 2021-08-13 15:23:59

23. Newton's method

Binary subdivision uses intervals to quickly converge on an equation's root. Newton's method, which is also called the Newton-Raphson method, uses a different technique to converge even more quickly.

The method starts with a value (x). As long as F(x) is not close enough to zero, the method uses the derivative of the function to find the slope F'(x). It then follows the tangent line at that point to the new point x' where the line intersects the X axis. The value x' becomes the method's next guess for the root. The program continues calculating new values until F(x) is close enough to 0.

Finding the point of intersection between the tangent line and the X axis is easier than you might think. If you start with the value xi, you simply use the following equation to find the next value, xi+1:

Here, F is the function and F' is its derivative.

Write a program that uses Newton's method to find roots for equations. Make the equation and its derivative delegate parameters to the main method so you can easily pass different equations to the method. Use the program to find the roots for the following equations:

 

In case you don't remember your calculus, the derivatives of those functions are the following:

For extra credit, make the program draw the equations and their roots.

主站蜘蛛池模板: 恩施市| 新民市| 博湖县| 绵竹市| 大城县| 遂宁市| 常山县| 鹿邑县| 凤台县| 泰宁县| 葵青区| 华坪县| 禄丰县| 尉氏县| 龙游县| 密山市| 岑溪市| 南涧| 梁平县| 全椒县| 辽阳市| 乐山市| 朝阳区| 光山县| 临高县| 高青县| 顺义区| 娱乐| 阜新| 苏尼特右旗| 广灵县| 永安市| 神木县| 金山区| 上栗县| 长宁县| 察雅县| 陇南市| 梁平县| 客服| 吉水县|