Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 1137
from sympy.physics.units import * from sympy import * print("------ User input ---------------------") symbolic = True symbolic = False if symbolic: # quantity = symbol: F = var("F") else: # quantity = factor times unit: F = 2 * newton s2 = sqrt(2) s6 = sqrt(6) e1 = Matrix([ 1, 0,-1 ])/s2 e2 = Matrix([ 1, 2,-1 ])/s6 e3 = Matrix([-1, 2,-1 ])/s6 Fv = Matrix([ 0, 0,-F ]) Nv = Matrix([ 0, 0, 0 ]) # Variables: S1, S2, S3 =var('S1, S2, S3') eq = Eq(S1*e1 + S2*e2 + S3*e3 + Fv, Nv) pprint(eq) unknowns = [S1, S2, S3] sol = solve(eq, unknowns) pprint(sol) for x in sol: S = sol[x] pprint(N(S,2))
------ User input --------------------- [ ___ ___ ___ ] [ \/ 2 *S1 \/ 6 *S2 \/ 6 *S3 ] [ -------- + -------- - -------- ] = [0] [ 2 6 6 ] [ ] [ ] [0] [ ___ ___ ] [ ] [ \/ 6 *S2 \/ 6 *S3 ] [0] [ -------- + -------- ] [ 3 3 ] [ ] [ ___ ___ ___ ] [ \/ 2 *S1 \/ 6 *S2 \/ 6 *S3 2*kg*m] [- -------- - -------- - -------- - ------] [ 2 6 6 2 ] [ s ] ___ ___ ___ -2*\/ 2 *kg*m \/ 6 *kg*m -\/ 6 *kg*m {S1: --------------, S2: ----------, S3: ------------} 2 2 2 s s s -2.8*kg*m ---------- 2 s 2.4*kg*m -------- 2 s -2.4*kg*m ---------- 2 s