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?

静力学と材料力学 演習問題8 p28「材料力学演習(20221021)」をsympyでやってみた。 2部材Truss

Last updated at Posted at 2025-06-09

・sympyのTrussで作図しました。縦横比が1:1でありません。

オリジナル

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

sympyで

・勉強中

sympyのTrussで

ver0.1

# ver0.1 
from sympy.physics.continuum_mechanics.truss import Truss
import math
from sympy import *
P=1  # var('P')
L=1  # var('L')
t = Truss()
t.add_node     (('B',Rational(3,4)*L,L)) 
t.add_node     (('C',0              ,0),('A',Rational(3,4)*L*2,0)) 
t.add_member   (('CB','C','B') ,('BA','B','A'))   
t.apply_support(('C' ,'pinned'),('A','pinned'))
t.apply_load   (('B',P,90))
p = t.draw()
p.show()
t.solve()
# print("#",t.reaction_loads )           
# print("#",t.internal_forces)
# 
var('Q,l,AE,x')
U= 1/(2*AE)*integrate((Q*t.internal_forces['CB'])**2,(x,0,Rational(5,4)*l)) \
  +1/(2*AE)*integrate((Q*t.internal_forces['BA'])**2,(x,0,Rational(5,4)*l)) 
print("#",str(diff(U,Q)).replace("Q","P"))
# 125*P*l/(128*AE)

ver1.1

・Trussの 「property member_lengths」がありました。

from sympy.physics.continuum_mechanics.truss import Truss
from sympy import *
var('P')
var('L,l,AE',positive=True)  
def myTruss(l):
    def myAdd_member(*args):
        def make_triples(s):
            return (s,s[0],s[1])
        for s in args:
            t.add_member(make_triples(s))      
    t = Truss()
    t.add_node     (('A',0               ,l),('C',Rational(3,4)*l*2,l), \
                    ('B',Rational(3,4)*l,0)) 
    myAdd_member   ( 'AB','BC')  
    t.apply_support(('A' ,'pinned'),('C','pinned'))
    t.apply_load   (('B',P,270.0))   
    return t
# -------------------------------------------------------------------------------------
myTruss(1).draw().show()       # 作図(l=1)
t=myTruss(l);t.solve()         # 計算のみ
δ=sum({k:1/(2*AE)*v1**2*v2  \
        for (k,v1),(_,v2) in zip(t.internal_forces.items(),t.member_lengths.items())} \
        .values()).diff(P).simplify()
print('#',δ)
# 125*P*l/(128*AE)

・縦横比は1:1では、ありません。

111.png

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?