1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

sympy,wolframalphaで定積分 「京大数学2019年度第1問2」をやってみたい

Last updated at Posted at 2019-02-27

読売新聞
https://www.yomiuri.co.jp/nyushi/sokuho/k_mondaitokaitou/kyoto/mondai/img/kyoto_zenki_sugaku_ri_mon.pdf
https://www.yomiuri.co.jp/nyushi/sokuho/k_mondaitokaitou/kyoto/kaitou/img/kyoto_zenki_sugaku_ri_kai.pdf
毎年同じurlみたい。

京大数学 過去問ライブラリ>2019年度解答例+引用題理系>第1問2
https://www.densu.jp/kyoto/19kyotospass.pdf

wolframalphaでやってみた

(1)
https://www.wolframalpha.com/input/?i=Integrate%5Bx%2Fcos(x)**2,%7Bx,0,pi%2F4%7D%5D
Integrate[x/cos(x)**2,{x,0,pi/4}]
(Pi - Log[4])/4
(2)
https://www.wolframalpha.com/input/?i=Integrate%5B1%2Fcos(x),%7Bx,0,pi%2F4%7D%5D
Integrate[1/cos(x),{x,0,pi/4}]
integral_0^(π/4) 1/cos(x) dx = 2 tanh^(-1)(tan(π/8))?0.8814

SymPy Liveでやってみた

print(integrate(x/cos(x)**2,(x, 0, pi/4)))
結果:よくわからないので.....(省略)
print(integrate(1/cos(x)**2,(x, 0, pi/4)))
結果:1

pythonでやってみた

fullscript.py
from sympy import *
x = Symbol('x')

f=x/cos(x)**2
print(f)
print(integrate(f,(x, 0, pi/4)))

f=1/cos(x)
print(f)
print(integrate(f,(x, 0, pi/4)))

# x/cos(x)**2
# log(2*(-sqrt(2)/2 + 1)**2 + 1)/(-1 + 2*(-sqrt(2)/2 + 1)**2) + 2*(-sqrt(2)/2 + 1)**2*log(sqrt(2)*(-sqrt(2)/2 + 1) + 1)/(-1 + 2*(-sqrt(2)/2 + 1)**2) - 2*(-sqrt(2)/2 + 1)**2*log(2*(-sqrt(2)/2 + 1)**2 + 1)/(-1 + 2*(-sqrt(2)/2 + 1)**2) - log(sqrt(2)*(-sqrt(2)/2 + 1) + 1)/(-1 + 2*(-sqrt(2)/2 + 1)**2) - sqrt(2)*pi*(-sqrt(2)/2 + 1)/(2*(-1 + 2*(-sqrt(2)/2 + 1)**2)) - I*pi + 2*(-sqrt(2)/2 + 1)**2*(log(-sqrt(2)*(-sqrt(2)/2 + 1) + 1) + I*pi)/(-1 + 2*(-sqrt(2)/2 + 1)**2) - (log(-sqrt(2)*(-sqrt(2)/2 + 1) + 1) + I*pi)/(-1 + 2*(-sqrt(2)/2 + 1)**2)
# 1/cos(x)
# log(sqrt(2)/2 + 1)/2 - log(-sqrt(2)/2 + 1)/2
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?