学習環境
- 数式入力ソフト(TeX, MathML): MathType
- MathML対応ブラウザ: Firefox、Safari
- MathML非対応ブラウザ(Internet Explorer, Google Chrome...)用JavaScript Library: MathJax
オイラーの贈物―人類の至宝eiπ=-1を学ぶ (吉田 武(著)、東海大学出版会)の第Ⅰ部(基礎理論(Basic Theory))、3章(微分(Differentiation))、3.8(関数のグラフを描く)、問題5.を解いてみる。
問題5.
f(x)=x3+x2−4x+1f(1)(x)=3x2+2x−4=13(x+3)2−7f(1)(x)=0x=−1±√133f(2)(x)=6x+2=6(x+13)f(2)(x)=0x=−13−1−√133<−13<−1+√133f(−13)=−127+19+43+1=−1+3+36+2727=6527f(−1+√133)=−1+3√13−39+13√1327+14−2√139+4−4√133+1=−40+16√13+42−6√13+36−36√13+2727=65−26√1327<0f(−1−√133)=65+26√1327xn+1=xn−f(xn)f(1)(xn)=xn−x3n+xn2−4xn+13x2n+2xn−4=2x3n+x2n−13x2n+2xn−4−53<−1−√133x0=−53x1=−25027+259−1253−103−4=−250+75−2727=−20227(=−7.481···)以下、pythonを使って計算。x2=-154027912931876(=-5.253561542166176)x3=-3319063268830266108581860558640294071840166(=-3.856870541321936)x4=-3.0647804042831877x5=-2.7248676719102827x6=-2.654106846739904x7=-2.6510987533831787x8=-2.651093408954031x9=-2.651093408937175
コード(Emacs)
#!/usr/bin/env python3
# -*- coding: utf-8 -*_
import fractions
def newton(x, r=10):
inner = lambda x:fractions.Fraction(2 * x ** 3 + x ** 2 - 1,
3 * x ** 2 + 2 * x - 4)
for i in range(r):
print('x_{0} = {1}'.format(i, float(x)))
x = inner(x)
print()
x = fractions.Fraction(-5, 3)
newton(x)
x = 0
newton(x)
x = fractions.Fraction(5, 3)
newton(x)
入出力結果(Terminal, IPython)
$ ./sample5.py x_0 = -1.6666666666666667 x_1 = -7.481481481481482 x_2 = -5.253561542166176 x_3 = -3.856870541321936 x_4 = -3.0647804042831877 x_5 = -2.7248676719102827 x_6 = -2.654106846739904 x_7 = -2.6510987533831787 x_8 = -2.651093408954031 x_9 = -2.651093408937175 x_0 = 0.0 x_1 = 0.25 x_2 = 0.27358490566037735 x_3 = 0.2738905022655762 x_4 = 0.27389055496421605 x_5 = 0.2738905549642176 x_6 = 0.2738905549642176 x_7 = 0.2738905549642176 x_8 = 0.2738905549642176 x_9 = 0.2738905549642176 x_0 = 1.6666666666666667 x_1 = 1.4396135265700483 x_2 = 1.3812200268652726 x_3 = 1.3772213440738694 x_4 = 1.3772028543676846 x_5 = 1.3772028539729577 x_6 = 1.3772028539729577 x_7 = 1.3772028539729577 x_8 = 1.3772028539729577 x_9 = 1.3772028539729577 $
0 コメント:
コメントを投稿