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?

できませんでした。θで最小値「2021 関西大全学日程共通テスト利用理系2月7日実施【4】(4)」をChatGPTとsympyとWolframAlphaでやってみたい。

Last updated at Posted at 2024-06-23

WolframAlpha 様ありがとうございます。 グラフが表示されます。
アドバイスいただけると幸いです。
仕切り直し??? でやっています。毎回、MathMLに1行を追加しています。

オリジナル

・ KATSUYA【東大数学9割】様 (0:00〜9:38)

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

ChatGPT-3.5先生へ。(1回目)できませんでした。

・回答は英語です。
 はじめから、「日本語で」を追加してもいいです。
・ページのソースを表示です。MathMLです。
 省略しようと思いましたが、大学入試数学問題集成 様 の全文から必要部分の抜粋です。

<div class="qbody">
<p class="slevel"><a name="q-1007" 
id="q-1007" /><span 
class="qnum">【4】</span> 次の<math>
<mspace width=".2em"></mspace><mrow class="b2box">
<mspace width="1em"></mspace><mtext> </mtext><mspace width="1em"></mspace>
</mrow><mspace width=".2em"></mspace>
</math>をうめよ.</p>
<p class="s1level"><a name="s-1007" id="s-1007" /><span 
class="shomon1">(4)</span> 関数</p>
<p class="equation"><math>
<mrow><mi>f</mi><mo>&af;</mo><mo stretchy="false">(</mo>
<mi>&theta;</mi><mo stretchy="false">)</mo><mo>=</mo><msup><mrow>
<mo>(</mo><mi>sin</mi><mo>&af;</mo><mi>&theta;</mi><mo>+</mo>
<mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><mn>2</mn>
<mo>&it;</mo><mi>sin</mi><mo>&af;</mo><mi>&theta;</mi></mrow>
</mfrac></mstyle><mo lspace=".2em">)</mo></mrow><mn>2</mn>
</msup><mo>+</mo><msup><mrow><mo>(</mo><mi>cos</mi>
<mo>&af;</mo><mi>&theta;</mi><mo>+</mo><mstyle displaystyle="true"><mfrac>
<mn>1</mn><mrow><mn>3</mn><mo>&it;</mo><mi>cos</mi><mo>&af;</mo>
<mi>&theta;</mi></mrow></mfrac></mstyle><mo lspace=".2em">)</mo></mrow>
<mn>2</mn></msup></mrow><mspace width=".5em"></mspace>
</math><math>
<mrow><mo rspace=".2em">(</mo><mn>0</mn><mo>&lt;</mo><mi>&theta;</mi>
<mo>&lt;</mo><mstyle displaystyle="true"><mfrac><mi>&pi;</mi>
<mn>2</mn></mfrac></mstyle><mo lspace=".2em">)</mo></mrow></math></p>
<p class="s1sublevel">の最小値は<math>
<mspace width=".2em"></mspace><mrow class="b2box"><mspace width="1em"></mspace>
<mtext>&#9316;</mtext><mspace width="1em"></mspace></mrow>
<mspace width=".2em"></mspace>
</math>である.
</p>
</div>
</div>

回答省略(英語です)

日本語で
解答をお願いします。

...
具体的な計算手順は数式の複雑さからここでは詳細に記載できませんが、微分の計算、方程式の解法、および関数の評価を順を追って行うと、最小値を見つけることができます。
???

ChatGPT-3.5先生へ。(2回目) 相加相乗平均でできますか。できませんでした。

相加相乗平均でできますか。

この問題は、関数 f(θ) の最小値を求める問題であり、相加相乗平均を用いて解くことはできません。
...
???

ChatGPT-3.5先生へ。(3回目)sympyで。できませんでした。

sympyで

・(抜粋)

from sympy import symbols, sin, cos, pi, diff, solve

# シンボルを定義する
theta = symbols('theta')

# 関数を定義する
f_theta = (sin(theta) + 1/(2*sin(theta)))**2 + (cos(theta) + 1/(3*cos(theta)))**2

# thetaの範囲を指定する
theta_range = (0, pi/2)

# f_thetaをthetaで微分する
df_dtheta = diff(f_theta, theta)

# 微分した結果を解く(極値を求める)
critical_points = solve(df_dtheta, theta)

# 求めた極値を関数に代入して最小値を求める
min_value = min(f_theta.subs(theta, point) for point in critical_points)

print(f"関数の最小値は: {min_value}")

TypeError: cannot determine truth value of Relational

グラフを作図して下さい。
import numpy as np
import matplotlib.pyplot as plt

# 関数 f(θ) を定義する
def f(theta):
    term1 = (np.sin(theta) + 0.5 * np.sin(2 * theta))**2
    term2 = (np.cos(theta) + (1/3) * np.cos(2 * theta))**2
    return term1 + term2

# θ の値の範囲を設定する
theta_values = np.linspace(0.001, np.pi/2, 500)  # 0 に近い値を避けるために 0.001 からスタート

# 関数 f(θ) の値を計算する
f_values = f(theta_values)

# グラフを描画する
plt.figure(figsize=(8, 6))
plt.plot(theta_values, f_values, label='f(θ)')
plt.xlabel('θ')
plt.ylabel('f(θ)')
plt.title('Function f(θ)')
plt.grid(True)
plt.legend()
plt.tight_layout()
plt.show()

TypeError: cannot determine truth value of Relational

増減表を表示して下さい。

・??? 私はここまでです。

ChatGPT-3.5先生へ。(4回目)WolframAlphaで。

・ホットしました。

WolframAlphaの式でお願いします。

WolframAlphaに貼り付けて、実行しました。グラフが表示されます。

最小値
θ = 2 tan^(-1)(sqrt(1/3 (7 - 2 sqrt(10)))) のとき, min{(sin(θ) + 1/(2 sin(θ)))^2 + (cos(θ) + 1/(3 cos(θ)))^2|0<θ<π/2} = 121/36

sympyで(オリジナル 様の方法で)

???勉強中です。わたしには、無理かも。

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

(テンプレート)

いつもと違うおすすめです。

・以下ができたら、助かります。

0
0
2

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?