summaryrefslogtreecommitdiff
path: root/50/CH4/EX4.22/ex_4_22.sce
diff options
context:
space:
mode:
Diffstat (limited to '50/CH4/EX4.22/ex_4_22.sce')
-rwxr-xr-x50/CH4/EX4.22/ex_4_22.sce30
1 files changed, 30 insertions, 0 deletions
diff --git a/50/CH4/EX4.22/ex_4_22.sce b/50/CH4/EX4.22/ex_4_22.sce
new file mode 100755
index 000000000..972fd5058
--- /dev/null
+++ b/50/CH4/EX4.22/ex_4_22.sce
@@ -0,0 +1,30 @@
+// example: 4.22;
+// piecewise quadratic interpolating polinomials:
+
+X=[-3 -2 -1 1 3 6 7];
+F=[369 222 171 165 207 990 1779];
+// we need to apply legranges interpolation in sub-ranges [-3 ,-1];[-1,3],[3,7];
+
+ x=poly(0,"x");
+
+ // 1) in the range [-3,-1]
+ x=[-3 -2 -1];
+ f=[369 222 171];
+ n=2;
+P2=lagrangefundamentalpoly(x,f,n);
+
+ // 2) in the range [-1,3]
+ x=[-1 1 3];
+ f=[171 165 207];
+n=2;
+P2=lagrangefundamentalpoly(x,f,n)
+
+ // 3) in the range [3,7]
+ x=[3 6 7];
+ f=[207 990 1779];
+n=2;
+P2=lagrangefundamentalpoly(x,f,n)
+
+
+
+// hence, we obtain the values of f(-2.5)=48; f(6.5)=1351.5; \ No newline at end of file