You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by va...@yahoo.com on 2005/12/15 11:49:02 UTC

[Math 1.1-rc2] Neville and DividedDifference Interpolators... weird values????

Hello,

This is my first post on this list, so forgive me if this is the wrong way.

We are using the interpolator algorithms in version 1.1-RC2 of Commons-math.

We have a question about the results of the DividedDifferenceInterpolator and NevilleInterpolator
as they seem to be very very out of line in comparison with the results of the SplineInterpolator.

May be the author or someone who knows those algorithms could explain the results...

To give you a set of examples based on some UK rates.

Here are the values given to the algorithms:
Vertex(X)  Value(Y)
2          4.6950
7          4.7550
14         4.7763
30         4.7938
60         7.4250
90         7.0688
120        4.6825
150        6.5438
180        4.6275
210        4.6050
240        4.5819
270        4.5575
310        4.5438
360        4.5313

We try to interpolate from point 2 -> 360 (ie 1Y)

Both Neville and DividedDifference gives us some NEGATIVE VALUES which we just do not understand
how it could find those....

They both start to go badly wrong after point 240/270.

NEVILLE:
Vertex	Value
2	4.695
3	4.709933422214146
4	4.7232924330368464
5	4.735235132991724
6	4.74581109668252
7	4.755
8	4.762743546359981
9	4.768971415776979
10	4.773621906789763
11	4.77665789031614
12	4.7780786463172645
13	4.7779281085922526
14	4.7763
15	4.7733402998177854
16	4.769247446698966
17	4.764270644690903
18	4.758706605927844
19	4.752895031833053
20	4.7472131048633244
21	4.742069234923521
22	4.7378962784870846
23	4.735144424101184
24	4.734273915255748
25	4.735747760478751
26	4.7400245609137234
27	4.747551567468935
28	4.758758062833027
29	4.774049148162626
30	4.7938
31	4.818350649910715
32	4.848001327382693
33	4.883008395640834
34	4.923580900149241
35	4.969877740641826
36	5.022005469489051
37	5.08001671202313
38	5.143909198057306
39	5.213625388199416
40	5.2890526736305184
41	5.370024123751931
42	5.456319752456385
43	5.547668270710316
44	5.643749290605887
45	5.744195944014942
46	5.848597877417263
47	5.9565045833471775
48	6.067429028172449
49	6.180851535556198
50	6.296223884924905
51	6.412973584545169
52	6.530508279370197
53	6.648220254627737
54	6.76549099715888
55	6.881695777757577
56	6.996208219180938
57	7.108404816078354
58	7.21766937480269
59	7.32339734289932
60	7.425
61	7.521908483861092
62	7.613577627362567
63	7.699489584410095
64	7.77915722484254
65	7.852127280627619
66	7.917983227816258
67	7.976347890909645
68	8.026885758460311
69	8.069305000870015
70	8.103359183452628
71	8.128848669891056
72	8.145621713225228
73	8.153575233455906
74	8.152655282729869
75	8.142857200879669
76	8.124225465820392
77	8.096853244951707
78	8.060881655271607
79	8.016498741375438
80	7.963938181886233
81	7.903477736138029
82	7.835437444110357
83	7.760177593687763
84	7.67809647029219
85	7.58962790480718
86	7.495238636481222
87	7.39542550816299
88	7.290712511784282
89	7.181647702468053
90	7.0688
91	6.952755896664481
92	6.834116090610612
93	6.713492063984619
94	6.591502625041798
95	6.468770433338991
96	6.345918526908358
97	6.223566870029313
98	6.102328939850213
99	5.9828083696688496
100	5.865595666164177
101	5.751265017284868
102	5.6403712068472146
103	5.533446651179432
104	5.430998572375771
105	5.333506321896245
106	5.2414188673704405
107	5.155152454541199
108	5.0750884553203486
109	5.0015714119285716
110	4.934907286059397
111	4.875361920947617
112	4.8231597231399186
113	4.778482569664191
114	4.74146894517883
115	4.712213312558537
116	4.690765719242968
117	4.677131640543718
118	4.67127205997765
119	4.673103785574663
120	4.6825
121	4.69929104123895
122	4.7232654095194095
123	4.7541709950989545
124	4.791716520521799
125	4.8355731899605646
126	4.8853765373019754
127	4.940728463717582
128	5.001199454583699
129	5.0663309647819205
130	5.135637960625837
131	5.208611605923676
132	5.28472207900297
133	5.363421506894666
134	5.4441470023023554
135	5.526323788469788
136	5.609368396608171
137	5.6926919201559616
138	5.775703309819092
139	5.857812693080475
140	5.938434701674983
141	6.0169917904012035
142	6.092917530584402
143	6.1656598615172364
144	6.234684283285822
145	6.299476974539066
146	6.35954781897852
147	6.414433324634272
148	6.4636994203487
149	6.506944114314002
150	6.5438
151	6.573936595364813
152	6.597062501861348
153	6.612927370435343
154	6.621323662454741
155	6.622088194312686
156	6.61510345530631
157	6.600298689307457
158	6.577650731707715
159	6.54718459413559
160	6.508973790505501
161	6.463140399063605
162	6.409854856240786
163	6.349335479305343
164	6.281847716023205
165	6.207703120778253
166	6.127258057875637
167	6.040912134042891
168	5.949106363452853
169	5.8523210699147635
170	5.751073532210842
171	5.645915379890761
172	5.5374297481709515
173	5.4262282019148816
174	5.31294743998946
175	5.198245792596689
176	5.082799525463359
177	4.967298966030209
178	4.8524444680100524
179	4.7389422318769144
180	4.6275
181	4.5188226462418705
182	4.413607680894492
183	4.312540692824345
184	4.216290751633417
185	4.125505793511272
186	4.0408080152492414
187	3.962789301606083
188	3.892006711849826
189	3.828978051848106
190	3.7741775585338734
191	3.728031723930366
192	3.6909152861734344
193	3.663147415116503
194	3.644988120138765
195	3.636634907696408
196	3.6382197159556554
197	3.649806153520924
198	3.671387068817828
199	3.7028824761055
200	3.7441378633722364
201	3.794922906509865
202	3.854930613162556
203	3.923776918502546
204	4.001000753896049
205	4.086064607985872
206	4.1783555981308305
207	4.277187068405429
208	4.3818007284749
209	4.491369345620756
210	4.605
211	4.7217379108778365
212	4.840570839079783
213	4.960434068266018
214	5.080215964840391
215	5.1987641133712216
216	5.314892021323723
217	5.4273863836882104
218	5.535014894738148
219	5.63653459067246
220	5.730700703292567
221	5.816276001142543
222	5.892040590706983
223	5.956802146323655
224	6.009406533434034
225	6.048748785674469
226	6.0737843921123844
227	6.083540846667509
228	6.077129407437485
229	6.053757009284199
230	6.012738268643228
231	5.9535075151094095
232	5.875630779940597
233	5.7788176672257704
234	5.662933029099391
235	5.528008362069391
236	5.3742528372803675
237	5.2020638733766514
238	5.0120371565829165
239	4.804976008705635
240	4.5819
241	4.344052700269208
242	4.092908458191765
243	3.830178095735121
244	3.557813401639252
245	3.278010305371026
246	2.99321061069132
247	2.7061021660738163
248	2.419617347701671
249	2.1369297296810398
250	1.8614488154860803
251	1.5968127045264038
252	1.3468785681460172
253	1.1157108103631696
254	0.9075667902873024
255	0.7268799854470648
256	0.578240478278799
257	0.4663726518059659
258	0.3961099851380557
259	0.372366844882608
260	0.40010717495159095
261	0.4843099946082681
262	0.6299316230003495
263	0.841864557919717
264	1.1248929471791215
265	1.4836446028662352
266	1.922539521889971
267	2.4457348907417173
268	3.057066568324007
269	3.7599870581236934
270	4.5575
271	5.452091232496057
272	6.445656498945015
273	7.539425894809104
274	8.733885179745898
275	10.028694105926383
276	11.422601944222555
277	12.913360422128833
278	14.497634321775835
279	16.17091002323152
280	17.927402317563643
281	19.759959855959322
282	21.65996964566596
283	23.617261050740662
284	25.62000980568153
285	27.654642603076507
286	29.70574287255786
287	31.755958427715564
288	33.78591172031378
289	35.77411350730678
290	37.696880805880006
291	39.528260085188305
292	41.23995672075289
293	42.80127181875762
294	44.179047602879623
295	45.337622645959236
296	46.238798322893615
297	46.84181795978371
298	47.1033602577274
299	46.977548677891173
300	46.415978587766316
301	45.3677640869927
302	43.77960655497637
303	41.5958870919119
304	38.75878515992138
305	35.208425872017
306	30.883058523669293
307	25.71926911510095
308	19.652229772224855
309	12.615988140589987
310	4.5438
311	-4.631491472180087
312	-14.977026173398247
313	-26.55944347325334
314	-39.44434052230259
315	-53.69566824815879
316	-69.37506059587772
317	-86.54109234245371
318	-105.24846057945993
319	-125.5470847132581
320	-147.48111957850631
321	-171.08787599767883
322	-196.39664284671474
323	-223.42740440448434
324	-252.189446471233
325	-282.6798444382791
326	-314.88182617771425
327	-348.7630022964222
328	-384.273455963103
329	-421.34368416988845
330	-459.88238193124245
331	-499.7740605519093
332	-540.8764907123363
333	-583.0179607240014
334	-625.9943398981013
335	-669.5659365487113
336	-713.4541397156313
337	-757.3378332421839
338	-800.8495703790544
339	-843.5714966063777
340	-885.0310078724473
341	-924.6961309382355
342	-961.9706119920046
343	-996.1886991573373
344	-1026.6096039605163
345	-1052.4116262489553
346	-1072.6859264609727
347	-1086.4299285381872
348	-1092.5403361448314
349	-1089.805744212875
350	-1076.898827167707
351	-1052.3680845056932
352	-1014.6291236919515
353	-961.9554596235488
354	-892.4688091597854
355	-804.1288584566825
356	-694.7224800568884
357	-561.8523758784667
358	-402.9251214159594
359	-215.138585614294


Many thanks

Benoit

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [Math 1.1-rc2] Neville and DividedDifference Interpolators... weird values????

Posted by "J.Pietschmann" <j3...@yahoo.de>.
vachevil-basic@yahoo.com wrote:
> We have a question about the results of the DividedDifferenceInterpolator and NevilleInterpolator
> as they seem to be very very out of line in comparison with the results of the SplineInterpolator.
...
> Vertex(X)  Value(Y)
> 2          4.6950
> 7          4.7550
> 14         4.7763
> 30         4.7938
> 60         7.4250
> 90         7.0688
> 120        4.6825
> 150        6.5438
> 180        4.6275
> 210        4.6050
> 240        4.5819
> 270        4.5575
> 310        4.5438
> 360        4.5313
> 
IIRC the Neville Algorithm will construct a single polynominal. With 14
values provided, the polynominal will have a degree of 13. Polynominals
of such a high degree have a tendency to oscillate wildly. It's not
really a surprise it will evaluate to negative values in your case.

This behaviour was BTW the major driver behind the invention of spline
interpolation.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org