Sie sind auf Seite 1von 11

CSC 302 Introduction to Numerical Methods

Homework #1
Question 1.
Why do the following functions not possess Taylor series expansions at x=0?

(a) f (x) = x.
(b) f (x) = |x|.
(c) f (x) = arcsin(x 1).
(d) f (x) = cot(x).
(e) f (x) = log x.
(f) f (x) = x .

Answer:
(a) f (x) =

x.

The first derivative is unbounded.


f (x) = x1/2 ,

f (x) =

f (0) = 0;

1 1/2
x
,
2

f (0) = .

(b) f (x) = |x|.


The first derivative is not continuous.
f (x) = |x|;

f (x) =

(c) f (x) = arcsin(x 1).

1
x>0
undefined x = 0

1
x<0

The first derivative is unbounded.


f (x) = arcsin(x 1),
1
f (x) = p
,
1 (x 1)2

f (0) = /2
f (0) =

(d) f (x) = cot(x).


The function is undefined at x = 0.
f (x) = cot x,

f (0) = undefined.

(e) f (x) = log x.


The function is not defined at x = 0.
f (x) = log(x),

f (0) =

(f) f (x) = x .
The 4th derivative in unbounded.
f (x) = x ,

f (0) = 0;

f (x) = x1 ,
f = ( 1)x2 ,

f (0) = 0;
f (0) = 0;

f = ( 1)( 2)x3 ,

f (0) = 0;

f iv = ( 1)( 2)( 3)x4 ,

f iv (0) = ;

Question 2.
Determine how many terms are needed to compute e correctly to 15 decimal places(rounded) using the
Taylor series expansion for ex .

Answer:
ex = 1 + x +

x3
xn1
xn (n)
x2
+
+ +
+
f ().
2!
3!
(n 1)!
n!

By Taylors theorem, if we stop at 1/(n 1)! the error is


xn e /n! = e /n! where 0 < < 1. So we require
e
1
< 1015 .
n!
2
This implies that
log e log n! < log
n = 17 :
n = 18 :

1
15 or 15 + log(2e) < log n!
2

15.74 6< 14.55

15.74 < 15.81.

Thus 18 terms are required.

Question 3.
What is the series for ln(1 x)?
What is the series for ln[(1 + x)/(1 x)]?

Answer:
ln(1 + x) = x

x3
x4
x2
+

+
2
3
4

ln(1 x) = x
ln

1+x
1x

x2
x3
x4


2
3
4



x3
x5
= ln(1 + x) ln(1 x) = 2 x +
+
+
3
5
=2

X
x2k1
.
2k 1
k=1

Question 4.
In the series for ln[(1 + x)/(1 x)], determine the value of x to use if we wish to compute ln 2. Estimate the
number of terms needed for ten digits (rounded) of accuracy. Is this method practical?

Answer:


1+x
1x

= 2 = (1 + x) = 2(1 x) = x = 1/3.



35
37
33
1
+
+
+ 0.69313 (4 terms)
ln 2 = 2 3 +
3
5
7
Yes. If we take 10 terms and denote the error by E, then


35
319
33
+E
+
+ +
ln 2 = 2 31 +
3
5
19



321
323
325
E=2
+
+
+
21
23
25
#
"
 2
1
1
2 21
+
3
1+ +
<
20
9
9

2 21
1
3
1.08 1011 .
20
1 1/9

Question 5.
What is the Maclaurin series for the function
f (x) = 3 + 7x 1.33x2 + 19.2x4
What is the Taylor series for this function about c = 2?

Answer:
Maclaurin series:
f (x) = f (0) + xf (0) +
= 3 + x(7) +

x2
x3
f (0) + f (0) +
2!
3!

x3
x4
x2
(2.66) (0) + (460.8)
2!
3!
4!

= 3 + 7x 1.33x2 + 19.2x4
f (x) = 3 + 7x 1.33x2 + 19.2x4
What is the Taylor series for this function about c = 2?
With c = 2:
f (c) = f (2) =

f (c) = f (2) =
f (c) = f (2) =
f (c) = f (2) =
f iv (c) = f iv (2) =

3 + 7(2) 1.33(4) + 19.2(16) = 318.88

7 2.66(2) + 76.8(8) = 616.08


2.66 + 230.4(4) = 918.94
460.8(2) = 921.6
460.8

f (x) = 318.88 + (x 2)616.08 +

(x 2)2
(x 2)3
(x 2)4
918.94 +
921.6 +
460.8
2!
3!
4!

Question 6.
In the Taylor series (about /4) for the function sin x + cos x, find the third nonzero term.

Answer:

f (x) = sin x + cos x

f (/4) = 2/ 2

f (x) = cos x sin x

f (/4) = 0

f (x) = sin x cos x

f (x) = cos x + sin x

f (4) (x) = sin x + cos x

f (x)

Third term:

f (/4) = 2/ 2

f (/4) = 0

f (4) (/4) = 2/ 2





2
2 
2 
1
1
2
4

+
+
x
x
4
24
4
2 2
2
2



1 
2
4
1 
=
2 1
x
x
+
]
2!
4
4!
4
=


4
2
x
4!
4

Question 7.
Using the Taylor series expansion in terms of h, determine the first three terms in the series for esin(x+h) .

Answer:

f (x)
f (x)
f (x)

esin(x+h)

= esin x
= (cos x)esin x
= (cos2 x)esin x (sin x)esin x

h2
= esin x + h(cos x)esin x + (cos2 x sin x)esin x +
2


h2
sin x
1 + h cos x + (cos2 x sin x)
= e
2

Question 8.
Convert the following numbers:
(a) (100 101 101)2 = ( )8 = (

)10 .

(b) (011 110 001.100)2 = ( )8 = (

)10

Answer:
(a) (100 101 101)2 = (455)8 = 5 + 5 8 + 4 82 = (301)10 .

(b) (011 110 001.100)2 = (361.4)8 = 4/8 + 1 + 6 8 + 3 82 = (241.5)10

Question 9.
Determine the machine representation in single precision on a 32-bit word-length computer for the decimal
number 64.015625.

Answer:

64.015625
(64)10
(0.015625)10

=
=

(64.015625)10 =
e 127 =
e =

(100)8 = (1000000)2
(0.01)8 = (0.000001)2
(1000000.000001)2 = 1.000000000001 26
6
127 + 6 = (133)10 = (205)8 = (10000101)2

So we have:
[01000010100000000000100000000000]2 = [42800800]16

10

Question 10.
Determine the decimal number that has the machine representation: [C705A700]

Answer:

[C705A700]16
stored exponent:
So, 142 127 = 15

= [11000111000001011010011100000000]2
(10001110)2 = (216)8 = 142

(1.00001011010011100000000)2 215

= (1000010110100111)2

= (102647)8 = 34215 = 3.4215 104

11

Das könnte Ihnen auch gefallen