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

x*(x+1)*(x+2)*(x+3)の最小値「2024 早稲田大学 人間科学部【1】(1)」をChatGPTとsympyでやってみたい。穴埋め (ア)のMathMLの対応。

Last updated at Posted at 2024-03-22

・穴埋め (ア)のMathMLの対応。
・ChatGPT-3.5先生へ。sympy回答のおすすめキーワード 本当ですか アキラメマシタ
 私の質問のしかたが悪いですか?

オリジナル

大学入試数学問題集成 様>【1】(1) テキスト

公式ホームページ
https://www.waseda.jp/fhum/hum/assets/uploads/2024/02/24_19_ans.pdf#page=5
https://www.waseda.jp/inst/admission/other/2024/02/21/15794/

wolframalphaで

・グラフがでます。

ChatGPT-3.5先生へ

・大学入試数学問題集成 様のMathML

<p class="s1level"><a name="q-0401" 
id="q-0401"></a><span 
class="qnum">【1】</span><a name="s-0401" di="s-0401"></a><span 
class="shomon1">(1)</span> <math>
<mi>x</mi><mspace width=".2em"></mspace>
</math>が実数であるとき,<math>
<mrow><mi>x</mi><mo>&it;</mo><mo stretchy="false">(</mo><mi>x</mi>
<mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo>&it;</mo>
<mo stretchy="false">(</mo><mi>x</mi><mo>+</mo><mn>2</mn><mo stretchy="false">)</mo>
<mo>&it;</mo><mo stretchy="false">(</mo><mi>x</mi><mo>+</mo><mn>3</mn>
<mo rspace=".2em" stretchy="false">)</mo></mrow>
</math>の最小値は<math>
<mspace width=".2em"></mspace><mrow class="b1box"><mspace width=".2em"></mspace>
<mtext class="futoji">ア</mtext><mspace width=".2em"></mspace></mrow>
<mspace width=".2em"></mspace>
</math>である.
</p>

回答
英語です

さいしゅうぎょうに、いかをついかします。
sympyで

回答しょうりゃく。こぴーこーどです。
??? 一回目は、間違っています。 以降も

from sympy import symbols, Interval, solve, diff

# 変数の定義
x = symbols('x', real=True)

# 式の定義
expr = (x*(x+1)*(x+2)*(x+3))

# 最小値を求めるための導関数の計算
expr_diff = diff(expr, x)

# 極値を求める
critical_points = solve(expr_diff, x)

# 定義域内の極値と端点での値を評価して最小値を求める
candidate_values = [expr.subs(x, cp) for cp in critical_points]
endpoints_values = [expr.subs(x, endpoint) for endpoint in [Interval(-3, float('inf')), Interval(-2, float('inf')), Interval(-1, float('inf')), Interval(float('-inf'), 0)]]
all_values = candidate_values + endpoints_values
min_value = min(all_values)

print("最小値:", min_value)

You
本当ですか
しょうりゃく
-1になりませんか

・SymPy Liveで(PCで。タブレットで実行できません。実行 行?が表示されません。)

アキラメマシタ

sympyで(いつもの方法で)

from sympy import *
var('x',real=True)
y=x*(x+1)*(x+2)*(x+3)
print("# ",minimum(y,x))
print("# ",minimum(y,x).simplify())
#  (-3/2 - sqrt(5)/2)*(1/2 - sqrt(5)/2)*(3/2 - sqrt(5)/2)*(-sqrt(5)/2 - 1/2)
#  -1
from sympy.plotting import plot
plot(y,(x,-4,1),aspect_ratio=(1.0,1.0))
# 
print("# ",solve(Eq(y,minimum(y,x).simplify()),x))
#  [-3/2 - sqrt(5)/2, -3/2 + sqrt(5)/2]

1.png

いつもの? sympyの実行環境と 参考のおすすめです。

(テンプレート)

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