4. Using the divided difference method, print out the Hermite polynomial approximation matrix X 3.6 3.8 3.9 f(x) 1.675 1.436 1.318 f'(x) -1.195 -1.188 -1.182

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please help me solve this in python. Add the code used to solve it.

The expected output is:

[[ 3.6 1.675 0. 0. 0. 0. ]
[ 3.6 1.675 -1.195 0. 0. 0. ]
[ 3.8 1.436 -1.195 -0. 0. 0. ]
[ 3.8 1.436 -1.188 0.035 0.175 0. ]
[ 3.9 1.318 -1.18 0.08 0.15 -0.0833333]
[ 3.9 1.318 -1.182 -0.02 -1. -3.8333333]]

4. Using the divided difference method, print out the Hermite polynomial approximation
matrix
X
3.6
3.8
3.9
f(x)
1.675
1.436
1.318
f'(x)
- 1.195
-1.188
-1.182
Transcribed Image Text:4. Using the divided difference method, print out the Hermite polynomial approximation matrix X 3.6 3.8 3.9 f(x) 1.675 1.436 1.318 f'(x) - 1.195 -1.188 -1.182
Expert Solution
Step 1

Here is a python code to solve the problem

import numpy as np

def divided_difference(x, y, y_prime):
    n = len(x)
    f = np.zeros((n, n))
    f[:, 0] = y
    f[:, 1] = y_prime

    for j in range(2, n):
        for i in range(n-j+1):
            f[i, j] = (f[i+1, j-1] - f[i, j-1]) / (x[i+j-1] - x[i])

    return f

x = [3.6, 3.8, 3.9]
y = [1.675, 1.436, 1.318]
y_prime = [-1.195, -1.188, -1.182]

approximation_matrix = divided_difference(x, y, y_prime)
print(approximation_matrix)

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

This is the ouput i got when i ran the code:

[[ 1.675 -1.195  0.035]
 [ 1.436 -1.188  0.06 ]
 [ 1.318 -1.182  0.   ]]

But it needs to be: 

[[ 3.6 1.675       0.           0.           0.          0. ]
[ 3.6  1.675     -1.195      0.           0.          0. ]
[ 3.8  1.436     -1.195     -0.           0.          0. ]
[ 3.8  1.436     -1.188      0.035     0.175    0. ]
[ 3.9  1.318     -1.18        0.08       0.15     -0.0833333]
[ 3.9  1.318     -1.182     -0.02      -1.        -3.8333333]]

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Fast Fourier Transform Concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education