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 1 year has passed since last update.

空間図形「前橋工科大学2020年第2問」をsympyでやってみた。

Posted at

作図はありません

... ...
オリジナル

上と同じです。大学入試数学問題集成>

sympyで(positiveで)

from sympy import *
a=Symbol('a', positive=True)
b=Symbol('b', positive=True)
c=Symbol('c', positive=True)
O=Point(0,0,0)
A1,B1,C1=map(Point,([  sqrt(a),0,0],[0,  sqrt(b),0],[0,0,  sqrt(c)]))
A2,B2,C2=map(Point,([1/sqrt(a),0,0],[0,1/sqrt(b),0],[0,0,1/sqrt(c)]))
H1=Plane(A1,B1,C1).projection(O)
H2=Plane(A2,B2,C2).projection(O)
print("#(1)",H1)
print("#(2)",H2)
print("#(3)",(H1-O).dot((H2-O))/(O.distance(H1)*O.distance(H2))           )
print("#(3)",(H1-O).dot((H2-O))/(O.distance(H1)*O.distance(H2)).simplify())
#(1) Point3D(sqrt(a)*b*c/(a*b + a*c + b*c), a*sqrt(b)*c/(a*b + a*c + b*c), a*b*sqrt(c)/(a*b + a*c + b*c))
#(2) Point3D(sqrt(a)/(a + b + c), sqrt(b)/(a + b + c), sqrt(c)/(a + b + c))
#(3) 3*a*b*c/((a + b + c)*(a*b + a*c + b*c)*sqrt(a/(a + b + c)**2 + b/(a + b + c)**2 + c/(a + b + c)**2)*sqrt(a**2*b**2*c/(a*b + a*c + b*c)**2 + a**2*b*c**2/(a*b + a*c + b*c)**2 + a*b**2*c**2/(a*b + a*c + b*c)**2))
#(3) 3*sqrt(a)*sqrt(b)*sqrt(c)/(sqrt(a + b + c)*sqrt(a*b + a*c + b*c))

sympyで(varで)

from sympy import *
var('a b c')
O=Point(0,0,0)
A1,B1,C1=map(Point,([  sqrt(a),0,0],[0,  sqrt(b),0],[0,0,  sqrt(c)]))
A2,B2,C2=map(Point,([1/sqrt(a),0,0],[0,1/sqrt(b),0],[0,0,1/sqrt(c)]))
H1=Plane(A1,B1,C1).projection(O)
H2=Plane(A2,B2,C2).projection(O)
print("#(1)",H1)
print("#(2)",H2)
print("#(3)",(H1-O).dot((H2-O))/(O.distance(H1)*O.distance(H2))           )
print("#(3)",(H1-O).dot((H2-O))/(O.distance(H1)*O.distance(H2)).simplify())
#(1) Point3D(sqrt(a)*b*c/(a*b + a*c + b*c), a*sqrt(b)*c/(a*b + a*c + b*c), a*b*sqrt(c)/(a*b + a*c + b*c))
#(2) Point3D(sqrt(a)/(a + b + c), sqrt(b)/(a + b + c), sqrt(c)/(a + b + c))
#(3) 3*a*b*c/((a + b + c)*(a*b + a*c + b*c)*sqrt(a/(a + b + c)**2 + b/(a + b + c)**2 + c/(a + b + c)**2)*sqrt(a**2*b**2*c/(a*b + a*c + b*c)**2 + a**2*b*c**2/(a*b + a*c + b*c)**2 + a*b**2*c**2/(a*b + a*c + b*c)**2))
#(3) 3*a*b*c/(sqrt(a*b*c/(a*b + a*c + b*c))*(a + b + c)*(a*b + a*c + b*c)*sqrt(1/(a + b + c)))
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?