pythonÅ£¶Ùµü´ú·¨¹«Ê½ÁËÊÇɶ
Å£¶Ùµü´ú·¨ÊÇÒ»ÖÖµü´úÇó¸ùÒªÁ죬Õë¶Ô·½³Ì f(x) = 0£¬Æäµü´ú¹«Ê½Îª£ºx_{n+1} = x_n – f'(x_n) / f”(x_n)¡£¸ÃÒªÁìµÄʹÓð취°üÀ¨£ºÑ¡Ôñ³õʼֵ¡¢ÅÌËã x_{n+1}¡¢¼ì²éÊÕÁ²ÐÔ¡¢¸üеü´úÖµ£¬Öظ´Ç°Êö°ì·¨Ö±µ½ÊÕÁ²»òµÖ´ï×î´óµü´ú´ÎÊý¡£
Å£¶Ùµü´ú·¨µÄ¹«Ê½
Å£¶Ùµü´ú·¨ÊÇÒ»ÖÖÓÃÓÚÇó½â·ÇÏßÐÔ·½³Ì×éµü´úÒªÁì¡£¹ØÓÚÒ»Ôª·½³Ì f(x) = 0£¬Å£¶Ùµü´ú·¨µÄ¹«Ê½Îª£º
x_{n+1} = x_n - f'(x_n) / f''(x_n)
µÇ¼ºó¸´ÖÆ
ÆäÖУº
- x? ÊdzõʼÍƲâÖµ
- x? ÊÇµÚ n ´Îµü´úÖµ
- f'(x) ÊÇ f(x) µÄÒ»½×µ¼Êý
- f”(x) ÊÇ f(x) µÄ¶þ½×µ¼Êý
ÔõÑùʹÓÃÅ£¶Ùµü´ú·¨£º
Á¬Ã¦Ñ§Ï°¡°PythonÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
- Ñ¡Ôñ³õʼֵ x?£ºÑ¡ÔñÒ»¸ö¿¿½ü·½³Ì¸ùµÄÖµ×÷Ϊ³õʼÍƲ⡣
- ÅÌËã x?+1£ºÊ¹Óøø¶¨µÄ¹«Ê½ÅÌËã x?+1¡£
- ¼ì²éÊÕÁ²ÐÔ£ºÈôÊÇ |x?+1 – x?| СÓÚÉ趨µÄÎó²îÈÝÏÞ£¬Ôòµü´ú×èÖ¹¡£
- ¸üеü´úÖµ£º½« x?+1 ×÷ΪÏÂÒ»´Îµü´úµÄ x?¡£
- Öظ´°ì·¨ 2-4£ºÖ±µ½ÊÕÁ²»òµÖ´ï×î´óµü´ú´ÎÊý¡£
ʾÀý£º
Çó½â·½³Ì f(x) = x? – 2x? + x – 1 = 0¡£
- ³õʼֵ£º x? = 1
- Ò»½×µ¼Êý£º f'(x) = 3x? – 4x + 1
- ¶þ½×µ¼Êý£º f”(x) = 6x – 4
µü´úÅÌË㣺
- x? = 1 – (1? – 21? + 1 – 1) / (31? – 4*1 + 1) = 0.5
- x? = 0.5 – (0.5? – 20.5? + 0.5 – 1) / (30.5? – 4*0.5 + 1) = 0.666667
- x? = 0.666667 – (0.666667? – 20.666667? + 0.666667 – 1) / (30.666667? – 4*0.666667 + 1) ¡Ö 0.625
Ч¹û£º
¾ÓÉ 3 ´Îµü´ú£¬Å£¶Ùµü´ú·¨»ñµÃµÄЧ¹ûԼΪ 0.625¡£
ÒÔÉϾÍÊÇpythonÅ£¶Ùµü´ú·¨¹«Ê½ÁËÊÇɶµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£