{"id":1265,"date":"2024-07-16T22:11:01","date_gmt":"2024-07-16T14:11:01","guid":{"rendered":"https:\/\/www.gnn.club\/?p=1265"},"modified":"2024-07-29T16:25:15","modified_gmt":"2024-07-29T08:25:15","slug":"%e9%ab%98%e7%ad%89%e6%95%b0%e5%ad%a6","status":"publish","type":"post","link":"http:\/\/www.gnn.club\/?p=1265","title":{"rendered":"\u9ad8\u7b49\u6570\u5b66"},"content":{"rendered":"<h1><img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/1.jpg\" style=\"height:50px;display:inline\"> Deep Learning Math<\/h1>\n<h2>\u9ad8\u7b49\u6570\u5b66\uff08Advanced Mathematics\uff09<\/h2>\n<p>\u9ad8\u7b49\u6570\u5b66\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\u8d77\u7740\u5173\u952e\u4f5c\u7528\u3002\u5fae\u79ef\u5206\u7684\u57fa\u7840\uff0c\u5982\u79ef\u5206\u548c\u5fae\u5206\uff0c\u5e2e\u52a9\u6211\u4eec\u7406\u89e3\u6a21\u578b\u7684\u8bad\u7ec3\u8fc7\u7a0b\u3002\u901a\u8fc7\u5bfc\u6570\u548c\u51fd\u6570\u7684\u5355\u8c03\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u5224\u65ad\u6a21\u578b\u7684\u4f18\u5316\u65b9\u5411\uff0c\u5e76\u4f7f\u7528\u94fe\u5f0f\u6cd5\u5219\u8ba1\u7b97\u590d\u6742\u51fd\u6570\u7684\u68af\u5ea6\u3002\u68af\u5ea6\u4e0b\u964d\u6cd5\u662f\u6df1\u5ea6\u5b66\u4e60\u4f18\u5316\u7684\u6838\u5fc3\uff0c\u901a\u8fc7\u8ba1\u7b97\u68af\u5ea6\u6765\u6700\u5c0f\u5316\u635f\u5931\u51fd\u6570\u3002\u51fd\u6570\u7684\u6781\u503c\u4e0e\u978d\u70b9\u3001\u6d77\u68ee\u77e9\u9635\u3001\u4ee5\u53ca\u51fd\u6570\u7684\u51f9\u51f8\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u7406\u89e3\u6a21\u578b\u5728\u4f18\u5316\u8fc7\u7a0b\u4e2d\u7684\u884c\u4e3a\u548c\u7a33\u5b9a\u6027\u3002\u6b64\u5916\uff0c\u6cf0\u52d2\u516c\u5f0f\u548c\u5085\u91cc\u53f6\u7ea7\u6570\u5219\u7528\u4e8e\u51fd\u6570\u7684\u8fd1\u4f3c\u548c\u4fe1\u53f7\u5904\u7406\uff0c\u8fd9\u5728\u6784\u5efa\u548c\u4f18\u5316\u590d\u6742\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u65f6\u5c24\u4e3a\u91cd\u8981\u3002\u901a\u8fc7\u8fd9\u4e9b\u6570\u5b66\u5de5\u5177\uff0c\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u80fd\u591f\u66f4\u6709\u6548\u5730\u8bad\u7ec3\u548c\u4f18\u5316\uff0c\u4ece\u800c\u63d0\u9ad8\u5176\u6027\u80fd\u548c\u51c6\u786e\u6027\u3002<\/p>\n<hr \/>\n<h3><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/bubbles\/50\/000000\/checklist.png\" style=\"height:50px;display:inline\"> Agenda<\/h3>\n<hr \/>\n<ul>\n<li>\u5fae\u79ef\u5206 (Calculus)\n<ul>\n<li>\u79ef\u5206 (Integration)<\/li>\n<li>\u5fae\u5206\u548c\u5bfc\u6570 (Differentiation and Derivatives)<\/li>\n<li>\u51fd\u6570\u5355\u8c03\u6027(Monotonicity of Functions)<\/li>\n<li>\u51fd\u6570\u6781\u503c\u4e0e\u978d\u70b9(Extrema and Saddle Points of Functions)<\/li>\n<li>\u6d77\u68ee\u77e9\u9635\uff08Hessian Matrix\uff09<\/li>\n<li>\u51fd\u6570\u51f9\u51f8\u6027(Concavity and Convexity of Functions)<\/li>\n<\/ul>\n<\/li>\n<li>\u94fe\u5f0f\u6cd5\u5219 (Chain Rule)<\/li>\n<li>\u68af\u5ea6 (Gradient)<\/li>\n<li>\u6cf0\u52d2\u516c\u5f0f(Taylor Series\/Taylor Expansion)<\/li>\n<li>\u5085\u91cc\u53f6\u7ea7\u6570\uff08Fourier Series\uff09<\/li>\n<\/ul>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/dusk\/64\/000000\/scissors.png\" style=\"height:50px;display:inline\"> \u5fae\u79ef\u5206<\/h2>\n<hr \/>\n<p>\u5fae\u79ef\u5206\u662f\u6570\u5b66\u7684\u4e00\u4e2a\u5206\u652f\uff0c\u4e3b\u8981\u7814\u7a76\u53d8\u5316\u7684\u91cf\u548c\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u5fae\u79ef\u5206\u5305\u62ec\u4e24\u4e2a\u4e3b\u8981\u90e8\u5206\uff1a\u5fae\u5206\u5b66\u548c\u79ef\u5206\u5b66\u3002<\/p>\n<ul>\n<li>\u5fae\u5206\u5b66\u4fa7\u91cd\u4e8e\u7814\u7a76\u51fd\u6570\u7684\u53d8\u5316\u7387\u548c\u659c\u7387\uff0c\u4e3b\u8981\u5de5\u5177\u662f\u5bfc\u6570\uff0c\u5b83\u80fd\u591f\u63cf\u8ff0\u77ac\u65f6\u53d8\u5316\u7684\u901f\u5ea6\u3002<\/li>\n<li>\u79ef\u5206\u5b66\u5219\u5173\u6ce8\u7d2f\u79ef\u91cf\uff0c\u4e3b\u8981\u5de5\u5177\u662f\u79ef\u5206\uff0c\u7528\u4e8e\u8ba1\u7b97\u9762\u79ef\u3001\u4f53\u79ef\u53ca\u5176\u4ed6\u7d2f\u79ef\u91cf\u3002<\/li>\n<\/ul>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/dusk\/64\/000000\/graph.png\" style=\"height:50px;display:inline\"> \u79ef\u5206\uff08integration\uff09<\/h2>\n<hr \/>\n<ul>\n<li>\u79ef\u5206\u7684\u51e0\u4f55\u89e3\u91ca\u662f\uff1a\u8be5\u51fd\u6570\u66f2\u7ebf\u4e0b\u7684\u9762\u79ef\u3002<\/li>\n<li>\u79ef\u5206\u7684\u7269\u7406\u89e3\u91ca\u662f\uff1a \u79ef\u5206\u7684\u7269\u7406\u610f\u4e49\u968f\u4e0d\u540c\u7269\u7406\u91cf\u800c\u4e0d\u540c\uff0c\u6bd4\u5982\u5bf9\u529b\u5728\u65f6\u95f4\u4e0a\u79ef\u5206\u5c31\u662f\u67d0\u6bb5\u65f6\u95f4\u5185\u529b\u7684\u51b2\u91cf\uff1b\u5982\u679c\u662f\u5bf9\u529b\u5728\u7a7a\u95f4\u4e0a\u7684\u79ef\u5206\u5c31\u662f\u67d0\u6bb5\u4f4d\u79fb\u91cc\u529b\u505a\u7684\u529f\u3002<\/li>\n<li>\u79ef\u5206\u7684\u4ee3\u6570\u89e3\u91ca\u662f\uff1a\u66f4\u7cbe\u7ec6\u7684\u4e58\u6cd5\u8fd0\u7b97\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u5982\u4f55\u7406\u89e3\u79ef\u5206\u662f\u66f4\u7cbe\u7ec6\u7684\u4e58\u6cd5\u8fd0\u7b97\uff1f\u8fd8\u662f\u653e\u5230\u8def\u7a0b\u901f\u5ea6\u65f6\u95f4\u8fd9\u4e2a\u7269\u7406\u7cfb\u7edf\u4e2d\u4e3e\u5b50\uff1a<\/p>\n<p>\u5047\u8bbe\u73b0\u5728\u901f\u5ea6 $v=5 \\mathrm{~m} \/ \\mathrm{s}$ \u3001\u65f6\u95f4 $t=10 \\mathrm{~s}$, \u884c\u9a76\u8ddd\u79bb $s$ \u600e\u4e48\u6c42? <\/p>\n<ul>\n<li>\u5f88\u7b80\u5355\u6b63\u5e38\u7684\u4e58\u6cd5\u5373\u53ef\u5904\u7406 $(s=v t)$ \u3002\u4f46\u662f\u6709\u4e2a\u524d\u63d0, \u5373\u901f\u5ea6\u662f\u6052\u5b9a\u7684\u3002<\/li>\n<\/ul>\n<p>\u90a3\u5982\u679c\u662f\u53d8\u901f\u7684\u5462? \u8fd9\u5c31\u662f\u79ef\u5206\u7684\u5185\u5bb9\u4e86\u3002<\/p>\n<ul>\n<li>\u5047\u8bbe\u73b0\u5728\u7684\u901f\u5ea6 $v=2 t$, \u6c42\u7b2c 10 \u65f6\u523b\u884c\u9a76\u8fc7\u7684\u8def\u7a0b? <\/li>\n<\/ul>\n<p>\u79ef\u5206\u7684\u601d\u60f3\u662f\u5c06\u65f6\u95f4\u6bb5\u5c3d\u53ef\u80fd\u7684\u5207\u5206\u6210\u5c0f\u6bb5, \u4ee5\u6bcf\u4e00\u5c0f\u6bb5\u8d77\u59cb\u65f6\u523b\u7684\u77ac\u65f6\u901f\u5ea6\u4f5c\u4e3a\u8fd9\u4e00\u5c0f\u6bb5\u65f6\u95f4\u5185\u7684\u5e73\u5747\u901f\u5ea6, \u6700\u540e\u628a\u8fd9\u4e9b\u5c0f\u6bb5\u65f6\u95f4\u5185\u5404\u81ea\u5f62\u5f0f\u7684\u8def\u7a0b\u52a0\u8d77\u6765\u5c31\u662f 10 \u79d2\u5185\u884c\u9a76\u7684\u603b\u8def\u7a0b, <\/p>\n<p>\u5177\u4f53\u89e3\u6cd5\u5982\u4e0b:<\/p>\n<ul>\n<li>$1 \\mathrm{~s}$ \u65f6, \u5c0f\u6c7d\u8f66\u7684\u901f\u5ea6 $v_1=2 t=2 \\cdot 1=2(\\mathrm{~m} \/ \\mathrm{s}) ;$<\/li>\n<li>$2 \\mathrm{~s}$ \u65f6, \u5c0f\u6c7d\u8f66\u7684\u901f\u5ea6 $v_2=2 t=2 \\cdot 2=4(\\mathrm{~m} \/ \\mathrm{s})$; <\/li>\n<li>$3 \\mathrm{~s}$ \u65f6, \u5c0f\u6c7d\u8f66\u7684\u901f\u5ea6 $v_3=2 t=2 \\cdot 3=6(\\mathrm{~m} \/ \\mathrm{s})$; <\/li>\n<li>\u4f9d\u6b21\u7b97\u4e0b\u53bb, <\/li>\n<li>$10 \\mathrm{~s}$ \u65f6, \u5c0f\u6c7d\u8f66\u7684\u901f\u5ea6 $v_{10}=2 t=2 \\cdot 10=20(\\mathrm{~m} \/ \\mathrm{s})$ \u3002<\/li>\n<li>\u518d\u7528\u4e58\u6cd5\u8fd0\u7b97\u8ba1\u7b97\u51fa\u6bcf\u4e00\u5c0f\u6bb5\u65f6\u95f4 $(t=1 \\mathrm{~s})$ \u7684\u8ddd\u79bb, \u5373:<\/li>\n<\/ul>\n<p>$$<br \/>\n\\begin{aligned}<br \/>\ns &amp; =\\sum_{i=1}^{10} s_i \\\\<br \/>\n&amp; =s_1+s_2+s_3+\\cdots+s_{10} \\\\<br \/>\n&amp; =2+4+6+\\cdots+20 \\\\<br \/>\n&amp; =\\frac{10(2+20)}{2} \\\\<br \/>\n&amp; =110<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<p>\u4e0a\u9762\u516c\u5f0f\u4e2d\uff0c\u5c0610\u79d2\u949f\u4ee5\u4e00\u79d2\u4e3a\u95f4\u9694\u5207\u5206\u621010\u4e2a\u5c0f\u6bb5\u65f6\u95f4\uff0c\u6700\u540e\u6c42\u5f97\u7684\u8def\u7a0b\u662f110m \uff0c\u53ef\u89c6\u5316\u56fe\u7247\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/intergrayion.png\" style=\"height:200px\">\n<\/p>\n<p>\u53ef\u4ee5\u60f3\u8c61\uff0c\u5f53\u65f6\u95f4\u95f4\u9694\u8db3\u591f\u5c0f\u65f6\uff0c\u8fd9\u4e2a\u901f\u5ea6\u51fd\u6570\u56fe\u50cf\u8fd1\u4f3c\u4e09\u89d2\u5f62\uff0c\u6b64\u65f6\u7684\u8def\u7a0b\u5c31\u662f\u8fd9\u4e2a\u4e09\u89d2\u5f62\u7684\u9762\u79ef\u7b49\u4e8e100m\uff0c\u521a\u521a\u8fd1\u4f3c\u6c42\u5f97\u7684110m\u79bb\u8fd9\u4e2a\u6b63\u786e\u7b54\u6848\u5df2\u7ecf\u975e\u5e38\u63a5\u8fd1\u4e86\u3002<\/p>\n<p>\u6240\u4ee5\u79ef\u5206\u7684\u672c\u8d28\u5c31\u662f\u66f4\u7cbe\u7ec6\u7684\u4e58\u6cd5\uff0c\u6700\u540e\u6c42\u548c\u5c31\u53ef\u4ee5\u5f97\u5230\u8f93\u51fa\u7ed3\u679c\u4e86\u3002<\/p>\n<p><strong>\u5728\u6df1\u5ea6\u5b66\u4e60\u9886\u57df\uff0c\u79ef\u5206\u7684\u8fd0\u7528\u8fdc\u8fdc\u6ca1\u6709\u5fae\u5206\u591a\uff0c\u56e0\u6b64\u8fd9\u662f\u53ea\u505a\u7b80\u77ed\u7684\u6982\u5ff5\u6027\u7684\u4ecb\u7ecd\u3002\u4e0b\u9762\u6ce8\u91cd\u8bb2\u89e3\u5fae\u5206\u3002<\/strong><\/p>\n<h3><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/bubbles\/100\/000000\/multiply.png\" style=\"height:50px;display:inline\"> \u5fae\u5206\u548c\u5bfc\u6570<\/h3>\n<hr \/>\n<p>\u5fae\u5206\uff08differential\uff09\u548c\u5bfc\u6570\uff08derivative\uff09\u90fd\u4e0e\u51fd\u6570\u7684\u53d8\u5316\u7387\u6709\u5173\uff0c\u5b83\u4eec\u662f\u4e24\u4e2a\u76f8\u5173\u4f46\u4e0d\u5b8c\u5168\u76f8\u540c\u7684\u6982\u5ff5\u3002\u9996\u5148\u4e00\u8d77\u6df1\u5165\u4e86\u89e3\u8fd9\u4e24\u8005\u7684\u5b9a\u4e49\u548c\u533a\u522b\u3002<\/p>\n<ul>\n<li>\n<p>\u5bfc\u6570\u63cf\u8ff0\u4e86\u4e00\u4e2a\u51fd\u6570\u5728\u67d0\u4e00\u70b9\u4e0a\u7684\u5207\u7ebf\u659c\u7387\u3002\u5982\u679c\u6709\u4e00\u4e2a\u51fd\u6570 $y=f(x)$, \u5219\u5176\u5728\u70b9 $x$\u5904\u7684\u5bfc\u6570\u901a\u5e38\u8868\u793a\u4e3a $f^{\\prime}(x)$ \u6216 $\\frac{\\mathrm{d} y}{\\mathrm{~d} x}$ \u3002\u5bfc\u6570\u7684\u5b9a\u4e49\u662f\u51fd\u6570\u5728\u8be5\u70b9\u7684\u5e73\u5747\u53d8\u5316\u7387\u7684\u6781\u9650, \u516c\u5f0f\u5982\u4e0b:<br \/>\n$$<br \/>\nf^{\\prime}(x)=\\lim _{\\Delta x \\rightarrow 0} \\frac{f(x+\\Delta x)-f(x)}{\\Delta x}<br \/>\n$$<\/p>\n<\/li>\n<li>\n<p>\u5fae\u5206\u63cf\u8ff0\u4e86\u51fd\u6570\u503c\u7684\u5fae\u5c0f\u53d8\u5316\u4e0e\u81ea\u53d8\u91cf\u7684\u5fae\u5c0f\u53d8\u5316\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u5bf9\u4e8e\u51fd\u6570 $y=f(x)$, \u5b83\u7684\u5fae\u5206\u8868\u793a\u4e3a $\\mathrm{d} y$ \u548c $\\mathrm{d} x$, \u5176\u4e2d $\\mathrm{d} y$ \u662f\u51fd\u6570\u503c\u7684\u5fae\u5c0f\u53d8\u5316, \u800c $\\mathrm{d} x$ \u662f\u81ea\u53d8\u91cf\u7684\u5fae\u5c0f\u53d8\u5316\u3002\u5fae\u5206\u7684\u5b9a\u4e49\u57fa\u4e8e\u5bfc\u6570, \u53ef\u4ee5\u8868\u793a\u4e3a:<br \/>\n$$<br \/>\n\\mathrm{d} y=f^{\\prime}(x) \\cdot \\mathrm{d} x<br \/>\n$$<\/p>\n<\/li>\n<\/ul>\n<p>\u6240\u4ee5\uff0c\u5bfc\u6570\u548c\u5fae\u5206\u90fd\u4e0e\u51fd\u6570\u7684\u53d8\u5316\u7387\u6709\u5173\uff0c\u4f46\u5b83\u4eec\u7684\u91cd\u70b9\u7565\u6709\u4e0d\u540c\u3002\u5bfc\u6570\u5173\u6ce8\u7684\u662f\u51fd\u6570\u5728\u67d0\u70b9\u7684\u5207\u7ebf\u659c\u7387\uff0c\u800c\u5fae\u5206\u5173\u6ce8\u7684\u662f\u51fd\u6570\u503c\u7684\u5fae\u5c0f\u53d8\u5316\u4e0e\u81ea\u53d8\u91cf\u7684\u5fae\u5c0f\u53d8\u5316\u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/p>\n<p>\u7b80\u8a00\u4e4b\uff0c\u5bfc\u6570\u662f\u4e00\u4e2a\u6bd4\u7387\u6216\u659c\u7387\u7684\u6982\u5ff5\uff0c\u800c\u5fae\u5206\u63cf\u8ff0\u4e86\u5f53\u81ea\u53d8\u91cf\u53d1\u751f\u5fae\u5c0f\u53d8\u5316\u65f6\uff0c\u56e0\u53d8\u91cf\u5982\u4f55\u53d8\u5316\u3002<\/p>\n<h3>\u5bfc\u6570\u7684\u7cbe\u7ec6\u7684\u9664\u6cd5<\/h3>\n<ul>\n<li>\u5bfc\u6570\u7684\u51e0\u4f55\u89e3\u91ca\u662f\uff1a\u8be5\u51fd\u6570\u66f2\u7ebf\u5728\u8fd9\u4e00\u70b9\u4e0a\u7684\u5207\u7ebf\u659c\u7387\u3002<\/li>\n<li>\u5bfc\u6570\u7684\u7269\u7406\u89e3\u91ca\u662f\uff1a \u5bfc\u6570\u7269\u7406\u610f\u4e49\u968f\u4e0d\u540c\u7269\u7406\u91cf\u800c\u4e0d\u540c,\u4f46\u90fd\u662f\u8be5\u91cf\u7684\u53d8\u5316\u7684\u5feb\u6162\u51fd\u6570\uff0c\u5373\u53d8\u5316\u7387\u3002<\/li>\n<li>\u5bfc\u6570\u7684\u4ee3\u6570\u89e3\u91ca\u662f\uff1a\u66f4\u7cbe\u7ec6\u7684\u9664\u6cd5\u8fd0\u7b97\u3002<\/li>\n<\/ul>\n<p>\u524d\u4e24\u4e2a\u89e3\u91ca\u7684\u89d2\u5ea6\u76f8\u4fe1\u8bfb\u8005\u5df2\u7ecf\u5f88\u719f\u6089\u4e86\uff0c\u90a3\u4e48\u600e\u4e48\u7406\u89e3\u5bfc\u6570\u7684\u4ee3\u6570\u662f\u66f4\u7cbe\u7ec6\u7684\u9664\u6cd5\u8fd0\u7b97\u8fd9\u4e00\u8bf4\u6cd5\u5462\uff1f<\/p>\n<p>\u4e3e\u4e00\u4e2a\u7269\u7406\u4f8b\u5b50: <\/p>\n<p>\u8ddd\u79bb $s=25 \\mathrm{~m}$, \u65f6\u95f4 $t=5 \\mathrm{~s}$, \u6c42\u5e73\u5747\u901f\u5ea6 $v$ ?<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u5f88\u597d\u56de\u7b54, \u6b63\u5e38\u7684\u9664\u6cd5\u5373\u53ef\u8f7b\u677e\u5904\u7406 ( $v=s \/ t)$ \u3002<\/p>\n<p>\u4f46\u662f\u5982\u679c\u901f\u5ea6\u4e0d\u662f\u5747\u901f, \u800c\u4e14\u5e0c\u671b\u6c42\u5f97\u7b2c 5 \u79d2\u65f6\u7684\u77ac\u65f6\u901f\u5ea6, \u600e\u4e48\u529e?<br \/>\n$$<br \/>\nv=\\left.\\frac{\\mathrm{d} s}{\\mathrm{~d} t}\\right|_{t=5}=\\lim _{\\Delta t \\rightarrow 0} \\frac{s(5+\\Delta t)-s(5)}{\\Delta t}<br \/>\n$$<\/p>\n<p>$\\Delta t$ \u662f\u4e00\u4e2a\u5f88\u591a\u7684\u65f6\u6bb5, \u7528 $(5+\\Delta t)$ \u65f6\u523b\u8d70\u8fc7\u7684\u8def\u7a0b $s(5+\\Delta t)$ \u51cf\u53bb\u7b2c\u4e94\u79d2\u65f6\u8d70\u8fc7\u7684\u8def\u7a0b $s(5)$, \u518d\u9664\u4ee5\u65f6\u6bb5 $\\Delta t$, \u89e3\u5f97\u7684\u5c31\u662f\u7b2c\u4e94\u79d2\u65f6\u7684\u77ac\u65f6\u901f\u5ea6\u3002\u5f53 $\\Delta t$ \u65e0\u7a77\u5c0f\u65f6, \u5c31\u662f\u5bfc\u6570\u7684\u6982\u5ff5\u4e86, \u5373 $\\lim _{\\Delta t \\rightarrow 0} \\frac{s(5+\\Delta t)-s(5)}{\\Delta t}$ \u3002<\/p>\n<p>\u53ef\u4ee5\u770b\u51fa\u6765\u5bfc\u6570\u662f\u5373\u65f6\u7684\u53d8\u5316\u7387, \u653e\u5728\u8def\u7a0b\u548c\u65f6\u95f4\u8fd9\u4e2a\u7269\u7406\u573a\u666f\u4e0b, \u77ac\u65f6\u901f\u5ea6\u5c31\u662f\u8def\u7a0b\u7684\u5373\u65f6\u53d8\u5316\u7387\u3002\u5176\u6c42\u89e3\u7684\u65b9\u6cd5\u5c31\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u9664\u6cd5\u800c\u5df2\uff01\u672c\u8d28\u4e0a\u8fd8\u662f\u9664\u6cd5\u8fd0\u7b97\u3002<\/p>\n<h3>\u5bfc\u6570\u7684\u89e3\u8bfb<\/h3>\n<p>\u56de\u5fc6\u4e00\u4e0b\u5fae\u5206\u7684\u6570\u5b66\u8868\u8fbe\u5f0f:<br \/>\n$$<br \/>\n\\frac{\\mathrm{d} y}{\\mathrm{~d} x}=f^{\\prime}(x)=\\lim _{h \\rightarrow 0} \\frac{f(x+h)-f(x)}{h}<br \/>\n$$<\/p>\n<p>\u5bfc\u6570\u542b\u4e49\u7684\u89e3\u8bfb:<\/p>\n<ol>\n<li>\u5bfc\u6570\u63ed\u793a\u4e86\u51fd\u6570 $f(x)$ \u5728\u67d0\u70b9\u7684\u5207\u7ebf\u659c\u7387\u3002<\/li>\n<li>\u5bfc\u6570\u63ed\u793a\u4e86\u51fd\u6570 $f(x)$ \u5728\u67d0\u70b9\u7684\u53d8\u52a8\u89c4\u5f8b\u3002<\/li>\n<\/ol>\n<p>\u5728\u8fd9\u91cc\u6211\u66f4\u63a8\u5d07\u7b2c\u4e8c\u79cd\u89e3\u8bfb\u65b9\u6cd5\u3002\u5176\u5b9e\u53ef\u4ee5\u628a $\\mathrm{d} x$ \u4e58\u5230\u7b49\u53f7\u53f3\u8fb9\u53bb\u4f1a\u66f4\u5f62\u8c61, \u5373:<\/p>\n<p>$$<br \/>\n\\begin{gathered}<br \/>\n\\frac{\\mathrm{d} y}{\\mathrm{~d} x}=f^{\\prime}(x) \\\\<br \/>\n\\mathrm{d} y=f^{\\prime}(x) \\mathrm{d} x<br \/>\n\\end{gathered}<br \/>\n$$<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\u6765\u89e3\u8bfb\u4ec0\u4e48\u53eb\u51fd\u6570 $f(x)$ \u5728\u67d0\u70b9\u7684\u53d8\u52a8\u89c4\u5f8b\u3002\u5047\u8bbe $f(x)=x^2$, \u6c42 $x=5$ \u5904\u7684\u5bfc\u6570\u3002<br \/>\n$$<br \/>\n\\frac{\\mathrm{d} y}{\\mathrm{~d} x}=2 x=10 \\quad \\mathrm{~d} y=10 \\mathrm{~d} x<br \/>\n$$<br \/>\n\u5373, \u53d8\u91cf $x$ \u53d8\u52a8\u4e00\u70b9\u70b9, \u5c06\u5f15\u8d77\u51fd\u6570 $f(x)$ \u503c\u76f8\u5bf9\u4e8e\u53d8\u91cf $x$ \u5341\u500d\u7684\u53d8\u5316\u3002\u8fd9\u70b9\u5f88\u91cd\u8981\u3002<\/p>\n<p>\u53ef\u4ee5\u6839\u636e\u8fd9\u4e2a\u89e3\u8bfb\u6765\u63a8\u5bfc\u4e00\u4e0b\u5fae\u5206\u7684\u4e58\u6cd5\u6cd5\u5219\u548c\u5e42\u6cd5\u5219\u3002\u4e3e\u4e00\u4e2a\u4f8b\u5b50, \u5047\u8bbe\u51fd\u6570 $h(x)=f(x) \\cdot g(x)$, \u5148\u56de\u5fc6\u4e00\u4e0b\u5fae\u5206\u7684\u4e58\u6cd5\u6cd5\u5219:<br \/>\n$$<br \/>\nh^{\\prime}(x)=\\frac{\\mathrm{d} h}{\\mathrm{~d} x}=\\frac{\\mathrm{d} f}{\\mathrm{~d} x} g(x)+f(x) \\frac{\\mathrm{d} g}{\\mathrm{~d} x}=f^{\\prime} g+f g^{\\prime}<br \/>\n$$<\/p>\n<p>\u4e0b\u9762\u6765\u63a8\u5bfc\u4e00\u4e0b\u4e58\u6cd5\u6cd5\u5219\u600e\u4e48\u6765\u7684\u3002<\/p>\n<p>\u9996\u5148, \u628a\u51fd\u6570 $h(x)=f(x) \\cdot g(x)$ \u653e\u5728\u6c42\u89e3\u77e9\u5f62\u9762\u79ef\u8fd9\u4e2a\u4f8b\u5b50\u4e2d, \u5373 $h(x)$ \u662f\u77e9\u5f62\u9762\u79ef\u3001 $f(x)$ \u662f\u5bbd\u3001 $g(x)$ \u662f\u9ad8, \u6b64\u65f6\u5f53\u53d8\u91cf $x$ \u53d8\u52a8\u4e00\u70b9\u70b9\u65f6, \u6839\u636e\u5fae\u5206\u7684\u89e3\u8bfb, \u5176\u610f\u4e49\u662f\u77e9\u5f62\u9762\u79ef\u7684\u53d8\u52a8\u7387\uff0c\u5982\u4e0b\u56fe<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/am1-1.png\" style=\"height:200px\">\n<\/p>\n<ul>\n<li>\n<p>\u5176\u4e2d $\\mathrm{d} h$ \u4e3a\u9762\u79ef\u7684\u53d8\u52a8, \u5373\u56fe\u4e2d\u84dd\u8272\u7684\u90e8\u5206: $\\mathrm{d} h=\\mathrm{d} f \\cdot g(x)+f(x) \\cdot \\mathrm{d} g+\\mathrm{d} f \\cdot \\mathrm{d} g$, <\/p>\n<\/li>\n<li>\n<p>\u7531\u4e8e $\\mathrm{d} f \\cdot \\mathrm{d} g$ \u662f\u4e8c\u9636\u65e0\u7a77\u5c0f, \u7ea6\u7b49\u4e8e 0 , \u53ef\u4ee5\u7ea6\u6389; <\/p>\n<\/li>\n<li>\n<p>\u518d\u5728\u7b49\u53f7\u5de6\u53f3\u5206\u522b\u9664\u53bb $\\mathrm{d} x$ \u5c31\u5f97\u5230\u4e86\u5fae\u5206\u7684\u4e58\u6cd5\u6cd5\u5219 $\\frac{\\mathrm{d} h}{\\mathrm{~d} x}=\\frac{\\mathrm{d} f}{\\mathrm{~d} x} g(x)+f(x) \\frac{\\mathrm{d} g}{\\mathrm{~d} x}$ \u3002<\/p>\n<\/li>\n<li>\n<p>\u6b64\u65f6, $\\mathrm{d} h$ \u4e3a\u9762\u79ef\u7684\u53d8\u52a8, \u800c $\\frac{\\mathrm{d} h}{\\mathrm{~d} x}$ \u4e3a\u9762\u79ef\u7684\u53d8\u52a8\u7387\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u540c\u7406\uff0c\u53ef\u4ee5\u7ee7\u7eed\u63a8\u5bfc\u5bfc\u6570\u7684\u5e42\u6cd5\u5219\uff1a<\/p>\n<p>$$<br \/>\n\\frac{\\mathrm{d}\\left(x^n\\right)}{\\mathrm{d} x}=n x^{n-1}<br \/>\n$$<\/p>\n<p>\u8fd8\u7528\u521a\u521a\u7684\u4f8b\u5b50, \u5982\u679c\u6b64\u65f6 $f(x)$ \u548c $g(x)$ \u90fd\u7b49\u4e8e $x$, \u90a3\u4e48 $h(x)=x^2, \\mathrm{~d} h=\\mathrm{d} x^2$, \u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/am2.png\" style=\"height:200px\">\n<\/p>\n<p>\u6b64\u65f6\u6b63\u65b9\u5f62\u9762\u79ef\u7684\u53d8\u52a8\u6839\u636e\u516c\u5f0f\u63a8\u5bfc\u5982\u4e0b:<br \/>\n$$<br \/>\n\\mathrm{d} h=x \\cdot \\mathrm{d} x+x \\cdot \\mathrm{d} x+\\mathrm{d} x \\cdot \\mathrm{d} x=2 x \\mathrm{~d} x<br \/>\n$$<\/p>\n<p>\u56e0\u4e3a $\\mathrm{d} h=\\mathrm{d} x^2$, \u4ee3\u5165\u6574\u7406\u5f97\u5230 $\\frac{\\mathrm{d} x^2}{\\mathrm{~d} x}=2 x$ \u3002<\/p>\n<p>\u8fd9\u4e2a\u63a8\u5bfc\u7ed3\u679c\u4e0e\u76f4\u63a5\u4f7f\u7528\u5e42\u6cd5\u5219 $\\mathrm{d} h=\\mathrm{d} x^2=2 x$ \u6c42\u5f97\u7684\u7ed3\u679c\u662f\u4e00\u81f4\u7684\u3002<\/p>\n<p>\u540c\u6837\u7684\u65b9\u6cd5\u63a8\u5e7f\u5230\u4e09\u7ef4\u7a7a\u95f4, \u4e58\u6cd5\u6cd5\u5219\u548c\u5e42\u6cd5\u5219\u7684\u63a8\u5bfc\u4e5f\u662f\u9002\u7528\u7684, \u5982\u56fe:<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/am3-1.png\" style=\"height:200px\">\n<\/p>\n<p>\u6b64\u65f6\u7684\u4f53\u79ef\u8ba1\u7b97\u516c\u5f0f\u4e3a $y=f(x) \\cdot g(x) \\cdot z(x)$, \u4f53\u79ef\u7684\u53d8\u52a8\u4e3a:<br \/>\n$$<br \/>\n\\mathrm{d} y=\\mathrm{d} f \\cdot g \\cdot z+\\mathrm{d} g \\cdot f \\cdot z+\\mathrm{d} z \\cdot f \\cdot g<br \/>\n$$<\/p>\n<p>\u5982\u679c\u6b64\u65f6 $f(x) \u3001 g(x)$ \u548c $z(x)$ \u90fd\u7b49\u4e8e $x$, \u90a3\u4e48\u4f53\u79ef\u7684\u53d8\u52a8 $\\mathrm{d} y$ \u4e3a:<br \/>\n$$<br \/>\n\\begin{aligned}<br \/>\n\\mathrm{d} y &amp; =\\mathrm{d} x \\cdot x^2+\\mathrm{d} x \\cdot x^2+\\mathrm{d} x \\cdot x^2 \\\\<br \/>\n&amp; =3 x^2 \\mathrm{~d} x<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<p>\u4f53\u79ef\u7684\u53d8\u52a8\u7387 $\\frac{\\mathrm{d} y}{\\mathrm{~d} x}$ \u4e3a:<br \/>\n$$<br \/>\n\\frac{\\mathrm{d} y}{\\mathrm{~d} x}=3 x^2<br \/>\n$$<\/p>\n<p>\u53ef\u4ee5\u60f3\u8c61, \u7ee7\u7eed\u63a8\u5e7f\u5230\u9ad8\u7ef4\u7a7a\u95f4\u4e5f\u662f\u9002\u7528\u7684, \u8fd9\u91cc\u5c31\u4e0d\u65b9\u4fbf\u505a\u53ef\u89c6\u5316\u4e86\u3002<\/p>\n<h3>\u5fae\u5206\u4e0e\u51fd\u6570\u7684\u5355\u8c03\u6027<\/h3>\n<p>\u76f4\u63a5\u4e0a\u5b9a\u4e49: <\/p>\n<ul>\n<li>$f(x)$ \u5728 $(a, b)$ \u5185\u53ef\u5bfc, \u5982\u679c $f^{\\prime}(x)&gt;0$, \u90a3\u4e48\u51fd\u6570\u5728 $(a, b)$ \u5185\u5355\u8c03\u9012\u589e; <\/li>\n<li>\u5982\u679c $f^{\\prime}(x)&lt;0$, \u90a3\u4e48\u51fd\u6570\u5728 $(\\mathrm{a}, \\mathrm{b})$ \u5185\u5355\u8c03\u9012\u51cf\u3002<\/li>\n<\/ul>\n<p>\u7528\u5fae\u5206\u7684\u5b9a\u4e49\uff08\u5fae\u5206\u89e3\u91ca\u4e86\u51fd\u6570\u53d8\u52a8\u7684\u89c4\u5f8b\uff09\u4e5f\u5bb9\u6613\u89e3\u91ca\u5355\u8c03\u6027, \u5f53$x$\u7684\u53d8\u52a8\u5f15\u8d77\u7684\u51fd\u6570\u53d8\u52a8\u662f\u6b63\u589e\u957f\u65f6\uff0c\u51fd\u6570\u5355\u8c03\u9012\u589e\u3002\u5f53$x$\u7684\u53d8\u52a8\u5f15\u8d77\u7684\u51fd\u6570\u53d8\u52a8\u662f\u8d1f\u589e\u957f\u65f6\uff0c\u51fd\u6570\u5355\u8c03\u9012\u51cf\u3002<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n\n# \u5b9a\u4e49\u51fd\u6570 f(x)\ndef f(x):\n    return x**3 - 3*x**2 + 4\n\n# \u5b9a\u4e49\u51fd\u6570\u7684\u5bfc\u6570 f&#039;(x)\ndef df(x):\n    return 3*x**2 - 6*x\n\n# \u521b\u5efa x \u8f74\u4e0a\u7684\u70b9\nx = np.linspace(-1, 4, 400)\n\n# \u8ba1\u7b97\u51fd\u6570\u503c\u548c\u5bfc\u6570\u503c\ny = f(x)\ndy = df(x)\n\n# \u7ed8\u5236\u51fd\u6570 f(x) \u548c\u5176\u5bfc\u6570 f&#039;(x)\nplt.figure(figsize=(12, 3))\n\n# \u7ed8\u5236 f(x)\nplt.subplot(1, 3, 1)\nplt.plot(x, y, label=&#039;$f(x) = x^3 - 3x^2 + 4$&#039;, color=&#039;b&#039;)\nplt.title(&#039;Function $f(x)$&#039;)\nplt.xlabel(&#039;$x$&#039;)\nplt.ylabel(&#039;$f(x)$&#039;)\nplt.axhline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.axvline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.grid(True)\nplt.legend()\n\n# \u7ed8\u5236 f&#039;(x)\nplt.subplot(1, 3, 2)\nplt.plot(x, dy, label=&quot;$f&#039;(x) = 3x^2 - 6x$&quot;, color=&#039;r&#039;)\nplt.title(&#039;Derivative $f\\&#039;(x)$&#039;)\nplt.xlabel(&#039;$x$&#039;)\nplt.ylabel(&quot;$f&#039;(x)$&quot;)\nplt.axhline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.axvline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.grid(True)\nplt.legend()\n\n# \u7ed8\u5236 f(x)\nplt.subplot(1, 3, 3)\nplt.plot(x, y, label=&#039;$f(x) = x^3 - 3x^2 + 4$&#039;, color=&#039;b&#039;)\nplt.fill_between(x, y, where=(dy &gt; 0), interpolate=True, color=&#039;green&#039;, alpha=0.3, label=&#039;Increasing&#039;)\nplt.fill_between(x, y, where=(dy &lt; 0), interpolate=True, color=&#039;red&#039;, alpha=0.3, label=&#039;Decreasing&#039;)\nplt.title(&#039;Function $f(x)$ with Monotonicity&#039;)\nplt.xlabel(&#039;$x$&#039;)\nplt.ylabel(&#039;$f(x)$&#039;)\nplt.axhline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.axvline(0, color=&#039;black&#039;,linewidth=0.5)\nplt.grid(True)\nplt.legend()\n\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_12_0.png\" style=\"height:300px\">\n<\/p>\n<h3>\u6781\u503c\u4e0e\u978d\u70b9<\/h3>\n<ol>\n<li>\u6781\u503c (Extrema)\uff1a\n<ul>\n<li>\u5c40\u90e8\u6700\u5927\u503c (Local Maximum) : \u5728\u67d0\u4e2a\u70b9 $x=a$ \u5904\uff0c\u5982\u679c\u51fd\u6570\u503c $f(a)$ \u5927\u4e8e\u5728\u5176\u90bb\u57df\u5185\u6240\u6709\u5176\u4ed6\u70b9\u7684\u51fd\u6570\u503c\uff0c\u5219 $f(a)$ \u4e3a\u5c40\u90e8\u6700\u5927\u503c\u3002<\/li>\n<li>\u5c40\u90e8\u6700\u5c0f\u503c (Local Minimum) : \u5728\u67d0\u4e2a\u70b9 $x=b$ \u5904\uff0c\u5982\u679c\u51fd\u6570\u503c $f(b)$ \u5c0f\u4e8e\u5728\u5176\u90bb\u57df\u5185\u6240\u6709\u5176\u4ed6\u70b9\u7684\u51fd\u6570\u503c\uff0c\u5219 $f(b)$ \u4e3a\u5c40\u90e8\u6700\u5c0f\u503c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u978d\u70b9 (Saddle Point) :\n<ul>\n<li>\u978d\u70b9\u662f\u6307\u5728\u67d0\u4e2a\u70b9 $x=c$ \u5904\uff0c\u51fd\u6570\u7684\u5bfc\u6570\u4e3a\u96f6\uff0c\u4f46\u8be5\u70b9\u65e2\u4e0d\u662f\u5c40\u90e8\u6700\u5927\u503c\u4e5f\u4e0d\u662f\u5c40\u90e8\u6700\u5c0f\u503c\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\nfrom sympy import symbols, diff, solve\nfrom mpl_toolkits.mplot3d import Axes3D\n\n# \u5b9a\u4e49\u7b26\u53f7\u53d8\u91cf\u548c\u51fd\u6570\nx, y = symbols(&#039;x y&#039;)\nf_sym = x**3 - 3*x + y**3 - 3*y\ndf_sym_x = diff(f_sym, x)\ndf_sym_y = diff(f_sym, y)\n\n# \u6c42\u89e3\u4e00\u9636\u5bfc\u6570\u4e3a\u96f6\u7684\u70b9\uff08\u4e34\u754c\u70b9\uff09\ncritical_points = solve((df_sym_x, df_sym_y), (x, y))\n\n# \u8ba1\u7b97\u4e8c\u9636\u5bfc\u6570\u5e76\u8bc4\u4f30\u4e34\u754c\u70b9\u7684\u6027\u8d28\nd2f_sym_xx = diff(df_sym_x, x)\nd2f_sym_yy = diff(df_sym_y, y)\nd2f_sym_xy = diff(df_sym_x, y)\n\n# \u53ef\u89c6\u5316\nx_vals = np.linspace(-3, 3, 100)\ny_vals = np.linspace(-3, 3, 100)\nx_vals, y_vals = np.meshgrid(x_vals, y_vals)\nf_vals = x_vals**3 - 3*x_vals + y_vals**3 - 3*y_vals\n\nfig = plt.figure(figsize=(14, 8))\nax = fig.add_subplot(111, projection=&#039;3d&#039;)\n\n# \u7ed8\u5236\u51fd\u6570 f(x, y)\nax.plot_surface(x_vals, y_vals, f_vals, cmap=&#039;viridis&#039;, alpha=0.7)\n\n# \u6807\u8bb0\u4e34\u754c\u70b9\u53ca\u5176\u6027\u8d28\nfor point in critical_points:\n    x_val, y_val = float(point[0]), float(point[1])\n    z_val = x_val**3 - 3*x_val + y_val**3 - 3*y_val\n    d2f_xx_val = d2f_sym_xx.subs({x: x_val, y: y_val})\n    d2f_yy_val = d2f_sym_yy.subs({x: x_val, y: y_val})\n\n    if d2f_xx_val &gt; 0 and d2f_yy_val &gt; 0:\n        ax.scatter(x_val, y_val, z_val, color=&#039;g&#039;, s=100, label=&#039;Local Min&#039; if &#039;Local Min&#039; not in ax.get_legend_handles_labels()[1] else &quot;&quot;)\n    elif d2f_xx_val &lt; 0 and d2f_yy_val &lt; 0:\n        ax.scatter(x_val, y_val, z_val, color=&#039;r&#039;, s=100, label=&#039;Local Max&#039; if &#039;Local Max&#039; not in ax.get_legend_handles_labels()[1] else &quot;&quot;)\n    else:\n        ax.scatter(x_val, y_val, z_val, color=&#039;y&#039;, s=100, label=&#039;Saddle Point&#039; if &#039;Saddle Point&#039; not in ax.get_legend_handles_labels()[1] else &quot;&quot;)\n\nax.set_title(&#039;3D Visualization of $f(x, y) = x^3 - 3x + y^3 - 3y$&#039;)\nax.set_xlabel(&#039;$x$&#039;)\nax.set_ylabel(&#039;$y$&#039;)\nax.set_zlabel(&#039;$f(x, y)$&#039;)\nax.legend()\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_14_0.png\" style=\"height:400px\">\n<\/p>\n<h3>Hessian Matrix<\/h3>\n<p>Hessian\u77e9\u9635\u662f\u7528\u6765\u63cf\u8ff0\u4e00\u4e2a\u591a\u5143\u51fd\u6570\u5728\u67d0\u4e00\u70b9\u7684\u5c40\u90e8\u4e8c\u9636\u53d8\u5316\u60c5\u51b5\u7684\u65b9\u9635\u3002\u5bf9\u4e8e\u4e00\u4e2a $n$ \u7ef4\u51fd\u6570 $f(\\mathbf{x})$ \uff0c\u5176\u4e2d $\\mathbf{x}=\\left(x_1, x_2, \\ldots, x_n\\right)$ \uff0c\u8d6b\u897f\u77e9\u9635 $H$ \u5b9a\u4e49\u4e3a:<br \/>\n$$<br \/>\nH(\\mathbf{x})=\\left(\\begin{array}{cccc}<br \/>\n\\frac{\\partial^2 f}{\\partial x_1^2} &amp; \\frac{\\partial^2 f}{\\partial x_1 \\partial x_2} &amp; \\cdots &amp; \\frac{\\partial^2 f}{\\partial x_1 \\partial x_n} \\\\<br \/>\n\\frac{\\partial^2 f}{\\partial x_2 \\partial x_1} &amp; \\frac{\\partial^2 f}{\\partial x_2^2} &amp; \\cdots &amp; \\frac{\\partial^2 f}{\\partial x_2 \\partial x_n} \\\\<br \/>\n\\vdots &amp; \\vdots &amp; \\ddots &amp; \\vdots \\\\<br \/>\n\\frac{\\partial^2 f}{\\partial x_n \\partial x_1} &amp; \\frac{\\partial^2 f}{\\partial x_n \\partial x_2} &amp; \\cdots &amp; \\frac{\\partial^2 f}{\\partial x_n^2}<br \/>\n\\end{array}\\right)<br \/>\n$$<\/p>\n<p>\u5176\u4e2d\uff0c $\\frac{\\partial^2 f}{\\partial x_i \\partial x_j}$ \u8868\u793a $f$ \u5bf9 $x_i$ \u548c $x_j$ \u7684\u4e8c\u9636\u504f\u5bfc\u6570\u3002<\/p>\n<p>Hessian \u77e9\u9635\u4e3b\u8981\u7528\u4e8e\u5206\u6790\u591a\u5143\u51fd\u6570\u5728\u4e34\u754c\u70b9\u7684\u6027\u8d28\uff0c\u5373\u5224\u65ad\u8fd9\u4e9b\u70b9\u662f\u5c40\u90e8\u6781\u503c\uff08\u6700\u5927\u503c\u6216\u6700\u5c0f\u503c\uff09\u8fd8\u662f\u978d\u70b9\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b:<\/p>\n<ol>\n<li>\n<p>\u627e\u5230\u4e34\u754c\u70b9: \u6c42\u89e3\u4e00\u9636\u504f\u5bfc\u6570\u4e3a\u96f6\u7684\u70b9\u3002<br \/>\n$$<br \/>\n\\nabla f(\\mathbf{x})=\\left(\\frac{\\partial f}{\\partial x_1}, \\frac{\\partial f}{\\partial x_2}, \\ldots, \\frac{\\partial f}{\\partial x_n}\\right)=0<br \/>\n$$<\/p>\n<\/li>\n<li>\n<p>\u8ba1\u7b97Hessian\u77e9\u9635\uff1a\u5728\u6bcf\u4e2a\u4e34\u754c\u70b9\u5904\u8ba1\u7b97\u8d6b\u897f\u77e9\u9635 $H$ \u7684\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u5224\u522b\u6cd5:<\/p>\n<ul>\n<li>\u8ba1\u7b97\u884c\u5217\u5f0f $D$ : \u8ba1\u7b97Hessian\u77e9\u9635\u7684\u884c\u5217\u5f0f\u548c\u7279\u5f81\u503c\u6765\u5224\u65ad\u4e34\u754c\u70b9\u7684\u6027\u8d28\u3002<\/li>\n<li>\u5bf9\u4e8e\u4e8c\u5143\u51fd\u6570 $f(x, y)$ \uff0c \u884c\u5217\u5f0f $D$ \u8ba1\u7b97\u5982\u4e0b:<br \/>\n$$<br \/>\nD=\\operatorname{det}(H)=f_{x x} f_{y y}-\\left(f_{x y}\\right)^2<br \/>\n$$<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ul>\n<li>\u5224\u65ad\u4e34\u754c\u70b9\u7684\u6027\u8d28:<\/li>\n<li>\u5982\u679cD&gt;0\uff0c\u5219\u662f\u6781\u503c\u3002<\/li>\n<li>\u5982\u679cD&lt;0\uff0c\u5219\u662f\u978d\u70b9\u3002<\/li>\n<li>\u5982\u679cD=0\uff0c\u9700\u8981\u8fdb\u4e00\u6b65\u5206\u6790\uff08\u901a\u5e38\u4e0d\u80fd\u786e\u5b9a\u6027\u8d28\uff09\u3002<\/li>\n<\/ul>\n<p>\u884c\u5217\u5f0f D \u53ea\u662f\u4e00\u4e2a\u5de5\u5177\uff0c\u7528\u6765\u8f85\u52a9\u5224\u65ad\u6781\u503c\u4e0e\u978d\u70b9\uff0c\u5982\u679c\u8981\u51c6\u786e\u5224\u65ad\u4e34\u754c\u70b9\u7684\u6027\u8d28\uff08\u6781\u5927\u503c\uff0c\u6781\u5c0f\u503c\uff09\uff0c\u9700\u8981\u901a\u8fc7\u7279\u5f81\u503c\u6765\u5e2e\u5fd9\u3002\u5177\u4f53\u5224\u65ad\u65b9\u6cd5\u4e3a\uff1a<\/p>\n<ul>\n<li>\u5982\u679c\u6240\u6709\u7279\u5f81\u503c\u5747\u4e3a\u6b63\uff0c\u5219\u51fd\u6570\u5728\u8be5\u70b9\u6709\u5c40\u90e8\u6700\u5c0f\u503c\u3002<\/li>\n<li>\u5982\u679c\u6240\u6709\u7279\u5f81\u503c\u5747\u4e3a\u8d1f\uff0c\u5219\u51fd\u6570\u5728\u8be5\u70b9\u6709\u5c40\u90e8\u6700\u5927\u503c\u3002<\/li>\n<li>\u5982\u679c\u7279\u5f81\u503c\u6709\u6b63\u6709\u8d1f\uff0c\u5219\u51fd\u6570\u5728\u8be5\u70b9\u6709\u978d\u70b9\u3002<\/li>\n<li>\u5982\u679c\u7279\u5f81\u503c\u4e2d\u6709\u96f6\uff0c\u9700\u8981\u8fdb\u4e00\u6b65\u5206\u6790\uff08\u901a\u5e38\u4e0d\u80fd\u786e\u5b9a\u6027\u8d28\uff09\u3002<\/li>\n<\/ul>\n<p>\u4e3e\u4f8b\u51fd\u6570 $f(x, y)=x^3-3 x+y^3-3 y$ \u7684\u5206\u6790\u8fc7\u7a0b\u5982\u4e0b:<\/p>\n<ul>\n<li>\n<p>\u9996\u5148\uff0c\u627e\u5230\u4e34\u754c\u70b9:<br \/>\n$$<br \/>\n\\begin{aligned}<br \/>\n&amp; f_x=3 x^2-3=0 \\Longrightarrow x= \\pm 1 \\\\<br \/>\n&amp; f_y=3 y^2-3=0 \\Longrightarrow y= \\pm 1<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<\/li>\n<li>\n<p>\u7136\u540e\uff0c\u8ba1\u7b97Hessian\u77e9\u9635:<\/p>\n<\/li>\n<\/ul>\n<p>$$<br \/>\nH=\\left(\\begin{array}{cc}<br \/>\n6 x &amp; 0 \\\\<br \/>\n0 &amp; 6 y<br \/>\n\\end{array}\\right)<br \/>\n$$<\/p>\n<ul>\n<li>\u7279\u5f81\u65b9\u7a0b\u4e3a:<br \/>\n$$<br \/>\n\\operatorname{det}\\left(\\begin{array}{cc}<br \/>\n6 x-\\lambda &amp; 0 \\\\<br \/>\n0 &amp; 6 y-\\lambda<br \/>\n\\end{array}\\right)=0<br \/>\n$$<\/li>\n<\/ul>\n<p>\u89e3\u5f97\u7279\u5f81\u503c $\\lambda_1=6 x$ \u548c $\\lambda_2=6 y$ \u3002<\/p>\n<p>\u5728\u4e34\u754c\u70b9 $(1,1)$ \u5904:<\/p>\n<ul>\n<li>\u7279\u5f81\u503c $\\lambda_1=6 \\cdot 1=6&gt;0$<\/li>\n<li>\u7279\u5f81\u503c $\\lambda_2=6 \\cdot 1=6&gt;0$<\/li>\n<\/ul>\n<p>\u56e0\u6b64\uff0c $(1,1)$ \u662f\u5c40\u90e8\u6700\u5c0f\u503c\u3002<\/p>\n<p>\u5728\u4e34\u754c\u70b9 $(1,-1)$ \u5904:<\/p>\n<ul>\n<li>\u7279\u5f81\u503c $\\lambda_1=6 \\cdot 1=6&gt;0$<\/li>\n<li>\u7279\u5f81\u503c $\\lambda_2=6 \\cdot(-1)=-6&lt;0$<\/li>\n<\/ul>\n<p>\u56e0\u6b64\uff0c $(1,-1)$ \u662f\u978d\u70b9\u3002\u4ee5\u6b64\u7c7b\u63a8\uff0c\u53ef\u4ee5\u5206\u6790\u5176\u4ed6\u4e34\u754c\u70b9\u7684\u6027\u8d28\u3002<\/p>\n<h3>\u51fd\u6570\u7684\u51f9\u51f8\u6027<\/h3>\n<ul>\n<li>\u51fd\u6570\u7684\u51f9\u51f8\u6027\u662f\u63cf\u8ff0\u51fd\u6570\u5f62\u6001\u7684\u4e00\u79cd\u6027\u8d28\u3002\u5177\u4f53\u800c\u8a00\uff0c\u51fd\u6570\u7684\u51f9\u51f8\u6027\u53ef\u4ee5\u544a\u8bc9\u6211\u4eec\u51fd\u6570\u66f2\u7ebf\u662f\u5411\u4e0a\u5f2f\u66f2\u8fd8\u662f\u5411\u4e0b\u5f2f\u66f2\u7684\u3002<\/li>\n<li>\u51f8\u51fd\u6570\uff08Convex Function\uff09\uff1a\u51e0\u4f55\u4e0a\uff0c\u8fd9\u610f\u5473\u7740\u8fde\u63a5\u66f2\u7ebf\u4e0a\u4efb\u610f\u4e24\u70b9\u7684\u7ebf\u6bb5\u90fd\u4f4d\u4e8e\u66f2\u7ebf\u4e4b\u4e0a\u6216\u91cd\u5408\u3002<\/li>\n<li>\u51f9\u51fd\u6570\uff08Concave Function\uff09\uff1a\u51e0\u4f55\u4e0a\uff0c\u8fd9\u610f\u5473\u7740\u8fde\u63a5\u66f2\u7ebf\u4e0a\u4efb\u610f\u4e24\u70b9\u7684\u7ebf\u6bb5\u90fd\u4f4d\u4e8e\u66f2\u7ebf\u4e4b\u4e0b\u6216\u91cd\u5408\u3002<\/li>\n<\/ul>\n<p>Hessian\u77e9\u9635\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u51fd\u6570\u7684\u51f9\u51f8\u6027\u3002<\/p>\n<ul>\n<li>\u5982\u679c\u6240\u6709\u7279\u5f81\u503c\u5747\u4e3a\u6b63\uff0c\u5219\u8d6b\u897f\u77e9\u9635\u662f\u6b63\u5b9a\u7684\uff0c\u51fd\u6570\u5728\u8be5\u70b9\u9644\u8fd1\u662f\u51f8\u7684\u3002<\/li>\n<li>\u5982\u679c\u6240\u6709\u7279\u5f81\u503c\u5747\u4e3a\u8d1f\uff0c\u5219\u8d6b\u897f\u77e9\u9635\u662f\u8d1f\u5b9a\u7684\uff0c\u51fd\u6570\u5728\u8be5\u70b9\u9644\u8fd1\u662f\u51f9\u7684\u3002<\/li>\n<li>\u5982\u679c\u7279\u5f81\u503c\u6709\u6b63\u6709\u8d1f\uff0c\u5219\u51fd\u6570\u5728\u8be5\u70b9\u9644\u8fd1\u65e2\u4e0d\u662f\u51f8\u7684\u4e5f\u4e0d\u662f\u51f9\u7684\u3002<\/li>\n<\/ul>\n<h3><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/dusk\/64\/000000\/link.png\" style=\"height:50px;display:inline\"> \u94fe\u5f0f\u6cd5\u5219\uff08The Chain Rule\uff09<\/h3>\n<hr \/>\n<p>\u5728\u673a\u5668\u5b66\u4e60\u4e2d\uff0c\u5c24\u5176\u662f\u5728\u6df1\u5ea6\u5b66\u4e60\u548c\u795e\u7ecf\u7f51\u7edc\u4e2d\uff0c\u94fe\u5f0f\u6cd5\u5219\u7528\u4e8e\u8ba1\u7b97\u590d\u5408\u51fd\u6570\u7684\u5bfc\u6570\uff0c\u8fd9\u5728\u53cd\u5411\u4f20\u64ad\u7b97\u6cd5\u4e2d\u5c24\u4e3a\u5173\u952e\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5f53\u8bad\u7ec3\u4e00\u4e2a\u6df1\u5ea6\u795e\u7ecf\u7f51\u7edc\u65f6\uff0c\u9700\u8981\u8ba1\u7b97\u635f\u5931\u51fd\u6570\u76f8\u5bf9\u4e8e\u6bcf\u4e2a\u6743\u91cd\u7684\u68af\u5ea6\u3002\u7531\u4e8e\u795e\u7ecf\u7f51\u7edc\u7684\u6bcf\u4e00\u5c42\u90fd\u662f\u590d\u5408\u7684\uff0c\u94fe\u5f0f\u6cd5\u5219\u80fd\u591f\u4ece\u8f93\u51fa\u5c42\u9010\u6b65\u56de\u5230\u8f93\u5165\u5c42\uff0c\u8ba1\u7b97\u8fd9\u4e9b\u68af\u5ea6\u3002<br \/>\n\u5148\u6765\u770b\u4e00\u4e0b\u5fae\u5206\u94fe\u5f0f\u6cd5\u5219\u7684\u6570\u5b66\u516c\u5f0f\uff1a<\/p>\n<p>$$<br \/>\n\\begin{gathered}<br \/>\ny=f(g(x)) \\\\<br \/>\n\\frac{\\mathrm{d} y}{\\mathrm{~d} x}=\\frac{\\mathrm{d} f}{\\mathrm{~d} x}=\\frac{\\mathrm{d} f}{\\mathrm{~d} g} \\cdot \\frac{\\mathrm{d} g}{\\mathrm{~d} x}=f^{\\prime}(g(x)) \\cdot \\mathrm{g}^{\\prime}(x)<br \/>\n\\end{gathered}<br \/>\n$$<\/p>\n<p>\u7406\u89e3\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u5c31\u50cf\u5265\u6d0b\u8471\u4e00\u6837\uff0c\u4e00\u5c42\u4e00\u5c42\u62e8\u5f00\u91cc\u9762\u7684\u5fc3\u3002\u94fe\u5f0f\u6cd5\u5219\u4e00\u822c\u7528\u4e8e\u590d\u5408\u51fd\u6570\u7684\u6c42\u5bfc\uff0c\u5148\u5bf9\u5916\u5c42\u51fd\u6570\u6c42\u5bfc\uff0c\u518d\u4e58\u4e0a\u5185\u5c42\u51fd\u6570\u7684\u5bfc\u6570\u3002\u4e4b\u524d\u4e00\u76f4\u5f3a\u8c03\u5bfc\u6570\u662f\u51fd\u6570\u7684\u53d8\u52a8\u89c4\u5f8b\uff0c\u90a3\u4e48\u94fe\u5f0f\u6cd5\u5219\u5c31\u662f\u53d8\u52a8\u7684\u4f20\u5bfc\u6cd5\u5219\u3002<\/p>\n<p>\u4e3e\u4f8b\uff1a<br \/>\n$$<br \/>\n\\begin{aligned}<br \/>\n&amp; y=\\sin \\left(x^2\\right) \\\\<br \/>\n&amp; h=x^2 \\\\<br \/>\n&amp; y=\\sin (h)<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<p>\u5bf9 $y$ \u6c42\u5bfc\u7684\u6b65\u9aa4\u5982\u4e0b:<br \/>\n$$<br \/>\n\\begin{aligned}<br \/>\n&amp; \\frac{\\mathrm{d} y}{\\mathrm{~d} h}=\\cos h \\quad \\mathrm{~d} y=\\cos h \\mathrm{~d} h \\\\<br \/>\n&amp; \\mathrm{~d} h=\\mathrm{d} x^2=2 x \\mathrm{~d} x \\\\<br \/>\n&amp; \\mathrm{~d} y=\\cos x^2 \\cdot 2 x \\mathrm{~d} x \\Rightarrow \\frac{\\mathrm{d} y}{\\mathrm{~d} x}=\\cos x^2 \\cdot 2 x<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<p>\u89e3\u91ca\u4e00\u4e0b, $x$ \u7684\u53d8\u52a8\u4f1a\u5f15\u8d77 $h$ \u7684\u53d8\u52a8, \u8fdb\u800c\u5f15\u8d77 $y$ \u7684\u53d8\u52a8\u3002\u94fe\u5f0f\u6cd5\u5219\u5c31\u662f\u53d8\u52a8\u7684\u4f20\u5bfc\u6cd5\u5219\u3002<\/p>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/dusk\/64\/000000\/graph.png\" style=\"height:50px;display:inline\"> \u68af\u5ea6<\/h2>\n<ul>\n<li>\u68af\u5ea6\u7684\u6570\u5b66\u5b9a\u4e49<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u591a\u53d8\u91cf\u6807\u91cf\u51fd\u6570 $f\\left(x_1, x_2, \\ldots, x_n\\right)$ \uff0c\u68af\u5ea6\u662f\u4e00\u4e2a\u7531\u504f\u5bfc\u6570\u7ec4\u6210\u7684\u5411\u91cf\u3002\u68af\u5ea6\u5411\u91cf\u8868\u793a\u51fd\u6570 $f$ \u5728\u6bcf\u4e2a\u65b9\u5411\u4e0a\u7684\u53d8\u5316\u7387\u3002\u6570\u5b66\u4e0a\uff0c\u68af\u5ea6\u53ef\u4ee5\u8868\u793a\u4e3a:<br \/>\n$$<br \/>\n\\nabla f=\\left(\\frac{\\partial f}{\\partial x_1}, \\frac{\\partial f}{\\partial x_2}, \\ldots, \\frac{\\partial f}{\\partial x_n}\\right)<br \/>\n$$<\/p>\n<p>\u5176\u4e2d $\\frac{\\partial f}{\\partial x_i}$ \u8868\u793a $f$ \u5bf9\u7b2c $i$ \u4e2a\u53d8\u91cf $x_i$ \u7684\u504f\u5bfc\u6570\u3002<\/p>\n<ul>\n<li>\u68af\u5ea6\u7684\u51e0\u4f55\u89e3\u91ca<\/li>\n<\/ul>\n<p>\u68af\u5ea6\u5411\u91cf\u6307\u5411\u51fd\u6570\u503c\u589e\u52a0\u6700\u5feb\u7684\u65b9\u5411\uff0c\u5176\u5927\u5c0f\u7b49\u4e8e\u8be5\u65b9\u5411\u4e0a\u7684\u6700\u5927\u53d8\u5316\u7387\u3002\u4f8b\u5982\uff0c\u5728\u4e8c\u7ef4\u5e73\u9762\u4e0a\uff0c\u5982\u679c\u6211\u4eec\u6709\u4e00\u4e2a\u6807\u91cf\u51fd\u6570 $f(x, y)$ \uff0c\u5176\u68af\u5ea6\u662f:<br \/>\n$$<br \/>\n\\nabla f=\\left(\\frac{\\partial f}{\\partial x}, \\frac{\\partial f}{\\partial y}\\right)<br \/>\n$$<\/p>\n<p>\u6b64\u65f6\uff0c\u68af\u5ea6\u5411\u91cf $\\nabla f$ \u6307\u5411 $f$ \u503c\u589e\u52a0\u6700\u5feb\u7684\u65b9\u5411\uff0c\u5e76\u4e14\u5176\u957f\u5ea6\u8868\u793a $f$ \u5728\u8be5\u65b9\u5411\u4e0a\u7684\u6700\u5927\u53d8\u5316\u7387\u3002<\/p>\n<ul>\n<li>\u68af\u5ea6\u5728\u6df1\u5ea6\u5b66\u4e60\u7684\u5e94\u7528<\/li>\n<\/ul>\n<p>\u68af\u5ea6\u4e0b\u964d\u6cd5\uff08Gradient Descent\uff09\u662f\u4e00\u79cd\u5e38\u7528\u7684\u6700\u4f18\u5316\u7b97\u6cd5\uff0c\u901a\u8fc7\u6cbf\u68af\u5ea6\u7684\u53cd\u65b9\u5411\u79fb\u52a8\uff0c\u9010\u6b65\u903c\u8fd1\u51fd\u6570\u7684\u6700\u5c0f\u503c\u3002\u68af\u5ea6\u4e0b\u964d\u6cd5\u5728\u673a\u5668\u5b66\u4e60\u4e2d\u7684\u53c2\u6570\u4f18\u5316\u4e2d\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n<ul>\n<li>\u68af\u5ea6\u7684\u8ba1\u7b97\u793a\u4f8b<br \/>\n\u8003\u8651\u4e00\u4e2a\u7b80\u5355\u7684\u4e8c\u7ef4\u51fd\u6570 $f(x, y)=x^2+y^2$ \uff0c\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u5176\u68af\u5ea6:<br \/>\n$$<br \/>\n\\nabla f=\\left(\\frac{\\partial f}{\\partial x}, \\frac{\\partial f}{\\partial y}\\right)=(2 x, 2 y)<br \/>\n$$<\/li>\n<\/ul>\n<p>\u8fd9\u8868\u660e\uff0c\u5728\u4efb\u610f\u70b9 $(x, y)$ \uff0c\u68af\u5ea6\u5411\u91cf $(2 x, 2 y)$ \u6307\u5411\u51fd\u6570\u503c\u589e\u52a0\u6700\u5feb\u7684\u65b9\u5411\uff0c\u5e76\u4e14\u5176\u5927\u5c0f\u662f $\\sqrt{(2 x)^2+(2 y)^2}=2 \\sqrt{x^2+y^2}$ \u3002\u4e0b\u9762\u8ba9\u6211\u4eec\u901a\u8fc7\u7ed8\u5236\u4e00\u4e2a\u51fd\u6570\u7684\u7b49\u9ad8\u7ebf\u56fe\uff08\u7b49\u503c\u7ebf\u56fe\uff09\u4ee5\u53ca\u5176\u68af\u5ea6\u573a\u6765\u8fdb\u4e00\u6b65\u7406\u89e3\u68af\u5ea6\u7684\u6982\u5ff5\u3002<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n\n# \u5b9a\u4e49\u51fd\u6570\ndef f(x, y):\n    return x**2 + y**2\n\n# \u5b9a\u4e49\u68af\u5ea6\u51fd\u6570\ndef gradient_f(x, y):\n    return np.array([2*x, 2*y])\n\n# \u521b\u5efa\u7f51\u683c\nx = np.linspace(-2, 2, 20)\ny = np.linspace(-2, 2, 20)\nX, Y = np.meshgrid(x, y)\nZ = f(X, Y)\n\n# \u8ba1\u7b97\u68af\u5ea6\nU, V = gradient_f(X, Y)\n\n# \u7ed8\u5236\u7b49\u9ad8\u7ebf\u56fe\u548c\u68af\u5ea6\u573a\nplt.figure(figsize=(8, 6))\nplt.contour(X, Y, Z, levels=20)\nplt.quiver(X, Y, U, V, color=&#039;r&#039;)\n\nplt.title(&#039;Function Contour and Gradient Field&#039;)\nplt.xlabel(&#039;x&#039;)\nplt.ylabel(&#039;y&#039;)\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_19_0.png\" style=\"height:300px\">\n<\/p>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/office\/80\/000000\/conflict.png\" style=\"height:50px;display:inline\"> \u6cf0\u52d2\u516c\u5f0f<\/h2>\n<hr \/>\n<p>\u6cf0\u52d2\u516c\u5f0f\u5141\u8bb8\u7528\u591a\u9879\u5f0f\u6765\u8fd1\u4f3c\u590d\u6742\u7684\u51fd\u6570\uff0c\u8fd9\u5728\u7b97\u6cd5\u4e2d\u6709\u65f6\u7528\u4e8e\u7b80\u5316\u8ba1\u7b97\u3002\u4f8b\u5982\uff0c\u5728\u9ad8\u65af\u8fc7\u7a0b\u56de\u5f52\u548c\u4e00\u4e9b\u5176\u4ed6\u8d1d\u53f6\u65af\u65b9\u6cd5\u4e2d\uff0c\u6cf0\u52d2\u5c55\u5f00\u7528\u4e8e\u7ebf\u6027\u5316\u5173\u4e8e\u540e\u9a8c\u7684\u8ba1\u7b97\u3002<br \/>\n\u6cf0\u52d2\u516c\u5f0f\u7684\u672c\u8d28\u662f\u7528\u7b80\u5355\u7684\u591a\u9879\u5f0f\u6765\u8fd1\u4f3c\u62df\u5408\u590d\u6742\u7684\u51fd\u6570\u3002<\/p>\n<p>\u5148\u56de\u5fc6\u4e00\u4e0b\u5fae\u5206:<br \/>\n$$<br \/>\n\\frac{f\\left(x_0+\\Delta x\\right)-f\\left(x_0\\right)}{\\Delta x} \\approx f^{\\prime}\\left(x_0\\right)<br \/>\n$$<\/p>\n<p>\u82e5 $f^{\\prime}\\left(x_0\\right)$ \u5b58\u5728, \u5728 $x_0$ \u9644\u8fd1\u6709 $f\\left(x_0+\\Delta x\\right)-f\\left(x_0\\right) \\approx f^{\\prime}\\left(x_0\\right) \\Delta x$, \u4ee4 $\\Delta x=x-x_0$, \u5c06 $\\Delta x$ \u5e26\u5165\u4e0a\u5f0f\u6574\u7406\u5f97\u5230:<br \/>\n$$<br \/>\nf(x) \\approx f\\left(x_0\\right)+f^{\\prime}\\left(x_0\\right)\\left(x-x_0\\right)<br \/>\n$$<\/p>\n<p>\u8fd9\u5c31\u662f\u6cf0\u52d2\u516c\u5f0f\u601d\u60f3\u7684\u8d77\u6e90, \u5373\u51fd\u6570 $f(x)$ \u53ef\u80fd\u662f\u4e00\u4e2a\u5f88\u590d\u6742\u7684\u51fd\u6570, \u751a\u81f3\u590d\u6742\u5230\u5199\u4e0d\u51fa\u51fd\u6570\u516c\u5f0f, \u4f46\u53ef\u4ee5\u7528\u8be5\u51fd\u6570\u4e2d\u67d0\u70b9 $\\mathrm{P}$ \u7684\u51fd\u6570\u503c $f\\left(x_0\\right)$ \u548c\u5bfc\u6570 $f^{\\prime}\\left(x_0\\right)$ \u8fdb\u884c\u8fd1\u4f3c, \u8fdb\u4e00\u6b65\u89e3\u91ca\u4e00\u4e0b, \u9996\u5148\u5e0c\u671b\u8fd1\u4f3c\u51fd\u6570\u80fd\u901a\u8fc7\u7ed9\u5b9a\u7684\u70b9, \u6bd4\u5982\u70b9 $\\mathrm{P}$ \u7684\u51fd\u6570\u503c $f\\left(x_0\\right)$, \u7136\u540e, \u4e3a\u4e86\u786e\u4fdd\u8fd1\u4f3c\u51fd\u6570\u7684\u5f62\u72b6\u4e0e\u539f\u51fd\u6570\u76f8\u4f3c, \u6211\u4eec\u5e0c\u671b\u5b83\u4eec\u5728\u70b9 $\\mathrm{P}$ \u7684\u659c\u7387\u662f\u4e00\u6837\u7684, \u8fd9\u5c31\u662f\u6c42\u4e00\u9636\u5bfc\u6570\u7684\u539f\u56e0\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u4ec5\u4ec5\u77e5\u9053\u5728\u70b9P\u7684\u659c\u7387\u53ef\u80fd\u4e0d\u8db3\u4ee5\u63cf\u8ff0\u6574\u4e2a\u51fd\u6570\u7684\u5f62\u72b6\u3002\u4e3a\u4e86\u66f4\u597d\u5730\u6a21\u62df\u51fd\u6570\u7684\u5f62\u72b6\uff0c\u53ef\u80fd\u9700\u8981\u8003\u8651\u51fd\u6570\u7684\u5f2f\u66f2\u7a0b\u5ea6\uff0c\u4e5f\u5c31\u662f\u51f9\u51f8\u6027\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u8981\u8003\u8651\u4e8c\u9636\u5bfc\u6570\u3002\u7136\u540e\uff0c\u4e3a\u4e86\u6355\u6349\u66f4\u591a\u7684\u7ec6\u8282\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u4e09\u9636\u3001\u56db\u9636\u751a\u81f3\u66f4\u9ad8\u9636\u7684\u5bfc\u6570\uff0c\u5bfc\u6570\u9636\u6570\u8d8a\u591a\u5bf9\u51fd\u6570\u7684\u7ea6\u675f\u80fd\u529b\u8d8a\u5f3a\uff0c\u8d8a\u80fd\u62df\u5408\u51fa\u4e00\u4e2a\u786e\u5b9a\u7684\u51fd\u6570\u3002\u6240\u4ee5\u6cf0\u52d2\u516c\u5f0f\u53ef\u4ee5\u5199\u6210\uff1a<\/p>\n<p>$$<br \/>\nP_n(x)=f\\left(x_0\\right)+f^{\\prime}\\left(x_0\\right)\\left(x-x_0\\right)+\\frac{f^{\\prime \\prime}\\left(x_0\\right)}{2!}\\left(x-x_0\\right)^2+\\cdots+\\frac{f^{(n)}\\left(x_0\\right)}{n!}\\left(x-x_0\\right)^n<br \/>\n$$<\/p>\n<p>\u521a\u521a\u4ecb\u7ecd\u4e86\u5bfc\u6570\u9636\u6570, \u4e0b\u9762\u60f3\u60f3 $\\left(x-x_0\\right)^n, n=1,2,3 \\cdots$ \u8fd9\u4e2a\u591a\u9879\u5f0f\u6709\u4ec0\u4e48\u7528? <\/p>\n<p>\u5206\u522b\u6c42 $f(x)=e^x$ \u5728\u70b9 $x=0$ \u5904\u7684\u5404\u9636\u591a\u9879\u5f0f, \u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n\n# \u5b9a\u4e49\u539f\u51fd\u6570\u548c\u6cf0\u52d2\u5c55\u5f00\u7684\u5404\u9879\ndef f(x):\n    return np.exp(x)\n\ndef taylor_approx(x, n):\n    result = 0\n    for i in range(n + 1):\n        result += (x**i) \/ np.math.factorial(i)\n    return result\n\n# \u751f\u6210\u6570\u636e\u70b9\nx = np.linspace(-2, 2, 400)\ny = f(x)\n\n# \u521b\u5efa\u56fe\u50cf\u548c2x2\u7684\u5b50\u56fe\nfig, axs = plt.subplots(2, 2, figsize=(6, 6))\n\n# \u7ed8\u5236\u4e0d\u540c\u9636\u6570\u7684\u6cf0\u52d2\u591a\u9879\u5f0f\u8fd1\u4f3c\nfor n, ax in zip(range(1, 5), axs.ravel()):\n    ax.plot(x, y, label=&#039;$e^x$&#039;, color=&#039;black&#039;)\n    ax.plot(x, taylor_approx(x, n), label=f&#039;Taylor Polynomial (n={n})&#039;)\n    ax.set_title(f&#039;Taylor Series Approximation of $e^x$ at $x=0$, n={n}&#039;)\n    ax.set_xlabel(&#039;x&#039;)\n    ax.set_ylabel(&#039;y&#039;)\n    ax.legend()\n    ax.grid(True)\n\n# \u8c03\u6574\u5e03\u5c40\u4ee5\u9632\u6b62\u6807\u7b7e\u91cd\u53e0\nplt.tight_layout()\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_22_0.png\" style=\"height:400px\">\n<\/p>\n<p>\u60f3\u8c61\u7528\u4e00\u6761\u66f2\u7ebf\u6765\u8fd1\u4f3c\u63cf\u8ff0\u4e00\u5ea7\u5c71\u7684\u5f62\u72b6\uff08\u590d\u6742\u51fd\u6570\uff09\u3002\u5982\u679c\u53ea\u4f7f\u7528\u76f4\u7ebf\uff08\u7ebf\u6027\u51fd\u6570\uff09\uff0c\u53ef\u80fd\u53ea\u80fd\u5927\u81f4\u63cf\u8ff0\u5c71\u7684\u4e00\u4e2a\u659c\u5761\u3002\u4f46\u5982\u679c\u4f7f\u7528\u4e86\u4e00\u4e2a\u66f2\u7ebf\uff08\u6bd4\u5982\u4e8c\u6b21\u51fd\u6570\u6216\u66f4\u9ad8\u6b21\u7684\u51fd\u6570\uff09\uff0c\u5c31\u53ef\u4ee5\u66f4\u51c6\u786e\u5730\u63cf\u8ff0\u5c71\u7684\u8f6e\u5ed3\u3002\u4e5f\u5c31\u662f\u8bf4\u4f4e\u9636\u9879\uff08\u5982\u7ebf\u6027\u6216\u4e8c\u6b21\u9879\uff09\u901a\u5e38\u5728\u51fd\u6570\u7684\u8d77\u59cb\u90e8\u5206\u8d77\u4e3b\u5bfc\u4f5c\u7528\uff0c\u800c\u9ad8\u9636\u9879\uff08\u5982\u4e09\u6b21\u3001\u56db\u6b21\u6216\u66f4\u9ad8\u7684\u9879\uff09\u5728\u51fd\u6570\u7684\u8fdc\u7aef\u8d77\u4e3b\u5bfc\u4f5c\u7528\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u6cf0\u52d2\u516c\u5f0f\u4e2d\u6709\u591a\u9879\u5f0f\u7684\u539f\u56e0\u3002\u6700\u540e\u89e3\u91ca\u4e00\u4e0b\u9636\u4e58 $n!$ \u7684\u4f5c\u7528, \u5982\u4e0b\u6240\u793a, \u5206\u522b\u8868\u793a $x^2$ \u548c $x^9$ \u3002\u5f53 $x$ \u53d6\u503c\u8f83\u5927\u65f6, $x^2$ \u5b8c\u5168\u88ab $x^9$ \u538b\u5236, $x^9+x^2$ \u51e0\u4e4e\u53ea\u6709 $x^9$ \u7684\u7279\u6027\u3002\u56e0\u6b64\u7531\u4e8e\u9ad8\u9636\u7684\u5e42\u51fd\u6570\u589e\u957f\u592a\u5feb,\u9700\u8981\u9664\u9636\u4e58\u6765\u51cf\u7f13\u589e\u901f\u3002<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n\n# \u751f\u6210\u6570\u636e\u70b9\nx = np.linspace(-2, 2, 400)\n\n# \u5b9a\u4e49\u5e42\u51fd\u6570\ny_x2 = x**2\ny_x9 = x**9\ny_sum = x**2 + x**9\n\n# \u521b\u5efa\u56fe\u50cf\u548c3x1\u7684\u5b50\u56fe\nfig, axs = plt.subplots(1, 3, figsize=(10, 3))\n\n# \u7ed8\u5236 $x^2$ \u56fe\u50cf\naxs[0].plot(x, y_x2, label=&#039;$x^2$&#039;, color=&#039;blue&#039;)\naxs[0].set_title(&#039;$x^2$&#039;)\naxs[0].set_xlabel(&#039;x&#039;)\naxs[0].set_ylabel(&#039;y&#039;)\naxs[0].legend()\naxs[0].grid(True)\n\n# \u7ed8\u5236 $x^9$ \u56fe\u50cf\naxs[1].plot(x, y_x9, label=&#039;$x^9$&#039;, color=&#039;red&#039;)\naxs[1].set_title(&#039;$x^9$&#039;)\naxs[1].set_xlabel(&#039;x&#039;)\naxs[1].set_ylabel(&#039;y&#039;)\naxs[1].legend()\naxs[1].grid(True)\n\n# \u7ed8\u5236 $x^2 + x^9$ \u56fe\u50cf\naxs[2].plot(x, y_sum, label=&#039;$x^2 + x^9$&#039;, color=&#039;purple&#039;)\naxs[2].set_title(&#039;$x^2 + x^9$&#039;)\naxs[2].set_xlabel(&#039;x&#039;)\naxs[2].set_ylabel(&#039;y&#039;)\naxs[2].legend()\naxs[2].grid(True)\n\n# \u8c03\u6574\u5e03\u5c40\u4ee5\u9632\u6b62\u6807\u7b7e\u91cd\u53e0\nplt.tight_layout()\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_24_0.png\" style=\"height:300px\">\n<\/p>\n<p>\u6700\u540e\uff0c\u518d\u63d0\u4e00\u4e0b\u6cf0\u52d2\u516c\u5f0f\u7684\u672c\u8d28\uff1a<strong>\u5f53\u4e00\u4e2a\u590d\u6742\u51fd\u6570\u592a\u590d\u6742\u4e0d\u53ef\u6c42\u65f6\uff0c\u53ef\u4ee5\u7528\u8be5\u51fd\u6570\u67d0\u70b9\u7684\u503c\u548c\u8be5\u70b9\u7684\u591a\u9636\u5bfc\u6570\u8fdb\u884c\u62df\u5408\u3002<\/strong><\/p>\n<h3><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/cotton\/64\/000000\/combo-chart.png\" style=\"height:50px;display:inline\"> Fourier series<\/h3>\n<hr \/>\n<ul>\n<li>\u5085\u91cc\u53f6\u7ea7\u6570\u662f\u4e00\u79cd\u7528\u4e09\u89d2\u51fd\u6570\uff08\u6b63\u5f26\u548c\u4f59\u5f26\u51fd\u6570\uff09\u7684\u65e0\u7a77\u7ea7\u6570\u6765\u8868\u793a\u5468\u671f\u51fd\u6570\u7684\u65b9\u6cd5\u3002\u8fd9\u4e2a\u65b9\u6cd5\u7531\u6cd5\u56fd\u6570\u5b66\u5bb6\u7ea6\u745f\u592b\u00b7\u5085\u91cc\u53f6\u63d0\u51fa\uff0c\u5e76\u5728\u8bb8\u591a\u6570\u5b66\u548c\u5de5\u7a0b\u9886\u57df\u5f97\u5230\u4e86\u5e7f\u6cdb\u5e94\u7528\u3002<\/li>\n<li>\u5085\u91cc\u53f6\u7ea7\u6570\u7684\u57fa\u672c\u601d\u60f3\u662f\u5c06\u4e00\u4e2a\u5468\u671f\u51fd\u6570\u5206\u89e3\u4e3a\u4e0d\u540c\u9891\u7387\u7684\u6b63\u5f26\u548c\u4f59\u5f26\u51fd\u6570\u7684\u548c\u3002<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u5468\u671f\u4e3a $2 \\pi$ \u7684\u51fd\u6570 $f(x)$ \uff0c\u5b83\u53ef\u4ee5\u8868\u793a\u4e3a:<br \/>\n$$<br \/>\nf(x)=\\frac{a_0}{2}+\\sum_{n=1}^{\\infty}\\left(a_n \\cos (n x)+b_n \\sin (n x)\\right)<br \/>\n$$<\/p>\n<p>\u5176\u4e2d:<\/p>\n<ul>\n<li>$a_0$ \u662f\u51fd\u6570\u7684\u5e73\u5747\u503c\uff08\u76f4\u6d41\u5206\u91cf\uff09\uff0c\u7531\u4ee5\u4e0b\u516c\u5f0f\u8ba1\u7b97:<\/li>\n<\/ul>\n<p>$$<br \/>\na_0=\\frac{1}{\\pi} \\int_{-\\pi}^\\pi f(x) d x<br \/>\n$$<\/p>\n<ul>\n<li>$a_n$ \u548c $b_n$ \u662f\u5085\u91cc\u53f6\u7cfb\u6570\uff0c\u5206\u522b\u8868\u793a\u4f59\u5f26\u9879\u548c\u6b63\u5f26\u9879\u7684\u7cfb\u6570\uff0c\u8ba1\u7b97\u516c\u5f0f\u4e3a:<\/li>\n<\/ul>\n<p>$$<br \/>\n\\begin{aligned}<br \/>\n&amp; a_n=\\frac{1}{\\pi} \\int_{-\\pi}^\\pi f(x) \\cos (n x) d x \\\\<br \/>\n&amp; b_n=\\frac{1}{\\pi} \\int_{-\\pi}^\\pi f(x) \\sin (n x) d x<br \/>\n\\end{aligned}<br \/>\n$$<\/p>\n<p>\u8fd9\u4e9b\u7cfb\u6570 $a_n$ \u548c $b_n$ \u63cf\u8ff0\u4e86\u51fd\u6570\u5728\u4e0d\u540c\u9891\u7387\u7684\u6b63\u5f26\u548c\u4f59\u5f26\u6210\u5206\u7684\u5e45\u5ea6\u3002<\/p>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\n# Define the function f(x)\ndef f(x):\n    return np.sin(x) + 0.5 * np.cos(2 * x) +np.cos(1.5 * x) # Example function, you can change this to any 2\u03c0 periodic function\n\n# Number of terms in the Fourier series\nN = 5\n\n# Calculate Fourier coefficients\na0 = (1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000))\nan = [(1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)) * np.cos(n * np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000)) for n in range(1, N+1)]\nbn = [(1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)) * np.sin(n * np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000)) for n in range(1, N+1)]\n\n# Create the Fourier series approximation\ndef fourier_series(x, a0, an, bn, N):\n    result = a0 \/ 2\n    for n in range(1, N+1):\n        result += an[n-1] * np.cos(n * x) + bn[n-1] * np.sin(n * x)\n    return result\n\n# Prepare the data\nx = np.linspace(-np.pi, np.pi, 1000)\ny_original = f(x)\ny_approx = fourier_series(x, a0, an, bn, N)\n\n# Create a figure for 3D plotting\nfig = plt.figure(figsize=(14, 8))\nax = fig.add_subplot(111, projection=&#039;3d&#039;)\n\n# Plot the original function\nax.plot(x, y_original, zs=0, zdir=&#039;y&#039;, label=&#039;Original Function&#039;, color=&#039;b&#039;)\n\n# Plot the Fourier series approximation\nax.plot(x, y_approx, zs=1, zdir=&#039;y&#039;, label=&#039;Fourier Series Approximation&#039;, color=&#039;r&#039;)\n\n# Plot individual sine and cosine components\nfor n in range(1, N+1):\n    ax.plot(x, an[n-1] * np.cos(n * x), zs=2 + 2 * n - 1, zdir=&#039;y&#039;, label=f&#039;$a_{n} \\cos({n}x)$&#039;, linestyle=&#039;dashed&#039;)\n    ax.plot(x, bn[n-1] * np.sin(n * x), zs=2 + 2 * n, zdir=&#039;y&#039;, label=f&#039;$b_{n} \\sin({n}x)$&#039;, linestyle=&#039;dotted&#039;)\n\n# Set labels and title\nax.set_xlabel(&#039;x&#039;)\nax.set_ylabel(&#039;Function Components&#039;)\nax.set_zlabel(&#039;Value&#039;)\nax.set_title(&#039;3D Visualization of Fourier Series and Function Components&#039;)\n\n# Set yticks to show labels clearly\nyticks = [0, 1] + [2 + 2 * n - 1 for n in range(1, N+1)] + [2 + 2 * n for n in range(1, N+1)]\nytick_labels = [&#039;Original&#039;, &#039;Fourier Approximation&#039;] + [f&#039;$a_{n} \\cos({n}x)$&#039; for n in range(1, N+1)] + [f&#039;$b_{n} \\sin({n}x)$&#039; for n in range(1, N+1)]\nax.set_yticks(yticks)\nax.set_yticklabels(ytick_labels)\n\nax.legend()\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_27_0.png\" style=\"height:300px\">\n<\/p>\n<p>\u5bf9\u4e8e\u975e\u5468\u671f\u51fd\u6570\uff0c\u901a\u5e38\u7684\u505a\u6cd5\u662f\uff1a<\/p>\n<ul>\n<li>\u622a\u65ad\u51fd\u6570\uff1a\u5c06\u975e\u5468\u671f\u51fd\u6570\u5728\u67d0\u4e2a\u6709\u9650\u533a\u95f4\u5185\u8fdb\u884c\u622a\u65ad\uff0c\u4f7f\u5176\u5728\u8be5\u533a\u95f4\u5185\u8fd1\u4f3c\u5468\u671f\u3002\u5bf9\u4e8e\u622a\u65ad\u540e\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528\u5085\u91cc\u53f6\u7ea7\u6570\u5728\u8be5\u6709\u9650\u533a\u95f4\u5185\u8fdb\u884c\u8fd1\u4f3c\u3002<\/li>\n<li>\u5085\u91cc\u53f6\u53d8\u6362\uff1a\u901a\u8fc7\u5085\u91cc\u53f6\u53d8\u6362\u5206\u6790\u51fd\u6570\u7684\u9891\u8c31\uff0c\u627e\u5230\u5176\u5728\u9891\u57df\u4e2d\u7684\u8868\u793a\u3002\u5085\u91cc\u53f6\u53d8\u6362\u53ef\u4ee5\u5c06\u4efb\u4f55\u51fd\u6570\u8868\u793a\u4e3a\u6b63\u5f26\u548c\u4f59\u5f26\u51fd\u6570\u7684\u7ebf\u6027\u7ec4\u5408\u3002 <\/li>\n<\/ul>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\n# Define the function f(x)\ndef f(x):\n    return np.exp(-x**2)  # Example non-periodic function, Gaussian\n\n# Number of terms in the Fourier series\nN = 5\n\n# Calculate Fourier coefficients\na0 = (1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000))\nan = [(1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)) * np.cos(n * np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000)) for n in range(1, N+1)]\nbn = [(1 \/ np.pi) * np.trapz(f(np.linspace(-np.pi, np.pi, 1000)) * np.sin(n * np.linspace(-np.pi, np.pi, 1000)), np.linspace(-np.pi, np.pi, 1000)) for n in range(1, N+1)]\n\n# Create the Fourier series approximation\ndef fourier_series(x, a0, an, bn, N):\n    result = a0 \/ 2\n    for n in range(1, N+1):\n        result += an[n-1] * np.cos(n * x) + bn[n-1] * np.sin(n * x)\n    return result\n\n# Prepare the data\nx = np.linspace(-np.pi, np.pi, 1000)\ny_original = f(x)\ny_approx = fourier_series(x, a0, an, bn, N)\n\n# Create a figure for 3D plotting\nfig = plt.figure(figsize=(14, 8))\nax = fig.add_subplot(111, projection=&#039;3d&#039;)\n\n# Plot the original function\nax.plot(x, y_original, zs=0, zdir=&#039;y&#039;, label=&#039;Original Function&#039;, color=&#039;b&#039;)\n\n# Plot the Fourier series approximation\nax.plot(x, y_approx, zs=1, zdir=&#039;y&#039;, label=&#039;Fourier Series Approximation&#039;, color=&#039;r&#039;)\n\n# Plot individual sine and cosine components\nfor n in range(1, N+1):\n    ax.plot(x, an[n-1] * np.cos(n * x), zs=2 + 2 * n - 1, zdir=&#039;y&#039;, label=f&#039;$a_{n} \\cos({n}x)$&#039;, linestyle=&#039;dashed&#039;)\n    ax.plot(x, bn[n-1] * np.sin(n * x), zs=2 + 2 * n, zdir=&#039;y&#039;, label=f&#039;$b_{n} \\sin({n}x)$&#039;, linestyle=&#039;dotted&#039;)\n\n# Set labels and title\nax.set_xlabel(&#039;x&#039;)\nax.set_ylabel(&#039;Function Components&#039;)\nax.set_zlabel(&#039;Value&#039;)\nax.set_title(&#039;3D Visualization of Fourier Series and Function Components&#039;)\n\n# Set yticks to show labels clearly\nyticks = [0, 1] + [2 + 2 * n - 1 for n in range(1, N+1)] + [2 + 2 * n for n in range(1, N+1)]\nytick_labels = [&#039;Original&#039;, &#039;Fourier Approximation&#039;] + [f&#039;$a_{n} \\cos({n}x)$&#039; for n in range(1, N+1)] + [f&#039;$b_{n} \\sin({n}x)$&#039; for n in range(1, N+1)]\nax.set_yticks(yticks)\nax.set_yticklabels(ytick_labels)\n\nax.legend()\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_29_0.png\" style=\"height:300px\">\n<\/p>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/dusk\/64\/000000\/prize.png\" style=\"height:50px;display:inline\"> Credits<\/h2>\n<hr \/>\n<ul>\n<li>Icons made by <a href=\"https:\/\/www.flaticon.com\/authors\/becris\" title=\"Becris\">Becris<\/a> from <a href=\"https:\/\/www.flaticon.com\/\" title=\"Flaticon\">www.flaticon.com<\/a><\/li>\n<li>Icons from <a href=\"https:\/\/icons8.com\/\">Icons8.com<\/a> - <a href=\"https:\/\/icons8.com\">https:\/\/icons8.com<\/a><\/li>\n<li>Datasets from <a href=\"https:\/\/www.kaggle.com\/\">Kaggle<\/a> - <a href=\"https:\/\/www.kaggle.com\/\">https:\/\/www.kaggle.com\/<\/a><\/li>\n<li><a href=\"https:\/\/alexey.radul.name\/ideas\/2013\/introduction-to-automatic-differentiation\/\">Introduction to AutoDiff by Alexey Radul<\/a><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/borisettinger\/gentle-introduction-to-automatic-differentiation\">Gentle Introduction to AutoDiff by Boris Ettinger<\/a><\/li>\n<li>Statistical Machine Learning - Automatic Differentiation and Neural Networks - Jason Domke<\/li>\n<li><a href=\"https:\/\/pytorch.org\/tutorials\/beginner\/blitz\/autograd_tutorial.html\">AUTOGRAD: AUTOMATIC DIFFERENTIATION<\/a><br \/>\n<a href=\"https:\/\/taldatech.github.io\">Tal Daniel<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Deep Learning Math \u9ad8\u7b49\u6570\u5b66\uff08Advanced Mathematics\uff09 \u9ad8\u7b49\u6570\u5b66\u5728\u6df1\u5ea6\u5b66\u4e60 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1653,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[16,15],"class_list":["post-1265","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-14","tag-python","tag-15"],"_links":{"self":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1265"}],"version-history":[{"count":27,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1265\/revisions"}],"predecessor-version":[{"id":1654,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1265\/revisions\/1654"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/media\/1653"}],"wp:attachment":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1265"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}