åé¡2.34 Hornerã®æ¹æ³ã«ã¤ãã¦ã®è£è¶³
SICPèªæ¸ä¼ã§Hornerã®æ¹æ³ãå®è£
ããåé¡ããã£ããã¨ããããä½ã®å½¹ã«ç«ã¤ã®ãï¼ã¨ãã話ãããã®ã ãã©ããã¾ãã¡ãªèª¬æã ã£ãããã«æãã®ã§æç« ã§è£è¶³ãã¦ã¿ãã
åæç¥èã¯ã以ä¸3ã¤ãããã®ã¤ããã
- ä½ãã®ããã°ã©ãã³ã°è¨èªãæ¸ãããã¨
- ä½åãè¨æ°æ³(âné²æ°)ãåããç¨åº¦ã®ç®æ°ã®ç¥è
- Îè¨æ³
Hornerã®æ¹æ³ã¨ã¯ä½ã
Hornerã®æ¹æ³ã¨ã¯ãä¸å
n次å¤é
å¼ãè¨ç®ããã¨ãã®ç°¡åãª(è¨ç®éã®å°ãªã)ç®æ³ã§ããã
ã¨ããå¤é
å¼ã®å¤ã¯æ¬¡ã®ããã«è¨ç®ãã¦ãããã¯ãã ã
ãããHornerã®æ¹æ³ã§ããã
ãã¦ãè¨ç®éãå°ãªãã¨è¨ã£ãããã©ã®ç¨åº¦å°ãªãã®ã§ããããã
ã¾ã馬鹿æ£ç´ã«ãè¨ç®ãã¦ã¿ããã
ãè¨ç®ããã®ã«ãnåã®è¶³ãç®ãå¿
è¦ã§ããã
次ã«é¦¬é¹¿æ£ç´ã«k次ã®é
ï¼ãè¨ç®ããã«ã¯(k+1)åã®æãç®ãå¿
è¦ã ã
å¾ã£ã¦ãn次å¤é
å¼ãè¨ç®ããã«ã¯ã
åã®æãç®ãå¿
è¦ã«ãªãã
ã§ããããΣã®è¨ç®ã¯åæç¥èã¨ãã¦ããªãã®ã§ãΣã®å
¬å¼ã«é ¼ããè¨ç®ããããéé ã«æ¸ãã¦ãç·åã¯å¤ãããªãã®ã§ã
åé
ã縦ã«è¶³ãã¨ã
ã§ããã
以ä¸ã«ããã®è¨ç®éãªã¼ãã¼ã¯ã¨ãªã*1ã
ä¸æ¹ãHornerã®æ¹æ³ã使ãå ´åãèªæã«nåã®æãç®ã¨nåã®è¶³ãç®ãå¿ è¦ãªã®ã§ãè¨ç®éãªã¼ãã¼ã¯ã¨ãªãããã¡ããããã¯ãããããªãæ©ãã
ä»æ¹ã馬鹿æ£ç´ã«k次ã®é
ã§k+1åã®æãç®ãè¡ãããé次平æ¹ãã¦ãããã¨ã«ããk次ã®é
ã®è¨ç®ãªã¼ãã¼ãã§è©ä¾¡ãããã¨ãã§ããã
ãã®å ´åãæãç®ã®ãªã¼ãã¼ã¯ã
ããã®è©ä¾¡ã¯ã¡ãã£ã¨æ©ããããªã®ã§ã
ã¨å¤§éæã«ä¸éã¨ä¸éãè¦ç©ãã£ã¦ãããã¨ã¯ã§ãããå¾ã£ã¦é次平æ¹ããå ´åã®è¨ç®ãªã¼ãã¼ã¯ã§ããããããã¯ãã大ãããããã¯å°ããã
ä½ã®å½¹ã«ç«ã¤ãï¼
ãã¨ãã°ãããã·ã¥ãã¼ãã«ãå®è£
ããã«ã¯æååããããã·ã¥å¤ãæ±ããå¿
è¦ããããããã·ã¥å¤ãæ±ããããã·ã¥é¢æ°ã¨ãã¦ä½¿ããã¨ãã§ããã
ããã«ã¤ãã¦ã¯ä»¥åãCã§ããã·ã¥ãã¼ãã«ãä½ã£ã¦ã¿ãã§æ¸ããã®ã§ãã¡ããåç
§ã®ãã¨ã(ããã¯ã¤ã¾ããé·ãnã®æååãxé²æ°ã®å¤åé·æ´æ°ã¨ã¿ãªãã¦ããã®å¤ãæ±ããã®ã«ãn次å¤é
å¼ã®å¤ãæ±ããHornerã®æ¹æ³ã使ããã¨ãããã¨ã§ãã)
ãªããæååã®æ
å ±ãåãæ¨ã¦ãªãããã·ã¥é¢æ°ã¯ãæååã®é·ããnã¨ããã°å°ãªãã¨ãã®ãªã¼ãã¼ã«ãªãã¨èããããã®ã§ãHornerã®æ¹æ³ã«ããããã·ã¥é¢æ°ã¯è¨ç®ãªã¼ãã¼ã¨ãã¦ã¯æ¯è¼çç´ æ§ããããã®ã¨è¨ããæ°ãããã
*1:åºå®é·ã®æ´æ°ãæµ®åå°æ°ç¹æ°æ¼ç®ã®ããã«å ç®ä¹ç®ã®ã³ã¹ããä¸å®ãªå ´åã以ä¸åã