Kernel: Python 3 (system-wide)
In [1]:
from sympy import * r,phi,A,A_r = symbols('r,phi,A,A_r') x,y= symbols('x,y') R=symbols('R') Integral(r,A_r) #Integral(1,x,y) #Integral(1,(r,0,R),(phi,0,2*pi)).doit()
∫rdAr
In [2]:
(Matrix([r*cos(phi), r*sin(phi)]).jacobian([r,phi]))
[cos(ϕ)sin(ϕ)−rsin(ϕ)rcos(ϕ)]
In [3]:
(Matrix([r*cos(phi), r*sin(phi)]).jacobian([r,phi])).det()
rsin2(ϕ)+rcos2(ϕ)
In [4]:
Integral(r,(r,0,R),(phi,0,2*pi)).doit()
πR2
In [5]:
V,H=symbols('V,H') Integral(1,V)
∫1dV
In [0]:
In [6]:
Integral(H*r,(r,0,R),(phi,0,2*pi)).doit()
πHR2
In [0]:
∫0R∫02π∫0H1drdφdz
πHR2
In [7]:
expr=Integral(H*r,(r,0,R),(phi,0,2*pi)).doit() print(latex(expr))
\pi H R^{2}
In [8]:
t=symbols('t') (t**2 + t +10).diff(t) x=Function('x') x(t).diff(t).diff(t)
dt2d2x(t)
Single Degree of Freedom system
In [9]:
# Newtown's second law
In [10]:
m,a,F, F_k,F_c,k,c,F0=symbols('m_12,a,F, F_k,F_c,k,c,F_0') Eq(m*a,F)
am12=F
In [11]:
# Hooke's Law - dependency which describes force of the connetor, where x is distance(displacement, exact posistion of mass place in the space, coordinate system), k is coeficient of stiffness
In [12]:
# For the spring eq_hook=Eq(F_k,k*x(t)) eq_hook
Fk=kx(t)
In [13]:
# formula for acceleration Eq(a,x(t).diff(t,2))
a=dt2d2x(t)
In [14]:
eom=Eq(m*x(t).diff(t,2),-x(t)*k ) eom
m12dt2d2x(t)=−kx(t)
In [15]:
Eq(eom.rewrite(Add),0)
kx(t)+m12dt2d2x(t)=0
In [16]:
Omg=Symbol('\Omega') eom=Eq(m*x(t).diff(t,2),-x(t)*k-c*x(t).diff(t) +F0*sin(Omg*t)) eom
m12dt2d2x(t)=F0sin(Ωt)−cdtdx(t)−kx(t)
In [0]:
In [17]:
# Describe the force of disconector, dumper, (C-element), c - dissipative property and this formula describes velocity with respect to c, dissipative(drag, ressistant) force - # force which acts in opposite direction with respect to the main force. # If the velocity is higher the higher drag(dumper) force # spring tries to keep system equivalent, # dumper just transfers the energy Eq(F_c,c*x(t).diff(t))
Fc=cdtdx(t)
In [18]:
# As x might represent the distance, to find the speed we need just to find derivative, Formula for kinetic energy, labor T=S.One/2 * m * x(t).diff(t)**2 V= Integral(k*x(t),x(t)) T
2m12(dtdx(t))2
In [19]:
# https://en.wikipedia.org/wiki/Work_(physics) #formula for potential energy V.doit()
2kx2(t)
In [20]:
# wrong approach - just for explanation W=F_k *x(t) #application of Hooke's law W.subs(eq_hook.lhs,eq_hook.rhs)
kx2(t)
In [0]:
# amount of motion is kinetic energy, capacity of energy is the potential energy.
In [0]:
In [33]:
v=x(t).diff(t) V=S.One/2*k* x(t)**2 + S.One/2*k*(-1*sin(Omg*t)+x(t))**2 #Solution using the lagrangian mechanics application, difference between kinetic energy and potential energy solution for the out with the first picture(out 8), picture with single degree L=(T-V).doit() #dissipative potential D = S.One /2 * c * v**2 Eq(L.diff(v).diff(t)-L.diff(x(t)) + D.diff(v),0).expand().doit()
cdtdx(t)+2kx(t)−ksin(Ωt)+m12dt2d2x(t)=0
In [23]:
eom
m12dt2d2x(t)=F0sin(Ωt)−cdtdx(t)−kx(t)
In [34]:
# in this case u is the displacement, in general it is given by the data, and aslo it can be understood from the case for the letter eom_u0=Eq(m*x(t).diff(t,2),-x(t)*k-c*x(t).diff(t) + k*(1*sin(Omg*t)-x(t)) ) eom_u0.expand()
m12dt2d2x(t)=−cdtdx(t)−2kx(t)+ksin(Ωt)
In [0]: