0
0

できませんでした。4次関数と接線 積分「2016 名古屋市立大前期【1】」をChatGPTとsympyでやってみたい。

Last updated at Posted at 2024-06-24

仕切り直し??? でやっています。毎回、MathMLに1行を追加しています。

オリジナル

・鈴木貫太郎 様 (0:00〜10:45)

・大学入試数学問題集成 様> 前期【1】 テキスト
 >数学入試問題さんの解答(PDF)へ

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

・回答は英語です。
 はじめから、「日本語で」を追加してもいいです。
???いつもと違いました。 

・ページのソースを表示です。MathMLです。
 省略しようと思いましたが、大学入試数学問題集成 様 の全文から必要部分の抜粋です。

<div class="qbody">
<p class="slevel"><a name="q-0101" 
id="q-0101"></a><span 
class="qnum">【1】</span> 関数<math 
xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width=".2em"></mspace><mrow><mi>f</mi>
<mo>&af;</mo><mo stretchy="false">(</mo><mi>x</mi>
<mo stretchy="false">)</mo><mo>=</mo><msup><mi>x</mi>
<mn>4</mn></msup><mo>-</mo><mn>2</mn><mo>&it;</mo>
<msup><mi>x</mi><mn>2</mn></msup><mo>+</mo>
<mi>x</mi></mrow><mspace width=".2em"></mspace>
</math>について,次の問いに答えよ.</p>
<p class="s1level">(1) 曲線<math 
xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width=".2em"></mspace><mrow><mi>y</mi>
<mo>=</mo><mi>f</mi><mo>&af;</mo><mo stretchy="false">(</mo>
<mi>x</mi><mo rspace=".2em" stretchy="false">)</mo></mrow>
</math>と<math 
xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width=".2em"></mspace><mn>2</mn>
<mspace width=".2em"></mspace>
</math>点で接する直線の方程式を求めよ.</p>
<p class="s1level">(2) 曲線<math 
xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width=".2em"></mspace><mrow><mi>y</mi>
<mo>=</mo><mi>f</mi><mo>&af;</mo><mo stretchy="false">(</mo>
<mi>x</mi><mo rspace=".2em" stretchy="false">)</mo></mrow>
</math>と(1)で求めた直線で囲まれた領域の面積を求めよ.
</p>
</div>
</div>

(抜粋)...
???(1) 接する直線の式は y=x
???(2)面積=16√2/15

以下、不思議???

グラフを作図して下さい。
増減表を表示して下さい。
増減表をお願いします。。
増減表の縦横を逆にして下さい。

もちろんです。増減表を縦横逆にして再作成します。
私は、あきらめました。

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

sympyで
ソースコードだけで

・(抜粋)
・print文を、私が追加しています。

import sympy as sp

# 変数の定義
x = sp.symbols('x')

# 関数 f(x) の定義
f = x**4 - 2*x**2 + x

# 導関数 f'(x) の計算
f_prime = sp.diff(f, x)

# f'(x) = 0 の解を求める
critical_points = sp.solve(f_prime, x)

# 2つの異なる解
x1, x2 = critical_points[0], critical_points[1]

# それぞれの点での y 値
y1 = f.subs(x, x1)
y2 = f.subs(x, x2)

# それぞれの点での接線の方程式を求める
tangent_line1 = sp.simplify(f_prime.subs(x, x1) * (x - x1) + y1)
tangent_line2 = sp.simplify(f_prime.subs(x, x2) * (x - x2) + y2)

# 交点を求める
intersection_points = sp.solve(f - tangent_line1, x)

# 面積の計算
area = sp.integrate(f - tangent_line1, (x, intersection_points[0], intersection_points[1]))

# 結果の表示
tangent_line1, tangent_line2, area

print("#",tangent_line1, tangent_line2, area)

???終了しませんでした。

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

???勉強中です。判別式???

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

(テンプレート)

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

・以下ができたら、助かります。指定と全部です

0
0
1

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