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?

材料力学AI「梁解析の応力法とたわみ角法の違いを、sympyのソースコードで教えて下さい。」をAI先生に聞きました。

Last updated at Posted at 2025-01-14

梁解析の応力法とたわみ角法の違いを、sympyのソースコードで教えて下さい。

ChatGPT先生へ

ChatGPT の回答は必ずしも正しいとは限りません。重要な情報は確認するようにしてください。

(回答抜粋)

  1. 応力法の例:
from sympy import symbols, Eq, solve

# 変数定義
M1, M2, L, P = symbols('M1 M2 L P')  # モーメント, 長さ, 荷重

# 平衡式 (例: 二端固定梁)
eq1 = Eq(M1 + M2 - P * L, 0)  # モーメントの平衡
eq2 = Eq(2 * M1 - M2, 0)      # たわみ条件 (例)

# 方程式を解く
solution = solve([eq1, eq2], [M1, M2])
print("応力法の解:", solution)
  1. たわみ角法の例:
from sympy import symbols, integrate, Function

# 変数定義
x, L, E, I, P = symbols('x L E I P')  # 座標, 長さ, ヤング率, 断面2次モーメント, 荷重
v = Function('v')(x)  # たわみ

# 微分方程式 (例: 単純梁中央荷重の場合)
M = P * x * (L - x) / L  # 曲げモーメント
diff_eq = Eq(E * I * v.diff(x, x), -M)

# たわみを解く
v_solution = integrate(integrate(-M / (E * I), x), x)  # 2回積分
print("たわみ角法の解:", v_solution)

実行結果も教えて下さい。

  1. 応力法の解:
{M1: L*P/3, M2: 2*L*P/3}
  1. たわみ角法の解:
-P*x**3/(6*E*I) + P*x**4/(12*E*I*L)

上記のそれぞれをsympyの行列の積の表現でお願いします。

  1. 応力法の行列積形式
Matrix([
    [1, 1],       # 平衡式の係数行列
    [2, -1]       # たわみ条件の係数行列
]) * Matrix([
    [M1],         # モーメント M1
    [M2]          # モーメント M2
]) = Matrix([
    [P * L],      # 荷重のモーメント影響
    [0]           # たわみ条件の右辺
])
  1. たわみ角法の行列積形式
Matrix([
    [1]           # 単位行列を用いてスカラーを表現
]) * integrate(integrate(
    -P * x * (L - x) / L / (E * I), x), x)
Matrix([
    [-P*x**3/(6*E*I) + P*x**4/(12*E*I*L)]
])

Gemini先生へ

copilot先生へ

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

(テンプレート)  開発環境

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

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