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?

両端支持梁(英:Simply supported beam)組合せ応力 問題5.p148「材料力学演習(20221021)」をsympyでやってみたい。

Last updated at Posted at 2023-11-26

・たわみ、たわみ角を勉強中。

オリジナル

問題5.p148 <「材料力学演習(20221021)一括(ver.3.3)」を勉強したい。#sympy
        ???タブレット等で、pdfを開く事ができないかも。??? 

sympyで

・ver0.2
・sympyのmaximum()関数を使って、最大せん断応力の長さ方向の発生位置の計算です。
 maximum()関数で最大値を求めてから、solve()関数で方程式の解です。
sympy.calculus.util.maximum(f, symbol, domain=Reals)
https://docs.sympy.org/latest/modules/calculus/index.html#sympy.calculus.util.maximum

# ver0.2
from sympy import *

var('h,b,L,P,Iz'            ,real=True,positive=True)
var('σx,σy,τxy,M,x,y,F,σ1,σ2',real=True)
var('σ1y0,σ2y0',real=True)
var('τmaxy0',real=True)
rep1={h:100*0.001,b:50*0.001,L:1.0,P:5.0*1000}
rep2={Iz:(1/12*b*h**3).subs(rep1)}
# 
eq43_σ1y0  =Eq(σ1y0  , P/2*h**2/(8*Iz))
eq43_σ2y0  =Eq(σ2y0  ,-P/2*h**2/(8*Iz))
eq44_τmaxy0=Eq(τmaxy0, P/2*h *x/(4*Iz))
print("# 1)",eq43_σ1y0  .subs(rep1|rep2))
print("# 1)",eq43_σ2y0  .subs(rep1|rep2))
# 
f   =eq44_τmaxy0.subs(rep1|rep2).rhs
fmax=maximum(f,x,Interval(0,L/2).subs(rep1|rep2) )
print("# 2)",eq44_τmaxy0.subs(rep1|rep2))
print("# 2)",round(solve(Eq(f,fmax),x)[0],1))
print("# 2)",Eq(τmaxy0, round(fmax,1)))
# 1) Eq(σ1y0, 750000.0)
# 1) Eq(σ2y0, -750000.0)
# 2) Eq(τmaxy0, 15000000.0*x)
# 2) 0.5
# 2) Eq(τmaxy0, 7500000.0)

・ver0.1。 上と同じ。辞書の結合。subsの辞書の置き換えで、おまかせ全部代入です。

# ver0.1
from sympy import *

var('h,b,L,P,Iz'            ,real=True,positive=True)
var('σx,σy,τxy,M,x,y,F,σ1,σ2',real=True)
var('σ1y0,σ2y0',real=True)
var('τmaxy0',real=True)
rep1={h:100*0.001,b:50*0.001,L:1.0,P:5.0*1000}
rep2={Iz:(1/12*b*h**3).subs(rep1)}
# 
eq43_σ1y0  =Eq(σ1y0  , P/2*h**2/(8*Iz))
eq43_σ2y0  =Eq(σ2y0  ,-P/2*h**2/(8*Iz))
eq44_τmaxy0=Eq(τmaxy0, P/2*h *x/(4*Iz))
print("# 1)",eq43_σ1y0  .subs(rep1|rep2))
print("# 1)",eq43_σ2y0  .subs(rep1|rep2))
print("# 2)",eq44_τmaxy0.subs(rep1|rep2))
print("# 2)",eq44_τmaxy0.subs({x:Rational(1,2)*L}).subs(rep1|rep2))
# 1) Eq(σ1y0, 750000.0)
# 1) Eq(σ2y0, -750000.0)
# 2) Eq(τmaxy0, 15000000.0*x)
# 2) Eq(τmaxy0, 7500000.0)

いつもの? 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?