Å£¶Ùµü´ú¹«Ê½³ÌÐò vb³ÌÐòÉè¼Æ±à³ÌÅ£¶Ùµü´ú¹«Ê½
vb³ÌÐòÖеÄÅ£¶Ùµü´ú·¨¿ÉÒÔ½â¾ö·ÇÏßÐÔ·½³Ì×é»òÓÅ»¯ÎÊÌ⣬°üÀ¨ÒÔÏ°취£º½ç˵º¯Êý¼°Æäµ¼ÊýÉèÖóõʼÍƲâֵͨ¹ýµü´ú¹«Ê½Ò»Ö±ÆȽü׼ȷ½â¼ì²éÊÕÁ²ÐÔ£¨µü´úÖµÊÇ·ñµÖ´ïÎó²îÏÞ£©·µ»Øµü´ú»ñµÃµÄ½üËƽâ
Å£¶Ùµü´ú·¨µÄVB³ÌÐòÉè¼Æ
¼ò½é
Å£¶Ùµü´ú·¨ÊÇÒ»ÖÖÇó½â·ÇÏßÐÔ·½³Ì×é»òÓÅ»¯ÎÊÌâµÄÊýÖµÒªÁì¡£Ëü»ùÓÚÕâÑùµÄÍ·ÄÔ£º´ÓÒ»¸ö³õʼԤ¼ÆÖµ³ö·¢£¬Í¨¹ýµü´úÒ»Ö±ÆȽü׼ȷ½â¡£
VB³ÌÐò
VB³ÌÐò¿ÉÒÔʹÓÃÒÔÏ°취ʵÏÖÅ£¶Ùµü´ú·¨£º
- ½ç˵º¯ÊýºÍµ¼Êý£º½ç˵ҪÇó½âµÄº¯Êý f(x) ºÍËüµÄµ¼Êý f'(x)¡£
- ÉèÖóõʼÍƲâÖµ£ºÑ¡ÔñÒ»¸ö³õʼֵ x0 ×÷Ϊ½âµÄÔ¤¼ÆÖµ¡£
-
µü´úÀú³Ì£ºÆ¾Ö¤ÒÔϹ«Ê½¾ÙÐеü´ú£º
x(i+1) = x(i) - f(x(i)) / f'(x(i))
µÇ¼ºó¸´ÖÆ
- ¼ì²éÊÕÁ²£º¼ì²éµü´úÖµÊÇ·ñÊÕÁ²ÓÚ׼ȷ½â¡£ÈôÊÇ |x(i+1) – x(i)|
- ·µ»ØЧ¹û£º·µ»Øµü´ú»ñµÃµÄ½üËƽ⡣
ʾÀý´úÂë
Çó½â·½³Ì f(x) = x^3 – 2x + 2 = 0 µÄVB³ÌÐòʾÀý£º
' ½ç˵º¯ÊýºÍµ¼Êý Function f(x As Double) As Double Return x ^ 3 - 2 * x + 2 End Function Function fPrime(x As Double) As Double Return 3 * x ^ 2 - 2 End Function ' ÉèÖóõʼÍƲâÖµ Dim x0 As Double = 1 ' µü´úÀú³Ì Dim x = x0 Do x = x - f(x) / fPrime(x) ' ¼ì²éÊÕÁ² If Abs(x - x0) <p><strong>¿¢ÊÂÓï</strong></p><p>Å£¶Ùµü´ú·¨ÊÇÒ»ÖÖ¹¦Ð§Ç¿Ê¢µÄÊýÖµÒªÁ죬¿ÉÓÃÓÚ½â¾öÆÕ±éµÄ·½³ÌºÍÓÅ»¯ÎÊÌâ¡£VB³ÌÐòÖпÉÒÔÇáËÉʵÏÖ¸ÃÒªÁ죬ΪÊýѧºÍ¿ÆѧÅÌËãÌṩÁËÒ»ÖÖÓÐÓõŤ¾ß¡£</p>
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇÅ£¶Ùµü´ú¹«Ê½³ÌÐò vb³ÌÐòÉè¼Æ±à³ÌÅ£¶Ùµü´ú¹«Ê½µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£