Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Assignment 2

Numerical Computing

Uploaded by

AliSheR KhaN MK
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Assignment 2

Numerical Computing

Uploaded by

AliSheR KhaN MK
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment Help Request

You said:

ChatGPT said:

I can certainly help you with your assignment, but I'll need some more details to get started. Please
provide the specific questions or the topic of the assignment you need help with. If it's based on a
particular book or subject, let me know which one so I can tailor the solutions accordingly.

You said:

ChatGPT said:

To solve these problems step by step, I'll break down each one individually. Let's start with Problem 01:

Problem 01: Determine the linear Lagrange interpolating polynomial that passes
through the points (2, 4) and (5, 1).

Solution:
The general form of the Lagrange interpolating polynomial for two points (x0 , y0 ) and (x1 , y1 ) is
​ ​ ​ ​

given by:

(x − x1 ) (x − x0 )
P (x) = y0 ⋅ + y1 ⋅
​ ​

(x0 − x1 ) (x1 − x0 )
​ ​ ​ ​

​ ​ ​ ​

Given points:

(x0 , y0 ) = (2, 4)
​ ​

(x1 , y1 ) = (5, 1)
​ ​

Substitute the given values into the Lagrange polynomial formula:

(x − 5) (x − 2)
P (x) = 4 ⋅ +1⋅
(2 − 5) (5 − 2)
​ ​

Simplifying the above expression:

(x − 5) (x − 2)
P (x) = 4 ⋅ +1⋅
−3 3
​ ​

4 1
P (x) = − (x − 5) + (x − 2)
3 3
​ ​

Now, expand and simplify:


4
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/5
4 20 1 2
P (x) = − x + + x−
3 3 3 3
​ ​ ​ ​

Combine like terms:

4 1 20 2
P (x) = (− + ) x + ( − )
3 3 3 3
​ ​ ​ ​

3 18
P (x) = − x +
3 3
​ ​

P (x) = −x + 6

So, the linear Lagrange interpolating polynomial is:

P (x) = −x + 6

Problem 02: Step size h for linear interpolation of f (x) = ex to ensure absolute
error ≤ 10−6 in [0, 1]
Solution:
To determine the appropriate step size h, we can use the error formula for linear interpolation:

h2
Error = ⋅ max ∣f ′′ (x)∣
8 x∈[a,b]
​ ​

For the function f (x) = ex , the second derivative is:

f ′′ (x) = ex

The maximum value of ex on the interval [0, 1] is e1 = e.


Thus, the error bound becomes:

h2
Error ≤ ⋅e
8

We want the error to be at most 10−6 :

h2
⋅ e ≤ 10−6
8

Solve for h:

2 8 ⋅ 10−6
h ≤ ​

8 ⋅ 10−6
h≤ ​ ​

e
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 2/5
Calculate h:

8 ⋅ 10−6
h≈ ≈ 2.9453 × 10−6 ≈ 1.715 × 10−3
2.71828
​ ​ ​

So, the step size h should be approximately:

h ≈ 0.001715

Problem 03: Interpolating polynomial P1,2,4 (x) and approximation of f (5) ​

Solution:
Given points x0 = 1, x1 = 2, x2 = 3, x3 = 4, x4 = 6, and f (x) = ex .
​ ​ ​ ​

To find P1,2,4 (x):


Step 1: Calculate f (xi ) for x1 ​ ​ = 2, x2 = 3, and x4 = 6: ​ ​

2
f (2) = e
f (3) = e3
f (6) = e6
Step 2: Construct the interpolating polynomial using Lagrange's formula for three points:

(x − x2 )(x − x4 ) (x − x1 )(x − x4 ) (x − x1 )(x − x2 )


P1,2,4 (x) = f (x1 ) ⋅ + f (x2 ) ⋅ + f (x4 ) ⋅
​ ​ ​ ​ ​ ​

(x1 − x2 )(x1 − x4 ) (x2 − x1 )(x2 − x4 ) (x4 − x1 )(x4 − x2 )


​ ​ ​ ​ ​ ​

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Substitute the values:

(x − 3)(x − 6) (x − 2)(x − 6) (x − 2)(x − 3)


P1,2,4 (x) = e2 ⋅ + e3 ⋅ + e6 ⋅
(2 − 3)(2 − 6) (3 − 2)(3 − 6) (6 − 2)(6 − 3)
​ ​ ​

Simplify and calculate P1,2,4 (5): ​

The detailed steps involve expanding and simplifying the terms, and finally substituting x = 5 to
approximate f (5).

Problem 04: Neville’s Algorithm to find error in f (0) when f (−1) and f (1) are
misstated

Solution:
Given:

True values of f (−2), f (−1), f (1), and f (2).


f (−1) was overstated by 2.
f (1) was understated by 3.

Neville’s algorithm constructs a sequence of polynomials Pij (x) based on given points, and calculates ​

the interpolation. After recalculating using the correct values for f (−1) and f (1), the difference
between the original and recalculated interpolation at x = 0 will give the error.

Problem 05: Divided Difference Table and Interpolating Polynomial

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 3/5
Solution:
Given the data in Table 3.10 of Section 3.2 (Example 1), construct the divided difference table by
computing the divided differences recursively. The interpolating polynomial is constructed by using
the first row of the divided difference table.
Detailed steps involve calculating each divided difference and then constructing the polynomial using
the Newton form of the interpolation polynomial.

If you have specific numbers or further clarifications needed for Problems 03-05, please provide those,
and I can delve deeper into each one!

You said:

ChatGPT said:

Memory updated

Problem 05: Complete the Divided Difference Table and Construct the
Interpolating Polynomial

Given data:

x f (x)
1.0 0.7651977
1.3 0.6200860
1.6 0.4554022
​ ​ ​

1.9 0.2818186
2.2 0.1103623

Step 1: Construct the Divided Difference Table

We create a table where the first column contains the x values, the second column contains f (x), and
each subsequent column contains the divided differences.

x f (x) [x0 , x1 ]
​ ​ [x0 , x1 , x2 ]
​ ​ ​

1.0 0.7651977
0.6200860−0.7651977
1.3 0.6200860 1.3−1.0
​ = −0.4837057
0.4554022−0.6200860 −0.5489460−(−0.4837057)
1.6 ​

0.4554022 ​

1.6−1.3
​ = −0.5489460 ​

1.6−1.0 = −0.1085738

0.2818186−0.4554022 −0.5786120−(−0.5489460) −0.049


1.9 0.2818186 1.9−1.6

= −0.5786120 1.9−1.3 = −0.0494440

0.1103623−0.2818186 −0.5715200−(−0.5786120) 0.0118


2.2 0.1103623 2.2−1.9
​ = −0.5715200 2.2−1.6
= 0.0118200

The table is now complete. The values in each column are the divided differences, which we'll use to
construct the interpolating polynomial.

Step 2: Construct the Interpolating Polynomial

The Newton interpolating polynomial is given by:

P (x) = f [x0 ] + f [x0 , x1 ](x − x0 ) + f [x0 , x1 , x2 ](x − x0 )(x − x1 ) + ⋯ + f [x0 , x1 , … , xn ](x − x0


​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 4/5
Using the divided differences calculated above:

P (x) = 0.7651977 + (−0.4837057)(x − 1.0) + (−0.1085738)(x − 1.0)(x − 1.3) + 0.0662998(x −

This is the final interpolating polynomial using the given data.


ChatGPT can make mistakes. Check important info.

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 5/5

You might also like