0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AI先生へ「積分を(sympyで)解答して下さい。」2025 京都大学 前期理系数学【1】問2(1)

Last updated at Posted at 2025-02-28

オリジナル

2025 京都大学 前期MathJax 【1】問2(1) < 大学入試数学問題集成 様
https://mathexamtest.web.fc2.com/2025/202510541/2025105410100mj.html#top-0102
(参考 mathjax表示)
https://qiita.com/mrrclb48z/items/c49116c24348fb6d646a

考察

・ChatGT先生へ。解答ありがとうございました。
本日ChatGT先生は???... 私の質問方法が悪いかも。
・最初の質問(sympyなし)で

分子の各項を分けて、適切な方法,積分の各部分を個別に解析して解答を求めることが一般的です。

 第1項の積分(計算1つ)
 第2項の積分(計算3つ)
 ステキ
・sympyでお願いすると、なかなか分子を4つの項に分解にしてもらえませんでした。
 ChatGPT先生も、ラクしようとされているかも。
 もしかしたら、ChatGPT先生は質問者の性格を読み取っているかもしれません。
・当初,スクショ(スクリーンショット)からでもと思いましたが、
 スクショだと保存がメンドーです。

・(追加) 2log2でした。私の聞き方が不十分でした。アドバイスをいただけると幸いです。

ChatGPT先生へ

・質問リストの追番は無視して下さい。1個ずつです。途中の回答表示は省略しています。

# 質問リスト
1. 以下を日本語で解答して下さい。  
   <p class="s2level">(1) <math>
   <mrow><mstyle displaystyle="true"><msubsup><mo>&int;</mo>
   <mn>0</mn><msqrt><mn>3</mn></msqrt></msubsup></mstyle>
   <mstyle displaystyle="true"><mfrac><mrow><mi>x</mi><mo>&it;</mo><msqrt>
   <msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mn>1</mn></msqrt>
   <mo>+</mo><mn>2</mn><mo>&it;</mo><msup><mi>x</mi><mn>3</mn></msup>
   <mo>+</mo><mn>1</mn></mrow><mrow><msup><mi>x</mi><mn>2</mn></msup>
   <mo>+</mo><mn>1</mn></mrow></mfrac></mstyle><mo>&it;</mo>
   <mi mathvariant="italic">dx</mi></mrow><mspace width="2em"></mspace>
2. 上記の解答をお願いします。
3. 上記をsympy のソースコードでお願いします。
4. 上記を分子を分解したsympy のソースコードでお願いします。
5. 上記の第2項も分解して下さい。
6. 上記の第2項は、当初の3つで分解したソースコードでお願いします。

(回答抜粋)
このコードを実行すると、4 - log(4) + pi/3 という結果が得られます。

I1: 1
I2: 3 - log(4) + pi/3
I_total: 4 - log(4) + pi/3
I1: 1
I2_1: 3 - log(4)
I2_2: pi/3
I_total: 4 - log(4) + pi/3

・私は,最終ソースコードのみ表示です。途中のソースコードは省略です。

import sympy as sp

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

# 分母の定義
denom = x**2 + 1

# 分子の各項を分解
num1 = x * sp.sqrt(x**2 + 1)  # 第1項
num2_1 = 2*x  # 第2項のうち 2x
num2_2 = - (2*x) / (x**2 + 1)  # 第2項のうち - (2x / (x² + 1))
num2_3 = 1 / (x**2 + 1)  # 第2項のうち 1 / (x² + 1)

# 各分数に分解
term1 = num1 / denom
term2_1 = num2_1  # 2x はそのまま
term2_2 = num2_2
term2_3 = num2_3

# 各項を積分
I1 = sp.integrate(term1, (x, 0, sp.sqrt(3)))
I2_1 = sp.integrate(term2_1, (x, 0, sp.sqrt(3)))
I2_2 = sp.integrate(term2_2, (x, 0, sp.sqrt(3)))
I2_3 = sp.integrate(term2_3, (x, 0, sp.sqrt(3)))

# 合計を計算
I_total = I1 + I2_1 + I2_2 + I2_3

# 結果の出力
print("I1:", I1.simplify())
print("I2_1:", I2_1.simplify())
print("I2_2:", I2_2.simplify())
print("I2_3:", I2_3.simplify())
print("I_total:", I_total.simplify())
I1: 1
I2_1: 3
I2_2: -log(4)
I2_3: pi/3
I_total: 4 - log(4) + pi/3

これは 手計算の結果と一致 します!

Gemini先生へ

(未)

copilot先生へ

(未)

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

(テンプレート)

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

Qiita内

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?