0% found this document useful (0 votes)
18 views

Utsav Python 3

Uploaded by

magadhdynasty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Utsav Python 3

Uploaded by

magadhdynasty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

LAB EVALUATION - 3

Student Name: Utsav Raj UID 22BCS15172


Branch: CSE Section/Group: 22BCS713 B
Semester: 4th Date of Performance: 01-04-24
Subject Name: Python Subject Code: 22CSH-259

1. Aim/Objective:

You are given the following data points (1,2),(2,5),(4,3),(5,10). Use interpolation to estimate value of
y at x = 8. Include the full working out and print the interpolated result.

2. Source Code:

from numpy import array


from scipy.interpolate import lagrange

x_values = array([1, 2, 4, 5])


y_values = array([2, 5, 3, 10])

poly_interpolation = lagrange(x_values, y_values)

x_new = 8
y_new = poly_interpolation(x_new)

print("Estimated value of y at x = 8:", y_new)

3. Output:
4. Learning Outcome:

• We shall develop proficiency in employing the interpolation method to solve mathematical


problems by implementing a Python function that efficiently searches for the optimal value
of a parameter within a specified range.

• We shall enhance our understanding of numerical methods, specifically the interpolation


method, for solving equations and optimization problems. We can apply these techniques to
find the parameter values that satisfy certain conditions, gaining insights into the importance
of precision and convergence in numerical solutions.

You might also like