73611


(参考)wolframalphaなら、できました。  
入力:  
cos(x)=3/5,sin(x)  
[https://www.wolframalpha.com/input/?i=cos%28x%29%3D3%2F5%2Csin%28x%29&lang=ja](https://www.wolframalpha.com/input/?i=cos%28x%29%3D3%2F5%2Csin%28x%29&lang=ja)  
代入:  
sin(x) = -4/5, sin(x) = 4/5

[code]

    # 共通テスト2021 数学ⅠA問題　第1問〔2〕
    # https://www.toshin.com/kyotsutest/data/285/sugaku-1a.pdf#page=7
    from sympy import *
    x = Symbol('x')
    ans=solve([cos(x)-3/5],x)
    print(sin(ans[0][0]))
    
    ans=solve([(3/5)**2+x**2-1],x)
    print(ans[1][0])
    
    print(sqrt(1-(3/5)**2))
    # 出力
    # 0.800000000000000
    # 0.800000000000000
    # 0.800000000000000
    
[/code]


CC BY-SA 4.0
2021-01-27T10:44:28.993
73610
2021-01-28T13:21:18.623
2021-01-27T12:50:42.350
3060
17199
question
python sympy
sympyで三角関数の値を分数表示したい


Rationalを使いましょう。

[code]

    from sympy import *
    
    x = Symbol('x')
    a = Rational(3,5)
    ans=solve([cos(x)-a],x)
    print(sin(ans[0][0]))
    
    ans=solve([(a)**2+x**2-1],x)
    print(ans[1][0])
    #-4/5
    #4/5
    
[/code]


CC BY-SA 4.0
2021-01-27T11:06:25.177
73611
2021-01-27T11:06:25.177
39819
73610
answer

[code]

    # 共通テスト2021 数学ⅠA問題　第1問〔2〕
    # https://www.toshin.com/kyotsutest/data/285/sugaku-1a.pdf#page=7
    from sympy import *
    x = Symbol('x')
    a = Rational(3,5)
    ans=solve([cos(x)-a],x)
    print(sin(ans[1][0]))
    
    ans=solve([a**2+x**2-1],x)
    print(ans[1][0])
    
    print(sqrt(1-a**2))
    # 出力
    # 4/5
    # 4/5
    # 4/5
    
[/code]


CC BY-SA 4.0
2021-01-28T13:21:18.623
73658
2021-01-28T13:21:18.623
17199
73610
answer