Assignment Maths and Computational Methods 2012
Assignment Maths and Computational Methods 2012
Omar user
3/28/2012
b0
b1
b2
b3
b4
=
=
=
=
=
y;
[DD(1,3),DD(2,3),DD(3,3),DD(4,3),DD(5,3)];
[DD(1,4),DD(2,4),DD(3,4),DD(4,4),DD(5,4)];
[DD(1,5),DD(2,5),DD(3,5),DD(4,5),DD(5,5)];
[DD(1,6),DD(2,6),DD(3,6),DD(4,6),DD(5,6)];
b) Inserting the arrays below into the top of the previous script yields the following results on
Matlab.
Plotting the given function values
indicate the function could be even
due to the symmetry in the y axis.
Inserting the arrays below into the top of the previous script yields the following results on
Matlab.
% x and y values put into an array for each variable.
x = [-0.5,-1/6,0,1/6,0.5];
y = [2,1,0,1,2];
x1 = (1/3);
Result:
The extrapolation is not accurate as opposed to interpolating, as the solution lies outside the interval
used in the interpolation. This can cause large errors and give inaccurate solutions.
2.
a) Bisection method:
( )
X(a)
-1.5708
-1.5708
-0.7854
-0.7854
-0.7854
-0.68722
X(b)
1.5708
0
0
-0.393
-0.589
-0.589
f(Xa)
-1.141593
-1.141593
-0.156583
-0.156583
-0.156583
-0.016641
f(Xb)
3.141593
1
1
0.413514
0.125249
0.125249
(Xa+Xb)/2
X(m)
0
-0.7854
-0.3927
-0.58905
-0.68722
-0.63814
f(Xm)
1
-0.1565828
0.4135142
0.1252494
-0.0166411
0.0540834
b) Newton Raphson:
For epsilon = 0.1
Initial approximation
2(X(0))+1-tan(0.5*X(0))
X(0)
f(X(0)
f'(X(0))
-1.5708 -1.142
1
-0.4292 0.3596 1.4762471
-0.67276 0.0041 1.4388656
2-0.5*(1/sec^2(0.5*X(0)))
X imp
-0.429
-0.673
-0.676
Ximp=X(0)-(f(X(0))/f(X(0))
X(0)
-1.571
-1.000
-0.773
-0.704
-0.684
-0.678
X imp
-1.000
-0.773
-0.704
-0.684
-0.678
-0.676
X imp -X(0)
0.5707963
0.2268488
0.0696225
0.0200141
0.005657
0.0015916
dg/dx
0.25
0.25
0.25
0.25
0.25
0.25
( ( ) ( )) ( ( ))
( ( )) ( ( ))
X(b)-X(a) ROOT x
3.141593
-0.733
1.570796
-0.733
0.785398
-0.679
0.392699
-0.678
0.19635
-0.676
0.098175
-0.676
3.
a)
( )
( )
( )
b) Linear relationship:
((
N(t)
10
18
30
42
70
120
205
333
550
880
N(t)
2258
( ) ( ( ))
((
Therefore:
ln(N(t))
2.30
2.89
3.40
3.74
4.25
4.79
5.32
5.81
6.31
6.78
ln(N(t))
45.59
( )
( ) )
t(h)^2
0
1
4
9
16
25
36
49
64
81
t(h)^2
285
( )) )
( ( ))))
t(h)ln(N(t))
0.00
2.89
6.80
11.21
16.99
23.94
31.94
40.66
50.48
61.02
t(h)ln(N(t))
245.93
t(h)
0
1
2
3
4
5
6
7
8
9
N(t)
10.00
16.39
26.88
44.06
72.23
118.41
194.12
318.24
521.72
855.30
Plot of results
c)
The scenario makes sense as N (number of bacteria) stays almost constant or changes very little
after certain period of time. The graph below supports this where the constant A has been taken to
be 1.
Expressing
as partial fractions:
When
( )
:
(
When
( )
:
(
( )
Integrating:
)
( )
( )
( )
( )
a)
Rearranging for
( )
(
(
4.
)
( )
( )
(
)
:
( )
Expressing h in terms of M:
( )
(
)
)
(
290
280
270
T(i,N)
260
250
240
230
220
210
200
0.02
0.04
0.06
0.08
0.1
xi
Comparison of 3 values of M:
In terms of convergence M=10 converged the fastest to the initial temperature 300,
followed by M=20 and M=40 for a time difference equal to 1.14s (dt=0.14s).
As M is increases from the above graph it can be seen that temperature profile becomes
smoother along the length of the beam.