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
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 =
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
.
No
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 =
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
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 =
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)-g
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 =
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 ensure
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 =
C.8 Solutions for Tasks from Chapter 8
439
9
dt = pi/10;
t = 0.0:dt:10.0*pi;
y = zeros(size(t);
y(1) = 0;
for ii=1:(length(t)-1)
y(ii+1) = y(ii) + dt * (sin(t(ii)+sin(y(ii);
end
8
This produces the re
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
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 ). U
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
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 ad
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)-
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*one
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)
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]
weight
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 x
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
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
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. Ther
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 TestCas