2019年5月28日火曜日

学習環境

新装版 数学読本2 (松坂 和夫(著)、岩波書店)の第5章(関連しながら変化する世界 - 簡単な関数)、5.3(分数関数・無理関数)、逆関数の問40の解答を求めてみる。



    1. 逆関数をもつ。

      2 y = x + 6 x = 2 y - 6 y = 2 x - 6

    2. 逆関数をもたない。


    3. 逆関数をもたない。


    4. x = - y y = - x

コード

Python 3

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

print('40.')

x, y = symbols('x, y', real=True)
fs = [x / 2 + 3, abs(x), -x ** 2, x ** 2]
intervals = [(x, -10, 10)] * 3 + [(x, -10, 0)]
for i, f in enumerate(fs, 1):
    print(f'({i})')
    pprint(solve(y - f, x))
    print()

gs = [(2 * x - 6, (x, -10, 10)), (-sqrt(x), (x, 0, 10))]


p = plot((x, (x, -10, 10)), *zip(fs, intervals), *gs, ylim=(-10, 10),
         legend=True, show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'gray', 'skyblue', 'yellow']

for o, color in zip(p, colors):
    o.line_color = color

p.show()
p.save('sample40.png')

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

C:\Users\...>py sample40.py
40.
(1)
[2⋅y - 6]

(2)
⎡⎧-y   for y > 0  ⎧ y   for y ≥ 0⎤
⎢⎨              , ⎨              ⎥
⎣⎩nan  otherwise  ⎩nan  otherwise⎦

(3)
⎡   ____    ____⎤
⎣-╲╱ -y , ╲╱ -y ⎦

(4)
[-√y, √y]


C:\Users\...>

0 コメント:

コメントを投稿