0
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.

東京大学2019年数学入試第1問をpython sympyに解かせてみた

Last updated at Posted at 2019-12-03

東京大学2019年数学入試第1問をpython sympyに解かせてみた。
何秒で解けるかを測定するために、時間も測ってみました。

問題は、こちらを参照ください。
https://sokuho.yozemi.ac.jp/sokuho/k_mondaitokaitou/1/kaitou/kaitou/1306831_5342.html

私のPCでは、23秒で計算できました。

import sympy as sym
import datetime
(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = sym.symbols('a b c d e f g h i j k l m n o p q r s t u v w x y z')

f = (x**2 + x/sqrt(1+x**2))*(1+ x/((1+x**2)*sqrt(1+x**2)))

# start time
start_t = datetime.datetime.now()

# calc
answer=sym.integrate(f,(x,0,1))

# end time
end_t = datetime.datetime.now()

# elapse time
elapse_t = end_t - start_t

print(answer)
print(elapse_t,"秒かかりました")

SnapCrab_NoName_2019-12-3_21-15-30_No-00.png

0
0
1

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
0
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?