# Importing module
import math
# Variable declaration
# With the x–and y–axes chosen as the coordinates of points O, A and B forming the equilateral triangle are respectively (0,0),(0.5,0),(0.25,0.25√3 ).
# Let the masses 100 g, 150g and 200g be located at O, A and B be respectively.
m1=100 # Mass of the first particle in g
m2=150 # Mass of the second particle in g
m3=200 # Mass of the third particle in g
x1=0 # x-coordinate of the first particle
x2=0.5 # x-coordinate of the second particle
x3=0.25 # x-coordinate of the third particle
y1=0 # y-coordinate of the first particle
y2=0 # y-coordinate of the second particle
y3=0.25 # y-coordinate of the third particle
# Calculation
X=(m1*x1+m2*x2+m3*x3)/(m1+m2+m3)
Y=(m1*y1+m2*y2+m3*y3)/(m1+m2+m3)
# Result
print("The centre of mass = (",round(X,2),"m,",round(Y,2),"m",")")
# The lamina (∆LMN) may be subdivided into narrow strips each parallel to the base (MN).
# By symmetry each strip has its centre of mass at its midpoint.
# If we join the midpoint of all the strips we get the median LP.
# The centre of mass of the triangle as a whole therefore, has to lie on the median LP.
# Similarly, we can argue that it lies on the median MQ and NR.
# This means the centre of mass lies on the point of concurrence of the medians, i.e. on the centroid G of the triangle.
# Result
print("The centre of mass of a triangular lamina lies on the centroid of the triangle")
# Importing module
import math
# Variable declaration
# Letus choose the X and Y axes as the coordinates of the vertices of the L-shaped lamina.
# We can think of the L-shape to consist of 3 squares each of length 1m.
# The mass of each square is 1kg, since the lamina is uniform.
# The centres of mass C1, C2 and C3 of the squares are, by symmetry, their geometric centres and have coordinates (1/2,1/2), (3/2,1/2), (1/2,3/2) respectively.
# We take the masses of the squares to be concentrated at these points.
# hence the centre of mass of the whole L shape (X, Y) is the centre of mass of these mass points.
m1=1
m2=1
m3=1
x1=1/2
x2=3/2
x3=1/2
y1=1/2
y2=1/2
y3=3/2
# Calculation
X=(m1*x1+m2*x2+m3*x3)/(m1+m2+m3)
Y=(m1*y1+m2*y2+m3*y3)/(m1+m2+m3)
# Result
print("The centre of mass = (",round(X,2),"m,",round(Y,2),"m",")")
# Importing module
import math
import numpy as np
# Variable declaration
a = (3,-4,5) # Vector a
b = (-2,1,-3) # Vector b
# Calculation
s=sum(p*q for p,q in zip(a,b))
a1 = np.array([3,-4,5])
b1 = np.array([-2,1,-3])
v1=np.cross(a1,b1)
v2=np.cross(b1,a1)
# Result
print("Scalar product =",s)
print("Vector product a × b =",v1)
print("Vector product b × a =",v2)