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.

3Dプロット、|x|+|y|の極値「2023兵庫医科大学医学部【1】(2)」をwolframalphaとsympyでやってみたい。

Last updated at Posted at 2023-03-17

3Dプロットがでます。
wolframでできました。
sympy でできませんでした。教えて下さい。

オリジナル

YMS問題解答講評

wolframで

3Dプロットがでます。入力解釈の関数が優先です。

最大値,最小値...
「標準の計算時間制限を超えました...」でました。mathematicaならでないと思います。

上と同じです。

円が見えません。

円です。2次元です。

sympyで(図形で、PASSLABO様の手順で)

勉強中

sympyで(8:02数式で解くこともできる。)

sympyのminimum関数で、うまくいきませんでした。
いい方法を教えて下さい。

import sympy
from sympy import *
from sympy.plotting import plot3d_parametric_line
u,r,z = symbols('u r z',real=True)
r=2
z=abs(1+r*cos(u))+abs(0+r*sin(u))
#print(minimum(z,u,Interval(2,3)))
print("#",z.subs({u:             -pi}))
print("#",z.subs({u:Rational(1,4)*pi}),float(z.subs({u:Rational(1,4)*pi})))
print("#",z.subs({u:Rational(7,4)*pi}),float(z.subs({u:Rational(7,4)*pi})))
#
plot(z,0,(u,0,2*pi))
plot3d_parametric_line((1+float(r)*cos(u),0+r*sin(u),abs(1+float(r)*cos(u))+abs(0+r*sin(u)),
                        (u, 0, 2*float(pi))),
                       (1+float(r)*cos(u),0+float(r)*sin(u),0,
                        (u, 0, 2*float(pi)))
                      )
# 1
# 1 + 2*sqrt(2) 3.8284271247461903
# 1 + 2*sqrt(2) 3.8284271247461903

角度をx軸でグラフ化。
45度,315度で最大値。
180度で最小値に   見えます。

0png.png

sympyの3D表示。2本書いてみました。
鉛直線を?カーテン?を出力する方法を教えて下さい。

1png.png

参考

class sympy.functions.elementary.miscellaneous.Max(*args)

sympy.plotting.plot.plot3d(*args, **kwargs)

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?