Loading [MathJax]/jax/output/CommonHTML/jax.js

2019年2月16日土曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第3部(積分)、第13章(積分の応用)、補充問題、面積の練習問題15の解答を求めてみる。


  1. 2つの曲線の交点を求める。

    x2-(x+1)=0x2-x-1=0x=1±1+42=1±52

    不定積分。

    ((x+1)-x2)dx=-13x3+12x2+x

    よって求める2曲線の2つの交点の間の面積は、

    (-13(1+52)3+12(1+52)2+1+52)-(-13(1-52)3+12(1-52)2+1-52)=-13((1+52)3-(1-52)3)+12((1+52)2-(1-52)2)+5=-13·18((1+5)-(1-5))((1+5)2+(1+5)(1-5)+(1-5)2)+12·14((1+5)-(1-5))((1+5)+(1-5))+5=-13·18·25(1+25+5+1-5+1-25+5)+1214·25·2+5=-13·14·5·8+52+5=-253+52+5=(-4+3+6)56=556

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, plot, solve

x = symbols('x')
f = x + 1
g = x ** 2
xs = solve(f - g)
pprint(xs)
x2, x1 = xs
I = Integral(f - g, (x, x1, x2))

for o in [I, I.doit()]:
    pprint(o.simplify())
    print()

a, b, c, d = x1 - 1, x1, x2, x2 + 1
p = plot((f, (x, a, b)),
         (f, (x, b, c)),
         (f, (x, c, d)),
         (g, (x, a, b)),
         (g, (x, b, c)),
         (g, (x, c, d)),
         legend=True,
         show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange', 'pink']

for i, s in enumerate(p):
    s.line_color = colors[i]
p.save('sample15.png')

入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))

C:\Users\...> py -3 sample15.py
⎡1   √5    √5   1⎤
⎢─ + ──, - ── + ─⎥
⎣2   2     2    2⎦
 1   √5                   
 ─ + ──                   
 2   2                    
   ⌠                      
   ⎮     ⎛   2        ⎞   
   ⎮     ⎝- x  + x + 1⎠ dx
   ⌡                      
  √5   1                  
- ── + ─                  
  2    2                  

5⋅√5
────
 6  


C:\Users\...>

0 コメント:

コメントを投稿