10BaseT
Hub
NCM
100 m (330 ft) Maximum
10 BaseT
Building
Backbone
10 Base2
Hub
10 Base2
185 m (607 ft) Maximum
T
NCM
10Base2
T
Hub
10 Base2
185 m (607 ft) Maximum
NCM
10B.T
Hub
NCM
10 BaseT
100 m (330 ft) Maximum
10BaseFL
Fiber Optic Ethernet Transceiver
C.8 Solutions for Tasks from Chapter 8
441
9
clear all
dt = 1/3;
t = 0.0:dt:1;
y = zeros(size(t);
y(1) = 0;
for ii = 1:(length(t)-1)
y(ii+1) = 1/(1+dt/3)*(y(ii)-dt*t(ii+1)/2);
end
ts = t; ys = y;
dt = 1/1000;
t = 0.0:dt:1;
y = zeros(size(t);
y(1) = 0;
for
440
C. Solutions to Tasks
Now integrating the right hand side by parts gives
yet/3 = A
yet/3 = A
3 t/3
3 t/3
te
e dt ,
2
2
3 t/3 9 t/3
.
te e
2
2
Hence we have the solution
9
3
t
2
2
y = Aet/3
.
Now applying the boundary condition gives A = 9/2. The so
438
C. Solutions to Tasks
which can be rearranged to give
yn+1 = yn + t tn yn = yn 1 + nt2 ,
where we have used the fact that tn = nt.
Let us consider the rst case. Start with n = 0
y1 = 1
and now n = 1, etc.
17
1
=
,
16
16
2
153
17
y3 =
1+
=
,
16
16
128
C.8 Solutions for Tasks from Chapter 8
437
This produces
1
0.95
0.9
0.85
0.8
0.75
0.7
0.65
0.6
0.55
0.5
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Notice that although this solution is reasonable it can be improved by reducing
the value of dt.
Solution 8.2 L
436
C. Solutions to Tasks
and then use the code quad(fxlnx,1,2). This gives 0.63629536463993 (using format long). The exact value can be calculated using integration by parts
2
1 2
q ln q
q ln q dq =
2
x=1
= 2 ln 2
2
2
x=1
q
dq
2
x=1
2 2
q
4
x=1
3
= 2 ln
434
C. Solutions to Tasks
9
theta = 0:pi/20:(pi/2-pi/20);
N = 20;
for it = 1:length(theta);
theta1 = theta(it);
clear grid f
grid = linspace(theta1,pi-theta1,N);
f = sqrt(1+cos(grid).2);
h = grid(2)-grid(1);
arclen(it) = (sum(f)-f(1)/2-f(N)/2)*h;
end
plot
C.7 Solutions for Tasks from Chapter 7
435
rst two terms in its Taylor series).
1
0
x1/2
x3/2
x5/2
= 2
dx = 2x1/2
2
5
1/2
5/2
5
.
We can now use the code
9
clear all
epsil = input(Epsilon :);
int1 = 2*epsil(0.5)-epsil(2.5)/5;
N = 100;
x = linspace(epsil,
C.7 Solutions for Tasks from Chapter 7
433
9
6
X = input(Truncate at:);
N = ceil(X)*3;
x = linspace(0,X,N);
h = x(2)-x(1);
f = 1./sqrt(x.2+1);
int = (sum(f)-f(1)/2-f(N)/2)*h
8
7
The second line ensures that the step sizes will be smaller than 1/3. This gi
432
C. Solutions to Tasks
3
5
x 10
4.5
4
3.5
3
2.5
2
1.5
1
0.5
0
5
10
15
20
where we have plotted the errors versus the number of points. We have used the
exact answer which is
sin x dx = [ cos x]0 = 2.
0
As we can see the errors tend to zero very rapidly
C.8 Solutions for Tasks from Chapter 8
443
9
N = 20;
t = linspace(0,2,N);
dt = t(2)-t(1);
y(1) = 1;
for j = 1:(N-1)
y(j+1) = y(j)+dt*(-y(j)+t(j)2);
end
ex = t.2-2*t+2-exp(-t);
8
This gives:
6
7
2
1.5
1
0.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
which is a
C.8 Solutions for Tasks from Chapter 8
451
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.5
1
1.5
2
2.5
3
3.5
Solution 8.11 This system can be written as
0 1 0
y = 0 0 1 y,
2 1 2
where y = (y, y , y ). Using MATLAB we nd that
4
4.5
5
450
C. Solutions to Tasks
0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Solution 8.10 This equation can be integrated directly by dividing through by
y(t2 + 1). This gives
2t
y
=
y
1 + t2
so that
1
.
1 + t2
The equation can be so
C.8 Solutions for Tasks from Chapter 8
449
4.5
4
3.5
3
2.5
2
1.5
1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
(the solution is expressible in terms of Airy functions, but this does not represent a great advantage to us).
This second problem can be solved by se
448
C. Solutions to Tasks
This gives
0.2
0.18
0.16
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
The numerical solution does reasonably initially: however as t increases the
solution diverges.
Solution 8.9 This equation can b
C.8 Solutions for Tasks from Chapter 8
447
which yields
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Solution 8.8 The exact solution here is
y(t) =
1
3
1
t sin 3t .
3
By discretising the equation we have
yn+1 = 2yn yn1 +
446
C. Solutions to Tasks
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0
0.1
0.2
0.3
0.4
3. The solution here is
y(x) =
0.5
0.6
e2x 1
.
e2 1
0.7
9
% Set up system
x = 0.0:0.1:1.0;
N = length(x);
h = x(2)-x(1);
a = (1/h2+2/(2*h)*ones(size(x);
b = -2/h2*ones(si
C.8 Solutions for Tasks from Chapter 8
445
2. The analytic solution here is:
y(x) = 2 sin x x cos x x 2 sin 1 + cos 1 + 1.
9
% Set up system
x = 0.0:0.1:1.0;
N = length(x);
h = x(2)-x(1);
a = 1/h2*ones(size(x);
b = -2/h2*ones(size(x);
c = 1/h2*ones(size(x
444
C. Solutions to Tasks
9
% Set up system
x = 0.0:0.1:1.0;
N = length(x);
h = x(2)-x(1);
a = 1/h2*ones(size(x);
b = -2/h2*ones(size(x);
c = 1/h2*ones(size(x);
r = x.*cos(x);
a(1) = 0; b(1) = 1; r(1) = 1;
c(N) = 0; b(N) = 1; r(N) = 0;
% Forward sweep
for
430
C. Solutions to Tasks
and for the three eighths rule with N = 10 we have
m=(N-1)/3 gives 3
rdiff=3*(1:(m-1)+1 gives [3*(1:2)+1] that is [4 7]
weights=3*ones(1,N) gives [3 3 3 3 3 3 3 3 3 3]
weights(1) gives [1 3 3 3 3 3 3 3 3 3]
weights(N) gives [1 3
416
C. Solutions to Tasks
Solution 5.7 Here we shall use the method of least squares. As such we shall
produce details of the formulation. We calculate the sum of the squares of the
errors:
n
(a sin xi + b cos xi fi )2
e=
i=1
and partially dierentiating w
414
C. Solutions to Tasks
C.5 Solutions for Tasks from Chapter 5
Solution 5.1 This code inputs four values which represent the points (x1 , y1 )
and (x2 , y2 ). These are then made into vectors x and y, where the former contains the x coordinates and the
C.5 Solutions for Tasks from Chapter 5
415
0 and ). The value of c can be determined from the condition that the curve
goes through the nal point which gives
y=
4x
( x).
2
Solution 5.5 Since the cubic is zero at the points 0 and we know that it is of
the
C.4 Solutions for Tasks from Chapter 4
413
Solution 4.13 This can be done using the code
function [f]=func1(x)
f = x.*sin(x)+cos(x);
and then use the code fzero(ff,3) which gives the root 2.7984. There are
many others. For the other cases the roots are: s
import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class TestQuiz2 extends TestCase cfw_ int [][] A1 = cfw_7, 9, 11, cfw_3, 5, 7; double