summaryrefslogtreecommitdiff
path: root/260/CH10/EX10.7/10_7.sce
blob: 1062655ac505b38e11f9ebeb8f2dc49211677971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//Eg-10.7
//pg-442

clear
clc
close()

x = [0;2;5];
y = [0;2.5;6.9];

exec lagrange.sci

p = lagrange(x,y,2)

printf('The polynomial is \n')
disp(p)
k = horner(p,3)

printf('\nThe value of the polynomial at x = 3 is %f\n',k)