Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
555 views
from sympy.physics.units import * from sympy import * from sympy import N as Num print("\n--- User input -----------------------") symbolic = True # symbolic = False if symbolic: # quantity = symbol: h, b = var("h, b") ts, tg = var("t_s, t_g") Q = var("Q") else: # quantity = factor times unit: h, b = 190 *mm, 200 *mm ts, tg = S(13)/2 *mm, 10 *mm Q = 100 *kilo*newton dev=True print("\n--- a: -------------------------------") I_ys = ts * h**3/12 I_yg = (h/2)*(h/2) * tg*b I_y = I_ys + 2 * I_yg pprint(["Iy", I_y.simplify()]) print("\n--- b: -------------------------------") A_1 = b/2*tg A_2 = h/2*ts z_1 = h/2 z_2 = h/4 S_A = z_1 * A_1 S_B = 2*z_1*A_1 + z_2*A_2 pprint(["SA:", S_A.simplify()]) pprint(["SB:", S_B.simplify()]) print("\n--- c: -------------------------------") tau_A = S_A * Q / I_y / tg tau_B = S_B * Q / I_y / ts tau_A = tau_A.simplify() tau_B = tau_B.simplify() pprint(["tau_A:", tau_A]) pprint(["tau_B:", tau_B]) print("\n--- d: -------------------------------") if not (symbolic): print(Num(tau_A,3)) print(Num(tau_B,3)) print("\n--- Check: ---------------------------") # compare with: # Gross, Ehlers, Wriggers: Formeln # und Aufgaben zur Technischen Mechanik 2 Ag = 2*A_1 As = 2*A_2 t1 = As/Ag t2 = 1+As/6/Ag t3 = 1+As/4/Ag tau_max_g = Q/As * t1/t2 * b/2/h tau_max_g = tau_max_g.simplify() print(tau_max_g.equals(tau_A)) tau_max_s = Q/As * t3/t2 tau_max_s = tau_max_s.simplify() print(tau_max_s.equals(tau_B))
--- User input ----------------------- --- a: ------------------------------- 2 h *(6*b*t_g + h*t_s) [Iy, --------------------] 12 --- b: ------------------------------- b*h*t_g [SA:, -------] 4 h*(4*b*t_g + h*t_s) [SB:, -------------------] 8 --- c: ------------------------------- 3*Q*b [tau_A:, -------------------] h*(6*b*t_g + h*t_s) 3*Q*(4*b*t_g + h*t_s) [tau_B:, -------------------------] 2*h*t_s*(6*b*t_g + h*t_s) --- d: ------------------------------- --- Check: --------------------------- True True