Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

3
1

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.

[Python] 45秒で東大数学(2019年 前期第1問)を解いてみた

Last updated at Posted at 2019-03-23

Pythonを使って45秒で東大の入試問題を1問解けるのか検証してみました。

Sympyの integrate(f, (x, a, b))を用いれば
関数fをxについてaからbまで積分計算することができます。

では早速問題を見てみましょう。

問題:

2019年 東京大学 前期日程 数学(理科) 第1問
読売新聞オンラインより問題および解答部を引用
Screen Shot 2019-03-23 at 9.44.27 PM.png

手計算での解法

まずは上記の式を展開して、
Screen Shot 2019-03-23 at 9.49.42 PM.png
展開した第1項目から4項目までの定積分をそれぞれ計算して最後に
足し合わせます。
Screen Shot 2019-03-23 at 9.47.57 PM.png

Sympyで解いてみる

まずはSympyをImportして変数xを定義

import.py
import sympy as sym
x = sym.Symbol('x')

間違えないようにひたすら式を打ち込む
念の為、表示して確認。

import.py
f = (x**2+x/sym.sqrt(1+x**2))*(1+x/((1+x**2)*sym.sqrt(1+x**2)))
print(f)

出力:(x2 + x/sqrt(x2 + 1))*(x/(x2 + 1)(3/2) + 1)

打ち間違えがなさそうなら
いよいよ0から1まで積分

integrate.py
F = sym.integrate(f, (x, 0, 1))
print(F)

出力:-35/12 + pi/8 + 5*sqrt(2)/2
解けました。
解答例と比べても合っているようです。

結論

高速でタイプしてギリいける感じです。
ちなみに1回目は式に目が慣れていなかったので失敗。2分以上かかりました。
よって45秒以内に解を出すにはいかに早く打てるかが鍵となります。
特に途中でタイプミスがあると致命的。
リズムに乗るために本家の45秒を聴きながらやってみるのも良いでしょう。

3
1
2

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

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?