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)×2−6=0.0111112
  • (c) 55.4
    • Integer part 5510=1101112
    • Fractional part 0.410=0.011―
      • 0.4×2=0.8→bit 0
      • 0.8×2=1.6→bit 1
      • 0.6×2=1.2→bit 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+2−1+2−3=11.625
  • (c) 1010.01―
    • Integer part 1010=21+23=10
    • let x=0.01―, then 22×x=1.01―, so 22x−x=1,x=13
    • 1010.01―2=313

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

The standard quadratic formula gives two roots:

x=−b±b2+4⋅10−122

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=−b−b2+4⋅10−122≈−b

Use Vieta's formula for the product of roots

x1⋅x2=ca=−10−12$$$$x1=10−12b

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

(xx2+2−x2)×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+1≈1

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) limn→∞nsin⁡1n2=0

For xn=nsin⁡1n2

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+3−n]=0

For xn=n+3−n

We multiply by the conjugate to simplify the expression:

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

For large n, the denominator n+3+n is approximately 2n. So,xn≈32n

The rate of convergence is O(1n)

6. Let f(x)=x2−3, 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)b−a

Here, we are given:

  • The function f(x)=x2−3

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

  • f(a)=f(1)=(1)2−3=−2

  • f(b)=f(3)=(3)2−3=6

Now, plug these values into the formula:

f(b)−f(a)b−a=f(3)−f(1)3−1=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)=x2−3 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=c∫01exdx

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

∫01exdx=ex|01=e1−e0=e−1

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

∫xexdx=uv−∫vdu=xex−∫exdx=xex−ex+C

Evaluating from 0 to 1:

∫01xexdx=(xex−ex)|01=((1⋅e1−e1)−(0⋅e0−e0))=(0−(−1))=1

Substitute the integrals into the theorem:

1=c(e−1)

Solving for c:

c=1e−1

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=0∞f(n)(a)n!(x−a)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)=x−1

  • f′(x)=−1⋅x−2

  • f″(x)=(−1)(−2)⋅x−3=2!⋅x−3

  • f‴(x)=(2!)(−3)⋅x−4=−3!⋅x−4

  • f(4)(x)=(−3!)(−4)⋅x−5=4!⋅x−5

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=12−14(x−2)+18(x−2)2−116(x−2)3+…

9. Find the degree 4 Taylor polynomial P4(x) for f(x)=sin⁡x centered at the point x=0. Estimate the maximum possible error when using P4(x) to estimate sin⁡x 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!(x−a)+f″(a)2!(x−a)2+⋯+f(n)(a)n!(x−a)n

  • f(x)=sin⁡x⟹f(0)=sin⁡(0)=0

  • f′(x)=cos⁡x⟹f′(0)=cos⁡(0)=1

  • f″(x)=−sin⁡x⟹f″(0)=−sin⁡(0)=0

  • f‴(x)=−cos⁡x⟹f‴(0)=−cos⁡(0)=−1

  • f(4)(x)=sin⁡x⟹f(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)=x−16x3

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

P4(x)=x−x36

The formula for the Lagrange Remainder is:

Rn(x)=f(n+1)(ξ(x))(n+1)!(x−x0)n+1

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

In our problem, the parameters are:

  • Function: f(x)=sin⁡x

  • 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)!(x−0)4+1=f(5)(ξ(x))5!x5

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

  • f′(x)=cos⁡x

  • f″(x)=−sin⁡x

  • f‴(x)=−cos⁡x

  • f(4)(x)=sin⁡x

  • f(5)(x)=cos⁡x

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=(10−4)5=10−20

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

Maximum Error ≤max|cos⁡(ξ(x))|⋅max|x|55!

Maximum Error ≤1⋅10−20120

The maximum possible error when using P4(x) to estimate sin⁡x for |x|≤0.0001 is 10−20120.