LoginSignup
0
0

最大・最小(置き換え)「2023群馬大学【4】」をWolframAlphaとsympyでやってみた。

Last updated at Posted at 2023-06-13

xyグラフがでます。

オリジナル

上と同じです。大学入試数学問題集成>【4】 テキスト

WolframAlphaで

0<=t<=2pi のグラフが出ます

sympyで(数学入試問題 様のやり方で)

勉強中

sympyでminimum,maximum関数を使って)

from sympy import *
from sympy import symbols, cos, sin
from sympy.plotting import plot3d_parametric_line
x,y=symbols('x,y',real=True,positive=True)
t,f=symbols('t f',real=True,positive=True)
(st,en)=(0,pi)
myX=Eq(x,cos(t)       +sin(t)     )
myY=Eq(y,cos(2*t-pi/2)-cos(t-pi/4))
print("#(1)",minimum(myX.rhs,t,Interval(st,en)),maximum(myX.rhs,t,Interval(st,en)))
print("#(2)",myY.rhs.subs({t:solve(myX,t)[1]}).simplify())
print("#(3)",sqrtdenest( minimum(myY.rhs,t,Interval(st,en)).simplify()).simplify(),
                         maximum(myY.rhs,t,Interval(st,en)).simplify()            )
plot           ( myX.rhs         ,(t,st,en))
plot           ( myY.rhs         ,(t,st,en))
plot_parametric((myX.rhs,myY.rhs),(t,st,en))
#(1) -1 sqrt(2)
#(2) x**2 - sqrt(2)*x/2 - 1
#(3) -9/8 sqrt(2)/2

plotコマンドは、縦横比が異なります。
点プロットの勉強中。

θ-xのグラフ -1≦x≦sqrt(2)
0png.png

θ-yのグラフ -9/8≦y≦sqrt(2)/2
1Figure_1.png

x-yのグラフ

plotコマンドは、縦横比が異なります。
x-yのグラフ -1≦x≦sqrt(2),-9/8≦y≦sqrt(2)/2
2Figure_1.png

参考

def sqrtdenest(expr, max_iter=3):

以下、いつもの?おすすめです。

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