LoginSignup
0
0

More than 1 year has passed since last update.

sympyでヘロンの公式の証明をさがしています

Last updated at Posted at 2017-04-19

sympyでヘロンの公式の証明をさがしています
よろしくお願いします。

参考 ヘロンの公式の証明と使用例

(参考)三角形の公式いろいろ:竹俣紅公式ブログ>平成26年度裁判所事務官試験NO.16
http://lineblog.me/takematabeni/_/embed_simple/32103442/49578806

#実行時間は、2分ぐらいかかります
from sympy import *
a=17
b=sqrt(173)
c=sqrt(40)
s=(a+b+c)/2
A=sqrt(s*(s-a)*(s-b)*(s-c))
print("#float(A)=",float(A))
#--------------------------------------------------------------------
var('x y xm1 ym1 r1 xm2 ym2 r2')
f = (x-xm1)**2 + (y-ym1)**2 - r1**2
g = (x-xm2)**2 + (y-ym2)**2 - r2**2
result=solve([f, g], [x, y])
# print("#result[0][0]",result[0][0])
# print("#result[0][1]",result[0][1])
# print("#result[1][0]",result[1][0])
# print("#result[1][1]",result[1][1])
var('AB BC CA')
AB=17
BC=sqrt(173)
CA=sqrt(40)
h=sympify(result[0]).subs({xm1:0,ym1:0,r1:CA,xm2:AB,ym2:0,r2:BC})[1]
A=1/2*AB*h
print("#float(A)=",float(A))
#float(A)= 37.0

入試問題

2013〜20年度 京都教育大学 2013〜2022年度の問題は未入手

参考

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