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?

常微分方程式 x**2*y''+2*x*y'=6*x,y(1)=y(2)=0 を解きたい。(その1)

Last updated at Posted at 2024-11-29

・てんこ盛りになってしまいました。タグ5個じゃ足りませんでした。
・ChatGPTに、「GPT-4o. の Free プラン」と「別のモデル」があるようです。

(その2)ロンスキアン途中です。へつづきます。
https://qiita.com/mrrclb48z/items/1d07201f39f11e5eb23a

常微分方程式
x**2*y''+2*x*y'=6*x,y(1)=y(2)=0
を解きたい。

wolframalphaで

次をお試しください:...

MATHEMATICA 13.2で

x**2*y''+2*x*y'=6*x,y(1)=y(2)=0
上記をmathematicaの式の変換して下さい。

In[1]:=

DSolve[{x^2 y''[x] + 2 x y'[x] == 6 x, y[1] == 0, y[2] == 0}, y[x], x]

out[1]:=

{{y[x] -> (3 (2 - 3 x + x^2))/x}}

ChatGPT先生へ

(以下回答抜粋)

...
???
計算
詳しい計算をSymPyで行います。
エラーが発生しました。境界条件の指定方法に問題があるようです。
...
特殊解
...

sympyのソースコードを教えて下さい。

from sympy import symbols, Function, Eq, dsolve, solve

# Variables and functions
x = symbols('x')
C1, C2 = symbols('C1 C2')  # Constants
y = Function('y')(x)

# Original differential equation
ode = Eq(x**2 * y.diff(x, 2) + 2 * x * y.diff(x), 6 * x)

# Solve the ODE
general_solution = dsolve(ode, y)

# Apply boundary conditions: y(1) = 0, y(2) = 0
bc_eq1 = Eq(general_solution.rhs.subs(x, 1), 0)  # y(1) = 0
bc_eq2 = Eq(general_solution.rhs.subs(x, 2), 0)  # y(2) = 0

# Solve for constants
constants = solve([bc_eq1, bc_eq2], [C1, C2])

# Substitute constants back into the general solution
particular_solution = general_solution.subs(constants)

# Output results
print("General Solution:", general_solution)
print("Constants:", constants)
print("Particular Solution:", particular_solution)

sympy.solvers.ode.dsolve(eq, func=None, hint='default', simplify=True, ics=None, xi=None, eta=None, x0=0, n=6, **kwargs)
https://docs.sympy.org/latest/modules/solvers/ode.html#sympy.solvers.ode.dsolve

Gemini先生へ

copilot先生へ

(別件) mathmlで表示したい。

ChatGPT先生へ

x**2*y''+2*x*y'=6*x,y(1)=y(2)=0
上記をmathmlにして下さい。
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mi>x</mi>
    <mo>^</mo>
    <mn>2</mn>
    <mi>y</mi>
    <mo>&#x2032;&#x2032;</mo>
    <mo>+</mo>
    <mn>2</mn>
    <mi>x</mi>
    <mi>y</mi>
    <mo>&#x2032;</mo>
    <mo>=</mo>
    <mn>6</mn>
    <mi>x</mi>
  </mrow>
  <mo>,</mo>
  <mrow>
    <msub>
      <mi>y</mi>
      <mn>1</mn>
    </msub>
    <mo>=</mo>
    <mn>0</mn>
    <mo>,</mo>
    <msub>
      <mi>y</mi>
      <mn>2</mn>
    </msub>
    <mo>=</mo>
    <mn>0</mn>
  </mrow>
</math>

(別件) mathjaxで表示したい。

?1回目。ChatGPT先生へ

x**2*y''+2*x*y'=6*x,y(1)=y(2)=0
上記をmathjaxにして下さい。
方法を教えて下さい。

この方程式を解きます:

$$x^2 \frac{d^2y}{dx^2} + 2x \frac{dy}{dx} = 6x, \quad y(1) = y(2) = 0$$

以下、ソース

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" id="MathJax-script" async
      src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
    </script>
</head>
<body>
    <p>この方程式を解きます:</p>
    <p>
    $$x^2 \frac{d^2y}{dx^2} + 2x \frac{dy}{dx} = 6x, \quad y(1) = y(2) = 0$$
    </p>
</body>
</html>

?2回目。ChatGPT先生へ
回答では別のモデルが使用されます。
訳がわからなくなりました
1回目は「GPT-4o. の Free プラン」だったようです。

(別件)

2023/7/6
今日は数式の描画に使っているライブラリ(MathJax)のバージョンアップについてお知らせいたします。(v2.6.0 → v3.2.2)

参考記事

参考文献

>p140
>解答 yex=6/x+3x-9

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?