Cody

# Problem 1446. Minimum Distance Point to Segment

Solution 1631824

Submitted on 22 Sep 2018 by Isaac Llorente
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
p=[0 0]; v=[1 -1]; w=[1 1]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-1)<.005)

Q = Columns 1 through 9 1.0000 - 1.0000i 1.0000 - 0.9800i 1.0000 - 0.9600i 1.0000 - 0.9400i 1.0000 - 0.9200i 1.0000 - 0.9000i 1.0000 - 0.8800i 1.0000 - 0.8600i 1.0000 - 0.8400i Columns 10 through 18 1.0000 - 0.8200i 1.0000 - 0.8000i 1.0000 - 0.7800i 1.0000 - 0.7600i 1.0000 - 0.7400i 1.0000 - 0.7200i 1.0000 - 0.7000i 1.0000 - 0.6800i 1.0000 - 0.6600i Columns 19 through 27 1.0000 - 0.6400i 1.0000 - 0.6200i 1.0000 - 0.6000i 1.0000 - 0.5800i 1.0000 - 0.5600i 1.0000 - 0.5400i 1.0000 - 0.5200i 1.0000 - 0.5000i 1.0000 - 0.4800i Columns 28 through 36 1.0000 - 0.4600i 1.0000 - 0.4400i 1.0000 - 0.4200i 1.0000 - 0.4000i 1.0000 - 0.3800i 1.0000 - 0.3600i 1.0000 - 0.3400i 1.0000 - 0.3200i 1.0000 - 0.3000i Columns 37 through 45 1.0000 - 0.2800i 1.0000 - 0.2600i 1.0000 - 0.2400i 1.0000 - 0.2200i 1.0000 - 0.2000i 1.0000 - 0.1800i 1.0000 - 0.1600i 1.0000 - 0.1400i 1.0000 - 0.1200i Columns 46 through 54 1.0000 - 0.1000i 1.0000 - 0.0800i 1.0000 - 0.0600i 1.0000 - 0.0400i 1.0000 - 0.0200i 1.0000 + 0.0000i 1.0000 + 0.0200i 1.0000 + 0.0400i 1.0000 + 0.0600i Columns 55 through 63 1.0000 + 0.0800i 1.0000 + 0.1000i 1.0000 + 0.1200i 1.0000 + 0.1400i 1.0000 + 0.1600i 1.0000 + 0.1800i 1.0000 + 0.2000i 1.0000 + 0.2200i 1.0000 + 0.2400i Columns 64 through 72 1.0000 + 0.2600i 1.0000 + 0.2800i 1.0000 + 0.3000i 1.0000 + 0.3200i 1.0000 + 0.3400i 1.0000 + 0.3600i 1.0000 + 0.3800i 1.0000 + 0.4000i 1.0000 + 0.4200i Columns 73 through 81 1.0000 + 0.4400i 1.0000 + 0.4600i 1.0000 + 0.4800i 1.0000 + 0.5000i 1.0000 + 0.5200i 1.0000 + 0.5400i 1.0000 + 0.5600i 1.0000 + 0.5800i 1.0000 + 0.6000i Columns 82 through 90 1.0000 + 0.6200i 1.0000 + 0.6400i 1.0000 + 0.6600i 1.0000 + 0.6800i 1.0000 + 0.7000i 1.0000 + 0.7200i 1.0000 + 0.7400i 1.0000 + 0.7600i 1.0000 + 0.7800i Columns 91 through 99 1.0000 + 0.8000i 1.0000 + 0.8200i 1.0000 + 0.8400i 1.0000 + 0.8600i 1.0000 + 0.8800i 1.0000 + 0.9000i 1.0000 + 0.9200i 1.0000 + 0.9400i 1.0000 + 0.9600i Columns 100 through 101 1.0000 + 0.9800i 1.0000 + 1.0000i d = 1

2   Pass
p=[0 0]; v=[-1 2]; w=[1 2]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-2)<.005)

Q = Columns 1 through 9 -1.0000 + 2.0000i -0.9800 + 2.0000i -0.9600 + 2.0000i -0.9400 + 2.0000i -0.9200 + 2.0000i -0.9000 + 2.0000i -0.8800 + 2.0000i -0.8600 + 2.0000i -0.8400 + 2.0000i Columns 10 through 18 -0.8200 + 2.0000i -0.8000 + 2.0000i -0.7800 + 2.0000i -0.7600 + 2.0000i -0.7400 + 2.0000i -0.7200 + 2.0000i -0.7000 + 2.0000i -0.6800 + 2.0000i -0.6600 + 2.0000i Columns 19 through 27 -0.6400 + 2.0000i -0.6200 + 2.0000i -0.6000 + 2.0000i -0.5800 + 2.0000i -0.5600 + 2.0000i -0.5400 + 2.0000i -0.5200 + 2.0000i -0.5000 + 2.0000i -0.4800 + 2.0000i Columns 28 through 36 -0.4600 + 2.0000i -0.4400 + 2.0000i -0.4200 + 2.0000i -0.4000 + 2.0000i -0.3800 + 2.0000i -0.3600 + 2.0000i -0.3400 + 2.0000i -0.3200 + 2.0000i -0.3000 + 2.0000i Columns 37 through 45 -0.2800 + 2.0000i -0.2600 + 2.0000i -0.2400 + 2.0000i -0.2200 + 2.0000i -0.2000 + 2.0000i -0.1800 + 2.0000i -0.1600 + 2.0000i -0.1400 + 2.0000i -0.1200 + 2.0000i Columns 46 through 54 -0.1000 + 2.0000i -0.0800 + 2.0000i -0.0600 + 2.0000i -0.0400 + 2.0000i -0.0200 + 2.0000i 0.0000 + 2.0000i 0.0200 + 2.0000i 0.0400 + 2.0000i 0.0600 + 2.0000i Columns 55 through 63 0.0800 + 2.0000i 0.1000 + 2.0000i 0.1200 + 2.0000i 0.1400 + 2.0000i 0.1600 + 2.0000i 0.1800 + 2.0000i 0.2000 + 2.0000i 0.2200 + 2.0000i 0.2400 + 2.0000i Columns 64 through 72 0.2600 + 2.0000i 0.2800 + 2.0000i 0.3000 + 2.0000i 0.3200 + 2.0000i 0.3400 + 2.0000i 0.3600 + 2.0000i 0.3800 + 2.0000i 0.4000 + 2.0000i 0.4200 + 2.0000i Columns 73 through 81 0.4400 + 2.0000i 0.4600 + 2.0000i 0.4800 + 2.0000i 0.5000 + 2.0000i 0.5200 + 2.0000i 0.5400 + 2.0000i 0.5600 + 2.0000i 0.5800 + 2.0000i 0.6000 + 2.0000i Columns 82 through 90 0.6200 + 2.0000i 0.6400 + 2.0000i 0.6600 + 2.0000i 0.6800 + 2.0000i 0.7000 + 2.0000i 0.7200 + 2.0000i 0.7400 + 2.0000i 0.7600 + 2.0000i 0.7800 + 2.0000i Columns 91 through 99 0.8000 + 2.0000i 0.8200 + 2.0000i 0.8400 + 2.0000i 0.8600 + 2.0000i 0.8800 + 2.0000i 0.9000 + 2.0000i 0.9200 + 2.0000i 0.9400 + 2.0000i 0.9600 + 2.0000i Columns 100 through 101 0.9800 + 2.0000i 1.0000 + 2.0000i d = 2

3   Pass
p=[0 0]; v=[-1 -1]; w=[1 1]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d)<.005)

Q = Columns 1 through 9 -1.0000 - 1.0000i -0.9800 - 0.9800i -0.9600 - 0.9600i -0.9400 - 0.9400i -0.9200 - 0.9200i -0.9000 - 0.9000i -0.8800 - 0.8800i -0.8600 - 0.8600i -0.8400 - 0.8400i Columns 10 through 18 -0.8200 - 0.8200i -0.8000 - 0.8000i -0.7800 - 0.7800i -0.7600 - 0.7600i -0.7400 - 0.7400i -0.7200 - 0.7200i -0.7000 - 0.7000i -0.6800 - 0.6800i -0.6600 - 0.6600i Columns 19 through 27 -0.6400 - 0.6400i -0.6200 - 0.6200i -0.6000 - 0.6000i -0.5800 - 0.5800i -0.5600 - 0.5600i -0.5400 - 0.5400i -0.5200 - 0.5200i -0.5000 - 0.5000i -0.4800 - 0.4800i Columns 28 through 36 -0.4600 - 0.4600i -0.4400 - 0.4400i -0.4200 - 0.4200i -0.4000 - 0.4000i -0.3800 - 0.3800i -0.3600 - 0.3600i -0.3400 - 0.3400i -0.3200 - 0.3200i -0.3000 - 0.3000i Columns 37 through 45 -0.2800 - 0.2800i -0.2600 - 0.2600i -0.2400 - 0.2400i -0.2200 - 0.2200i -0.2000 - 0.2000i -0.1800 - 0.1800i -0.1600 - 0.1600i -0.1400 - 0.1400i -0.1200 - 0.1200i Columns 46 through 54 -0.1000 - 0.1000i -0.0800 - 0.0800i -0.0600 - 0.0600i -0.0400 - 0.0400i -0.0200 - 0.0200i 0.0000 + 0.0000i 0.0200 + 0.0200i 0.0400 + 0.0400i 0.0600 + 0.0600i Columns 55 through 63 0.0800 + 0.0800i 0.1000 + 0.1000i 0.1200 + 0.1200i 0.1400 + 0.1400i 0.1600 + 0.1600i 0.1800 + 0.1800i 0.2000 + 0.2000i 0.2200 + 0.2200i 0.2400 + 0.2400i Columns 64 through 72 0.2600 + 0.2600i 0.2800 + 0.2800i 0.3000 + 0.3000i 0.3200 + 0.3200i 0.3400 + 0.3400i 0.3600 + 0.3600i 0.3800 + 0.3800i 0.4000 + 0.4000i 0.4200 + 0.4200i Columns 73 through 81 0.4400 + 0.4400i 0.4600 + 0.4600i 0.4800 + 0.4800i 0.5000 + 0.5000i 0.5200 + 0.5200i 0.5400 + 0.5400i 0.5600 + 0.5600i 0.5800 + 0.5800i 0.6000 + 0.6000i Columns 82 through 90 0.6200 + 0.6200i 0.6400 + 0.6400i 0.6600 + 0.6600i 0.6800 + 0.6800i 0.7000 + 0.7000i 0.7200 + 0.7200i 0.7400 + 0.7400i 0.7600 + 0.7600i 0.7800 + 0.7800i Columns 91 through 99 0.8000 + 0.8000i 0.8200 + 0.8200i 0.8400 + 0.8400i 0.8600 + 0.8600i 0.8800 + 0.8800i 0.9000 + 0.9000i 0.9200 + 0.9200i 0.9400 + 0.9400i 0.9600 + 0.9600i Columns 100 through 101 0.9800 + 0.9800i 1.0000 + 1.0000i d = 0

4   Pass
p=[1 1]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-1/2^.5)<.005)

Q = Columns 1 through 9 0.0000 + 3.0000i 0.0300 + 2.9700i 0.0600 + 2.9400i 0.0900 + 2.9100i 0.1200 + 2.8800i 0.1500 + 2.8500i 0.1800 + 2.8200i 0.2100 + 2.7900i 0.2400 + 2.7600i Columns 10 through 18 0.2700 + 2.7300i 0.3000 + 2.7000i 0.3300 + 2.6700i 0.3600 + 2.6400i 0.3900 + 2.6100i 0.4200 + 2.5800i 0.4500 + 2.5500i 0.4800 + 2.5200i 0.5100 + 2.4900i Columns 19 through 27 0.5400 + 2.4600i 0.5700 + 2.4300i 0.6000 + 2.4000i 0.6300 + 2.3700i 0.6600 + 2.3400i 0.6900 + 2.3100i 0.7200 + 2.2800i 0.7500 + 2.2500i 0.7800 + 2.2200i Columns 28 through 36 0.8100 + 2.1900i 0.8400 + 2.1600i 0.8700 + 2.1300i 0.9000 + 2.1000i 0.9300 + 2.0700i 0.9600 + 2.0400i 0.9900 + 2.0100i 1.0200 + 1.9800i 1.0500 + 1.9500i Columns 37 through 45 1.0800 + 1.9200i 1.1100 + 1.8900i 1.1400 + 1.8600i 1.1700 + 1.8300i 1.2000 + 1.8000i 1.2300 + 1.7700i 1.2600 + 1.7400i 1.2900 + 1.7100i 1.3200 + 1.6800i Columns 46 through 54 1.3500 + 1.6500i 1.3800 + 1.6200i 1.4100 + 1.5900i 1.4400 + 1.5600i 1.4700 + 1.5300i 1.5000 + 1.5000i 1.5300 + 1.4700i 1.5600 + 1.4400i 1.5900 + 1.4100i Columns 55 through 63 1.6200 + 1.3800i 1.6500 + 1.3500i 1.6800 + 1.3200i 1.7100 + 1.2900i 1.7400 + 1.2600i 1.7700 + 1.2300i 1.8000 + 1.2000i 1.8300 + 1.1700i 1.8600 + 1.1400i Columns 64 through 72 1.8900 + 1.1100i 1.9200 + 1.0800i 1.9500 + 1.0500i 1.9800 + 1.0200i 2.0100 + 0.9900i 2.0400 + 0.9600i 2.0700 + 0.9300i 2.1000 + 0.9000i 2.1300 + 0.8700i Columns 73 through 81 2.1600 + 0.8400i 2.1900 + 0.8100i 2.2200 + 0.7800i 2.2500 + 0.7500i 2.2800 + 0.7200i 2.3100 + 0.6900i 2.3400 + 0.6600i 2.3700 + 0.6300i 2.4000 + 0.6000i Columns 82 through 90 2.4300 + 0.5700i 2.4600 + 0.5400i 2.4900 + 0.5100i 2.5200 + 0.4800i 2.5500 + 0.4500i 2.5800 + 0.4200i 2.6100 + 0.3900i 2.6400 + 0.3600i 2.6700 + 0.3300i Columns 91 through 99 2.7000 + 0.3000i 2.7300 + 0.2700i 2.7600 + 0.2400i 2.7900 + 0.2100i 2.8200 + 0.1800i 2.8500 + 0.1500i 2.8800 + 0.1200i 2.9100 + 0.0900i 2.9400 + 0.0600i Columns 100 through 101 2.9700 + 0.0300i 3.0000 + 0.0000i d = 0.7071

5   Pass
p=[5 0]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-2)<.005)

Q = Columns 1 through 9 0.0000 + 3.0000i 0.0300 + 2.9700i 0.0600 + 2.9400i 0.0900 + 2.9100i 0.1200 + 2.8800i 0.1500 + 2.8500i 0.1800 + 2.8200i 0.2100 + 2.7900i 0.2400 + 2.7600i Columns 10 through 18 0.2700 + 2.7300i 0.3000 + 2.7000i 0.3300 + 2.6700i 0.3600 + 2.6400i 0.3900 + 2.6100i 0.4200 + 2.5800i 0.4500 + 2.5500i 0.4800 + 2.5200i 0.5100 + 2.4900i Columns 19 through 27 0.5400 + 2.4600i 0.5700 + 2.4300i 0.6000 + 2.4000i 0.6300 + 2.3700i 0.6600 + 2.3400i 0.6900 + 2.3100i 0.7200 + 2.2800i 0.7500 + 2.2500i 0.7800 + 2.2200i Columns 28 through 36 0.8100 + 2.1900i 0.8400 + 2.1600i 0.8700 + 2.1300i 0.9000 + 2.1000i 0.9300 + 2.0700i 0.9600 + 2.0400i 0.9900 + 2.0100i 1.0200 + 1.9800i 1.0500 + 1.9500i Columns 37 through 45 1.0800 + 1.9200i 1.1100 + 1.8900i 1.1400 + 1.8600i 1.1700 + 1.8300i 1.2000 + 1.8000i 1.2300 + 1.7700i 1.2600 + 1.7400i 1.2900 + 1.7100i 1.3200 + 1.6800i Columns 46 through 54 1.3500 + 1.6500i 1.3800 + 1.6200i 1.4100 + 1.5900i 1.4400 + 1.5600i 1.4700 + 1.5300i 1.5000 + 1.5000i 1.5300 + 1.4700i 1.5600 + 1.4400i 1.5900 + 1.4100i Columns 55 through 63 1.6200 + 1.3800i 1.6500 + 1.3500i 1.6800 + 1.3200i 1.7100 + 1.2900i 1.7400 + 1.2600i 1.7700 + 1.2300i 1.8000 + 1.2000i 1.8300 + 1.1700i 1.8600 + 1.1400i Columns 64 through 72 1.8900 + 1.1100i 1.9200 + 1.0800i 1.9500 + 1.0500i 1.9800 + 1.0200i 2.0100 + 0.9900i 2.0400 + 0.9600i 2.0700 + 0.9300i 2.1000 + 0.9000i 2.1300 + 0.8700i Columns 73 through 81 2.1600 + 0.8400i 2.1900 + 0.8100i 2.2200 + 0.7800i 2.2500 + 0.7500i 2.2800 + 0.7200i 2.3100 + 0.6900i 2.3400 + 0.6600i 2.3700 + 0.6300i 2.4000 + 0.6000i Columns 82 through 90 2.4300 + 0.5700i 2.4600 + 0.5400i 2.4900 + 0.5100i 2.5200 + 0.4800i 2.5500 + 0.4500i 2.5800 + 0.4200i 2.6100 + 0.3900i 2.6400 + 0.3600i 2.6700 + 0.3300i Columns 91 through 99 2.7000 + 0.3000i 2.7300 + 0.2700i 2.7600 + 0.2400i 2.7900 + 0.2100i 2.8200 + 0.1800i 2.8500 + 0.1500i 2.8800 + 0.1200i 2.9100 + 0.0900i 2.9400 + 0.0600i Columns 100 through 101 2.9700 + 0.0300i 3.0000 + 0.0000i d = 2

6   Pass
p=[0 6]; v=[0 3]; w=[3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)); assert(abs(d-3)<.005)

Q = Columns 1 through 9 0.0000 + 3.0000i 0.0300 + 2.9700i 0.0600 + 2.9400i 0.0900 + 2.9100i 0.1200 + 2.8800i 0.1500 + 2.8500i 0.1800 + 2.8200i 0.2100 + 2.7900i 0.2400 + 2.7600i Columns 10 through 18 0.2700 + 2.7300i 0.3000 + 2.7000i 0.3300 + 2.6700i 0.3600 + 2.6400i 0.3900 + 2.6100i 0.4200 + 2.5800i 0.4500 + 2.5500i 0.4800 + 2.5200i 0.5100 + 2.4900i Columns 19 through 27 0.5400 + 2.4600i 0.5700 + 2.4300i 0.6000 + 2.4000i 0.6300 + 2.3700i 0.6600 + 2.3400i 0.6900 + 2.3100i 0.7200 + 2.2800i 0.7500 + 2.2500i 0.7800 + 2.2200i Columns 28 through 36 0.8100 + 2.1900i 0.8400 + 2.1600i 0.8700 + 2.1300i 0.9000 + 2.1000i 0.9300 + 2.0700i 0.9600 + 2.0400i 0.9900 + 2.0100i 1.0200 + 1.9800i 1.0500 + 1.9500i Columns 37 through 45 1.0800 + 1.9200i 1.1100 + 1.8900i 1.1400 + 1.8600i 1.1700 + 1.8300i 1.2000 + 1.8000i 1.2300 + 1.7700i 1.2600 + 1.7400i 1.2900 + 1.7100i 1.3200 + 1.6800i Columns 46 through 54 1.3500 + 1.6500i 1.3800 + 1.6200i 1.4100 + 1.5900i 1.4400 + 1.5600i 1.4700 + 1.5300i 1.5000 + 1.5000i 1.5300 + 1.4700i 1.5600 + 1.4400i 1.5900 + 1.4100i Columns 55 through 63 1.6200 + 1.3800i 1.6500 + 1.3500i 1.6800 + 1.3200i 1.7100 + 1.2900i 1.7400 + 1.2600i 1.7700 + 1.2300i 1.8000 + 1.2000i 1.8300 + 1.1700i 1.8600 + 1.1400i Columns 64 through 72 1.8900 + 1.1100i 1.9200 + 1.0800i 1.9500 + 1.0500i 1.9800 + 1.0200i 2.0100 + 0.9900i 2.0400 + 0.9600i 2.0700 + 0.9300i 2.1000 + 0.9000i 2.1300 + 0.8700i Columns 73 through 81 2.1600 + 0.8400i 2.1900 + 0.8100i 2.2200 + 0.7800i 2.2500 + 0.7500i 2.2800 + 0.7200i 2.3100 + 0.6900i 2.3400 + 0.6600i 2.3700 + 0.6300i 2.4000 + 0.6000i Columns 82 through 90 2.4300 + 0.5700i 2.4600 + 0.5400i 2.4900 + 0.5100i 2.5200 + 0.4800i 2.5500 + 0.4500i 2.5800 + 0.4200i 2.6100 + 0.3900i 2.6400 + 0.3600i 2.6700 + 0.3300i Columns 91 through 99 2.7000 + 0.3000i 2.7300 + 0.2700i 2.7600 + 0.2400i 2.7900 + 0.2100i 2.8200 + 0.1800i 2.8500 + 0.1500i 2.8800 + 0.1200i 2.9100 + 0.0900i 2.9400 + 0.0600i Columns 100 through 101 2.9700 + 0.0300i 3.0000 + 0.0000i d = 3

7   Pass
p=[-4 0]; v=[0 3]; w=[-3 0]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)) assert(abs(d-1)<.005)

Q = Columns 1 through 9 0.0000 + 3.0000i -0.0300 + 2.9700i -0.0600 + 2.9400i -0.0900 + 2.9100i -0.1200 + 2.8800i -0.1500 + 2.8500i -0.1800 + 2.8200i -0.2100 + 2.7900i -0.2400 + 2.7600i Columns 10 through 18 -0.2700 + 2.7300i -0.3000 + 2.7000i -0.3300 + 2.6700i -0.3600 + 2.6400i -0.3900 + 2.6100i -0.4200 + 2.5800i -0.4500 + 2.5500i -0.4800 + 2.5200i -0.5100 + 2.4900i Columns 19 through 27 -0.5400 + 2.4600i -0.5700 + 2.4300i -0.6000 + 2.4000i -0.6300 + 2.3700i -0.6600 + 2.3400i -0.6900 + 2.3100i -0.7200 + 2.2800i -0.7500 + 2.2500i -0.7800 + 2.2200i Columns 28 through 36 -0.8100 + 2.1900i -0.8400 + 2.1600i -0.8700 + 2.1300i -0.9000 + 2.1000i -0.9300 + 2.0700i -0.9600 + 2.0400i -0.9900 + 2.0100i -1.0200 + 1.9800i -1.0500 + 1.9500i Columns 37 through 45 -1.0800 + 1.9200i -1.1100 + 1.8900i -1.1400 + 1.8600i -1.1700 + 1.8300i -1.2000 + 1.8000i -1.2300 + 1.7700i -1.2600 + 1.7400i -1.2900 + 1.7100i -1.3200 + 1.6800i Columns 46 through 54 -1.3500 + 1.6500i -1.3800 + 1.6200i -1.4100 + 1.5900i -1.4400 + 1.5600i -1.4700 + 1.5300i -1.5000 + 1.5000i -1.5300 + 1.4700i -1.5600 + 1.4400i -1.5900 + 1.4100i Columns 55 through 63 -1.6200 + 1.3800i -1.6500 + 1.3500i -1.6800 + 1.3200i -1.7100 + 1.2900i -1.7400 + 1.2600i -1.7700 + 1.2300i -1.8000 + 1.2000i -1.8300 + 1.1700i -1.8600 + 1.1400i Columns 64 through 72 -1.8900 + 1.1100i -1.9200 + 1.0800i -1.9500 + 1.0500i -1.9800 + 1.0200i -2.0100 + 0.9900i -2.0400 + 0.9600i -2.0700 + 0.9300i -2.1000 + 0.9000i -2.1300 + 0.8700i Columns 73 through 81 -2.1600 + 0.8400i -2.1900 + 0.8100i -2.2200 + 0.7800i -2.2500 + 0.7500i -2.2800 + 0.7200i -2.3100 + 0.6900i -2.3400 + 0.6600i -2.3700 + 0.6300i -2.4000 + 0.6000i Columns 82 through 90 -2.4300 + 0.5700i -2.4600 + 0.5400i -2.4900 + 0.5100i -2.5200 + 0.4800i -2.5500 + 0.4500i -2.5800 + 0.4200i -2.6100 + 0.3900i -2.6400 + 0.3600i -2.6700 + 0.3300i Columns 91 through 99 -2.7000 + 0.3000i -2.7300 + 0.2700i -2.7600 + 0.2400i -2.7900 + 0.2100i -2.8200 + 0.1800i -2.8500 + 0.1500i -2.8800 + 0.1200i -2.9100 + 0.0900i -2.9400 + 0.0600i Columns 100 through 101 -2.9700 + 0.0300i -3.0000 + 0.0000i d = 1 d = 1

8   Pass
p=[1 0]; v=[1.01 0]; w=[5 5]; d=distP2S(p(1),p(2),v(1),v(2),w(1),w(2)) assert(abs(d-.01)<.005)

Q = Columns 1 through 9 1.0100 + 0.0000i 1.0499 + 0.0500i 1.0898 + 0.1000i 1.1297 + 0.1500i 1.1696 + 0.2000i 1.2095 + 0.2500i 1.2494 + 0.3000i 1.2893 + 0.3500i 1.3292 + 0.4000i Columns 10 through 18 1.3691 + 0.4500i 1.4090 + 0.5000i 1.4489 + 0.5500i 1.4888 + 0.6000i 1.5287 + 0.6500i 1.5686 + 0.7000i 1.6085 + 0.7500i 1.6484 + 0.8000i 1.6883 + 0.8500i Columns 19 through 27 1.7282 + 0.9000i 1.7681 + 0.9500i 1.8080 + 1.0000i 1.8479 + 1.0500i 1.8878 + 1.1000i 1.9277 + 1.1500i 1.9676 + 1.2000i 2.0075 + 1.2500i 2.0474 + 1.3000i Columns 28 through 36 2.0873 + 1.3500i 2.1272 + 1.4000i 2.1671 + 1.4500i 2.2070 + 1.5000i 2.2469 + 1.5500i 2.2868 + 1.6000i 2.3267 + 1.6500i 2.3666 + 1.7000i 2.4065 + 1.7500i Columns 37 through 45 2.4464 + 1.8000i 2.4863 + 1.8500i 2.5262 + 1.9000i 2.5661 + 1.9500i 2.6060 + 2.0000i 2.6459 + 2.0500i 2.6858 + 2.1000i 2.7257 + 2.1500i 2.7656 + 2.2000i Columns 46 through 54 2.8055 + 2.2500i 2.8454 + 2.3000i 2.8853 + 2.3500i 2.9252 + 2.4000i 2.9651 + 2.4500i 3.0050 + 2.5000i 3.0449 + 2.5500i 3.0848 + 2.6000i 3.1247 + 2.6500i Columns 55 through 63 3.1646 + 2.7000i 3.2045 + 2.7500i 3.2444 + 2.8000i 3.2843 + 2.8500i 3.3242 + 2.9000i 3.3641 + 2.9500i 3.4040 + 3.0000i 3.4439 + 3.0500i 3.4838 + 3.1000i Columns 64 through 72 3.5237 + 3.1500i 3.5636 + 3.2000i 3.6035 + 3.2500i 3.6434 + 3.3000i 3.6833 + 3.3500i 3.7232 + 3.4000i 3.7631 + 3.4500i 3.8030 + 3.5000i 3.8429 + 3.5500i Columns 73 through 81 3.8828 + 3.6000i 3.9227 + 3.6500i 3.9626 + 3.7000i 4.0025 + 3.7500i 4.0424 + 3.8000i 4.0823 + 3.8500i 4.1222 + 3.9000i 4.1621 + 3.9500i 4.2020 + 4.0000i Columns 82 through 90 4.2419 + 4.0500i 4.2818 + 4.1000i 4.3217 + 4.1500i 4.3616 + 4.2000i 4.4015 + 4.2500i 4.4414 + 4.3000i 4.4813 + 4.3500i 4.5212 + 4.4000i 4.5611 + 4.4500i Columns 91 through 99 4.6010 + 4.5000i 4.6409 + 4.5500i 4.6808 + 4.6000i 4.7207 + 4.6500i 4.7606 + 4.7000i 4.8005 + 4.7500i 4.8404 + 4.8000i 4.8803 + 4.8500i 4.9202 + 4.9000i Columns 100 through 101 4.9601 + 4.9500i 5.0000 + 5.0000i d = 0.0100 d = 0.0100