2015年11月12日木曜日

学習環境

  • 数式入力ソフト(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 )= x 3 + x 2 4x+1 f ( 1 ) ( x )=3 x 2 +2x4 = 1 3 ( x+3 ) 2 7 f ( 1 ) ( x )=0 x= 1± 13 3 f ( 2 ) ( x )=6x+2=6( x+ 1 3 ) f ( 2 ) ( x )=0 x= 1 3 1 13 3 < 1 3 < 1+ 13 3 f( 1 3 )= 1 27 + 1 9 + 4 3 +1= 1+3+36+27 27 = 65 27 f( 1+ 13 3 )= 1+3 13 39+13 13 27 + 142 13 9 + 44 13 3 +1 = 40+16 13 +426 13 +3636 13 +27 27 = 6526 13 27 <0 f( 1 13 3 )= 65+26 13 27 x n+1 = x n f( x n ) f ( 1 ) ( x n ) = x n x n 3 + x n 2 4 x n +1 3 x n 2 +2 x n 4 = 2 x n 3 + x n 2 1 3 x n 2 +2 x n 4 5 3 < 1 13 3 x 0 = 5 3 x 1 = 250 27 + 25 9 1 25 3 10 3 4 = 250+7527 27 = 202 27 (=7.481···) python使 x 2 = -15402791 2931876 ( =-5.253561542166176 ) x 3 = -3319063268830266108581 860558640294071840166 ( =-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

コード(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 コメント:

コメントを投稿

Comments on Google+: