summaryrefslogtreecommitdiff
path: root/26/CH1/EX1.3.31/1_3_31.sce
blob: 0f6c48ba8cd4e68851a6a5b1c14754bdc4737e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
disp('1 gram at (0,1), 1 gram at (8,1) and 1 gram at (2,4)')
cm=(1/3)*(1*[0;1]+1*[8;1]+1*[2;4])
disp('centre of mass is at')
disp(cm)
disp('the new weight of the system=9 grams')
disp('new centre of mass is at')
s=[2;2]
disp(s)
disp('let w1,w2 and w3 be the weights added at (0,1),(8,1) and (2,4) respectively')
disp('hence, w1+w2+w3=6')
disp('using the formula for the centre of mass, we get')
disp('8*w2+2*w3=8 and w1+w2+4*w3=12')
a=[1 1 1 6;0 8 2 8;1 1 4 12]
disp('the augmented matrix is:')
disp(a)
disp('R3=R3-R1')
a(3,:)=a(3,:)-a(1,:)
disp(a)
disp('R3=(1/3)*R3')
a(3,:)=(1/3)*a(3,:)
disp(a)
disp('R2=R2-2*R3 and R1=R1-R3')
a(2,:)=a(2,:)-2*a(3,:)
a(1,:)=a(1,:)-a(3,:)
disp(a)
disp('R1=R1-(1/8)*R2')
a(1,:)=a(1,:)-(1/8)*a(2,:)
disp(a)
disp('R2=(1/8)*R2')
a(2,:)=(1/8)*a(2,:)
disp(a)
printf('Add %.1f grams at (0,1), %.1f grams at (8,1) and %d grams at (2,4)',a(1,4),a(2,4),a(3,4))