summaryrefslogtreecommitdiff
path: root/2411/CH4/EX4.3/Ex4_3.sce
blob: cd7a019a3dc26ce5963027b372a6d16582107ad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Scilab Code Ex4.3: Page-234 (2008)
clc; clear;
c = 3e+008;    // Speed of light in vacuum, m/s
v = [c c/sqrt(2) sqrt(3)/2*c c/2 0.8*c];    // Different speeds of metre rod, m/s
L0 = 100;    // Actual length of the rod, cm
for i = 1:1:5
    L = L0*sqrt(1-v(i)^2/c^2);    // Apparent length of rod from Lorentz transformation, m
    printf("\nFor v = %4.2e m/s, L = %4.1f cm", v(i), L);
end

// Result
// For v = 3.00e+008 m/s, L =  0.0 cm
// For v = 2.12e+008 m/s, L = 70.7 cm
// For v = 2.60e+008 m/s, L = 50.0 cm
// For v = 1.50e+008 m/s, L = 86.6 cm
// For v = 2.40e+008 m/s, L = 60.0 cm