Skip to content
PostNumerical Computation / Assignment

Numerical-Computation-As-1

2025-10-01
Back to Blog

Numerical Computation Assignment 1

1. Find the binary representation of the base 10 numbers.

  • (a) 64=10000002
  • (b) 3164=(1+2+4+8+16)×26=0.0111112
  • (c) 55.4
    • Integer part 5510=1101112
    • Fractional part 0.410=0.011
      • 0.4×2=0.8bit 0
      • 0.8×2=1.6bit 1
      • 0.6×2=1.2bit 1
      • 0.2×2=0.4 (cycle repeats: 011)
    • 55.4=110111.011

2. Convert the following binary numbers to base 10.

  • (a) 10101012=20+22+24+26=85
  • (b) 1011.1012=20+21+23+21+23=11.625
  • (c) 1010.01
    • Integer part 1010=21+23=10
    • let x=0.01, then 22×x=1.01, so 22xx=1,x=13
    • 1010.012=313

3. Explain how to most accurately compute the two roots of the equation x2+bx1012=0, where b is a number greater than 100.

The standard quadratic formula gives two roots:

x=b±b2+410122

Calculate the numerically stable root (the one with the large magnitude) using the standard formula. This involves an addition of like-signed numbers, which is stable.

x2=bb2+410122b

Use Vieta's formula for the product of roots

x1x2=ca=1012$$$$x1=1012b

4. Evaluate the quantity xx2+2x2 where x=1012, correct to at least 3 decimal places.

(xx2+2x2)×xx2+2+x2xx2+2+x2

This simplifies to a numerically stable form:

2x2xx2+2+x2=21+2/x2+1

Now, substitute x=1012:

21+2/1024+11

Correct to at least 3 decimal places, the answer is 1.000.

5. Find the rates of convergence of the following sequences as n.

  • (a) limnnsin1n2=0

For xn=nsin1n2

We use the Taylor series approximation sin(u)u for small u. Letting u=1/n2:

xn=nsin(1n2)n(1n2)=1n

The rate of convergence is O(1n).

  • (b) limn[n+3n]=0

For xn=n+3n

We multiply by the conjugate to simplify the expression:

xn=(n+3n)n+3+nn+3+n=3n+3+n

For large n, the denominator n+3+n is approximately 2n. So,xn32n

The rate of convergence is O(1n)

6. Let f(x)=x23, find c satisfying the Mean Value Theorem for f(x) on the interval [1,3].

The Mean Value Theorem states that if a function f(x) is continuous on a closed interval [a,b] and differentiable on the open interval (a,b), then there exists at least one number c in (a,b) such that:

f(c)=f(b)f(a)ba

Here, we are given:

  • The function f(x)=x23

  • The interval [a,b]=[1,3]

  • f(a)=f(1)=(1)23=2

  • f(b)=f(3)=(3)23=6

Now, plug these values into the formula:

f(b)f(a)ba=f(3)f(1)31=6(2)2=82=4
  • f(x)=2x

Now, evaluate the derivative at x=c:

  • f(c)=2c

  • c=2

The value c=2 is indeed between 1 and 3.

Thus, the value of c that satisfies the Mean Value Theorem for f(x)=x23 on the interval [1,3] is 2.

7. Let f(x)=x, g(x)=ex, find c satisfying the Mean Value Theorem for integrals with f(x), g(x) in the interval [0,1].

To find c satisfying the Mean Value Theorem for integrals with f(x)=x and g(x)=ex on the interval [0,1], we use the Weighted Mean Value Theorem for Integrals. This theorem states that if f and g are continuous on [a,b] and g(x) does not change sign on [a,b], there exists a c[a,b] such that:

abf(x)g(x)dx=f(c)abg(x)dx

For f(x)=x, g(x)=ex, and interval [0,1], the theorem gives:

01xexdx=c01exdx

The integral of ex is ex. Evaluating from 0 to 1:

01exdx=ex|01=e1e0=e1

Use integration by parts with u=x, dv=exdx. Then du=dx, v=ex. By integration by parts:

xexdx=uvvdu=xexexdx=xexex+C

Evaluating from 0 to 1:

01xexdx=(xexex)|01=((1e1e1)(0e0e0))=(0(1))=1

Substitute the integrals into the theorem:

1=c(e1)

Solving for c:

c=1e1

8. Find the Taylor series generated by f(x)=1x about x=2.

Of course. We can find the Taylor series for f(x)=1x about x=2 using the definition of a Taylor series.

The formula for a Taylor series generated by a function f(x) about x=a is:

f(x)=n=0f(n)(a)n!(xa)n

In our case, f(x)=1x and the center is a=2.

We need to find a pattern for the nth derivative, f(n)(x).

  • f(x)=x1

  • f(x)=1x2

  • f(x)=(1)(2)x3=2!x3

  • f(x)=(2!)(3)x4=3!x4

  • f(4)(x)=(3!)(4)x5=4!x5

Observing the pattern, the nth derivative is:

f(n)(x)=(1)nn!x(n+1)=(1)nn!xn+1

Substitute x=2 into the general formula for the nth derivative.

  • f(2)=12

  • f(2)=122=14

  • f(2)=2!23=28=14

  • f(2)=3!24=616=38

The general term for the nth derivative evaluated at a=2 is:

f(n)(2)=(1)nn!2n+1

So the series is:

1x=1214(x2)+18(x2)2116(x2)3+

9. Find the degree 4 Taylor polynomial P4(x) for f(x)=sinx centered at the point x=0. Estimate the maximum possible error when using P4(x) to estimate sinx for |x|0.0001.

The formula for the n-th degree Taylor polynomial of a function f(x) centered at x=a is:

Pn(x)=f(a)+f(a)1!(xa)+f(a)2!(xa)2++f(n)(a)n!(xa)n

  • f(x)=sinxf(0)=sin(0)=0

  • f(x)=cosxf(0)=cos(0)=1

  • f(x)=sinxf(0)=sin(0)=0

  • f(x)=cosxf(0)=cos(0)=1

  • f(4)(x)=sinxf(4)(0)=sin(0)=0

Now, substitute these values into the Taylor polynomial formula:

P4(x)=f(0)+f(0)1!x+f(0)2!x2+f(0)3!x3+f(4)(0)4!x4=0+11!x+02!x2+13!x3+04!x4P4(x)=x16x3

The degree 4 Taylor polynomial for f(x)=sinx centered at x=0 is:

P4(x)=xx36

The formula for the Lagrange Remainder is:

Rn(x)=f(n+1)(ξ(x))(n+1)!(xx0)n+1

where ξ(x) is a value between the center x0 and the point x.

In our problem, the parameters are:

  • Function: f(x)=sinx

  • Polynomial degree: n=4

  • Center: x0=0

  • Interval for estimation: |x|0.0001

We are finding the remainder for the degree 4 polynomial, P4(x), which is denoted as R4(x). We substitute n=4 and x0=0 into the formula:

R4(x)=f(4+1)(ξ(x))(4+1)!(x0)4+1=f(5)(ξ(x))5!x5

We need to calculate the 5th derivative of f(x)=sinx, which is f(5)(x).

  • f(x)=cosx

  • f(x)=sinx

  • f(x)=cosx

  • f(4)(x)=sinx

  • f(5)(x)=cosx

Now, substitute this derivative back into the expression for the remainder:

R4(x)=cos(ξ(x))5!x5

The error is the absolute value of the remainder, |R4(x)|. We need to find its maximum possible value on the interval |x|0.0001.

|R4(x)|=|cos(ξ(x))5!x5|=|cos(ξ(x))||x|55!

To maximize this expression, we find the maximum value of each component in the numerator:

  1. Bound for |cos(ξ(x))|:

By definition, ξ(x) is between x0=0 and x. Since |x|0.0001, ξ(x) must be within the interval [0.0001,0.0001]. We know that for any real number z, the maximum value of |cos(z)| is 1. Therefore, we can use 1 as an upper bound for this term.

max|cos(ξ(x))|1

  1. Bound for |x|5:

On the given interval |x|0.0001, the maximum value of |x|5 occurs at the endpoints, x=±0.0001.

max|x|5=(0.0001)5=(104)5=1020

  1. (n+1)!=5×4×3×2×1=120

Maximum Error max|cos(ξ(x))|max|x|55!

Maximum Error 11020120

The maximum possible error when using P4(x) to estimate sinx for |x|0.0001 is 1020120.