{"id":34,"date":"2025-01-22T09:14:55","date_gmt":"2025-01-22T01:14:55","guid":{"rendered":"https:\/\/www.bandifee.com\/?p=34"},"modified":"2025-05-16T00:19:01","modified_gmt":"2025-05-15T16:19:01","slug":"%e7%89%9b%e9%a1%bf%e6%b3%95%e8%ae%a1%e7%ae%97%e6%96%b9%e7%a8%8b%e8%bf%91%e4%bc%bc%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/blog.bandifee.com\/index.php\/2025\/01\/22\/%e7%89%9b%e9%a1%bf%e6%b3%95%e8%ae%a1%e7%ae%97%e6%96%b9%e7%a8%8b%e8%bf%91%e4%bc%bc%e8%a7%a3\/","title":{"rendered":"\u725b\u987f\u6cd5\u8ba1\u7b97\u65b9\u7a0b\u8fd1\u4f3c\u89e3"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>namespace \u725b\u987f\u6cd5\n{\n    internal class Program\n    {\n        static void Main(string&#91;] args)\n        {\n            var f = (double x) => x + 5;\n            var df = (double x) => 1.0;\n            var guess = -1.0;\n            Console.WriteLine(solve(f,df,3));\n        }\n\n        public static double solve(Func&lt;double, double> f, Func&lt;double, double> df, double guess, double dif = 1e-6, int time = 100)\n        {\n            for (var i = 0; i &lt; time; i++)\n            {\n                if (df(guess) == 0) throw new Exception(\"\u5bfc\u6570\u4e3a0 \u65e0\u6cd5\u8fed\u4ee3\");\n                guess = guess - f(guess) \/ df(guess);\n                if(f(guess) &lt; dif) return guess;\n            }\n            throw new Exception(\"\u5230\u8fbe\u8fed\u4ee3\u6b21\u6570 \u672a\u6536\u655b!\");\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[8,9],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-7","tag-c","tag-9"],"_links":{"self":[{"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":1,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/posts\/34\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bandifee.com\/index.php\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}