In [2]: import sympy as sp # Define symbols m, 1, b, omega= sp.symbols ('m 1 b omega') Ix = 1/12 * m*1**2 In [3]: # Inertia matrices of rods about their mass centers (G) I_G1= sp.Matrix ([[0, 0, 0], [0, Ix, 0], [0, 0, Ix]]) I_G2= sp.Matrix ([[Ix, 0, 0], [0, 0, 0], [0, 0, Ix]]) I_G3= sp.Matrix ([[Ix, 0, 0], [0, Ix, 0], [0, 0, 0]]) In [4]: # Position vectors of mass centers of rods relative to the mass center S* r_Gl_Sstar= sp.Matrix ([-b/2, 0, 0]) r_G2_Sstar = sp.Matrix ([0, -b/2, 0]) r_G3_Sstar = sp.Matrix ([0, 0, -b/2]) # Inertia matrices of rods about S* using the parallel axis theorem I_R1_Sstar=I_G1 + mr_Gl_Sstar.cross (r_Gl_Sstar).cross (sp.eye (3)) I_R2_Sstar=I_G2 + m r_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3)) I_R3_Sstar = I_G3+ m* r_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3)) ShapeError /var/folders/nk/sfvkdtp13jz_9vg5qxdyqjf00000gn/T/ipykernel_2376/3050223977.py in 4 r_G3_Sstar = sp.Matrix ([0, 0, -b/2]) 5 # Inertia matrices of rods about S* using the parallel axis theorem 6 I R1_Sstar=I_G1 + mr_G1_Sstar.cross (r_G1_Sstar).cross (sp.eye (3)) I_R2_Sstar 7 I_G2+ mr_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3)) 8 I R3_Sstar = I_G3+ mr_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3)) -/opt/anaconda3/lib/python3.9/site-packages/sympy/matrices/matrices.py in cross (self, b) 1291 1292 ->1293 1294 1295 Traceback (most recent call last) if not (self.rows *self.cols= b.rows* b.cols == 3): raise ShapeError("Dimensions incorrect for cross product: 88 x 8s" 8 ((self.rows, self.cols), (b.rows, b.cols))) else: ShapeError: Dimensions incorrect for cross product: (3, 1) x (3, 3)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%
How can I solve this error
In [2]: import sympy as sp
# Define symbols
m, 1, b, omega= sp.symbols ('m 1 b omega')
Ix = 1/12 * m* 1**2
In [3]: # Inertia matrices of rods about their mass centers (G)
I_G1 = sp.Matrix ([[0, 0, 0], [0, Ix, 0], [0, 0, Ix]])
I_G2
sp.Matrix ([[Ix, 0, 0], [0, 0, 0], [0, 0, Ix]])
sp.Matrix ([[Ix, 0, 0], [0, Ix, 0], [0, 0, 011)
I_G3=
In [4]: # Position vectors of mass centers of rods relative to the mass center S*
r_Gl_Sstar = sp.Matrix ([-b/2, 0, 0])
r_G2_Sstar = sp.Matrix ([0, -b/2, 0]).
r_G3_Sstar = sp.Matrix ( [0, 0, -b/2])
# Inertia matrices of rods about S* using the parallel axis theorem
I_R1_Sstar = I_G1 + m *r_Gl_Sstar.cross (r_Gl_Sstar).cross (sp.eye (3))
I_R2_Sstar=I_G2 + m * r_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3))
I_R3_Sstar = I_G3 + m *r_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3))
ShapeError
/var/folders/nk/sfvkdtp13jz_9vg5qxdyqjf00000gn/T/ipykernel_2376/3050223977.py in <module>
4 r_G3_Sstar = sp.Matrix ([0, 0, -b/2])
5 # Inertia matrices of rods about S* using the parallel axis theorem
I_G1 + mr_G1_Sstar.cross (r_Gl_Sstar).cross (sp.eye (3))
6 I R1_Sstar
7 I_R2_Sstar = I_G2 + mr_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3))
8 I R3_Sstar I_G3+ mr_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3))
-/opt/anaconda3/lib/python3.9/site-packages/sympy/matrices/matrices.py in cross (self, b)
if not (self.rows* self.cols == b.rowsb.cols == 3) :
raise ShapeError("Dimensions incorrect for cross product: %s x %s" 8
((self.rows, self.cols), (b.rows, b.cols)))
1291
1292
1293
1294
1295
Traceback (most recent call last)
else:
ShapeError: Dimensions incorrect for cross product: (3, 1) x (3, 3)
Transcribed Image Text:In [2]: import sympy as sp # Define symbols m, 1, b, omega= sp.symbols ('m 1 b omega') Ix = 1/12 * m* 1**2 In [3]: # Inertia matrices of rods about their mass centers (G) I_G1 = sp.Matrix ([[0, 0, 0], [0, Ix, 0], [0, 0, Ix]]) I_G2 sp.Matrix ([[Ix, 0, 0], [0, 0, 0], [0, 0, Ix]]) sp.Matrix ([[Ix, 0, 0], [0, Ix, 0], [0, 0, 011) I_G3= In [4]: # Position vectors of mass centers of rods relative to the mass center S* r_Gl_Sstar = sp.Matrix ([-b/2, 0, 0]) r_G2_Sstar = sp.Matrix ([0, -b/2, 0]). r_G3_Sstar = sp.Matrix ( [0, 0, -b/2]) # Inertia matrices of rods about S* using the parallel axis theorem I_R1_Sstar = I_G1 + m *r_Gl_Sstar.cross (r_Gl_Sstar).cross (sp.eye (3)) I_R2_Sstar=I_G2 + m * r_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3)) I_R3_Sstar = I_G3 + m *r_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3)) ShapeError /var/folders/nk/sfvkdtp13jz_9vg5qxdyqjf00000gn/T/ipykernel_2376/3050223977.py in <module> 4 r_G3_Sstar = sp.Matrix ([0, 0, -b/2]) 5 # Inertia matrices of rods about S* using the parallel axis theorem I_G1 + mr_G1_Sstar.cross (r_Gl_Sstar).cross (sp.eye (3)) 6 I R1_Sstar 7 I_R2_Sstar = I_G2 + mr_G2_Sstar.cross (r_G2_Sstar).cross (sp.eye (3)) 8 I R3_Sstar I_G3+ mr_G3_Sstar.cross (r_G3_Sstar).cross (sp.eye (3)) -/opt/anaconda3/lib/python3.9/site-packages/sympy/matrices/matrices.py in cross (self, b) if not (self.rows* self.cols == b.rowsb.cols == 3) : raise ShapeError("Dimensions incorrect for cross product: %s x %s" 8 ((self.rows, self.cols), (b.rows, b.cols))) 1291 1292 1293 1294 1295 Traceback (most recent call last) else: ShapeError: Dimensions incorrect for cross product: (3, 1) x (3, 3)
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education