Inversion of splines


paolog
02-10-2006, 06:49 AM
(If you reply to this thread, please also look at my earlier one ("Potential crash in spline?"), posted over two weeks ago, as no one has replied to that one yet - it would be great if someone could throw some light on that issue. Thanks.)

I would like to be able to invert the splines I have generated to get splines that map y to x. I would have thought the principle here would be:

* Take the nodes (x1, y1), ..., (xn, yn) used to generate the original spline
* Swap x and y in each coordinate pair
* Set the first derivatives at the ends to their reciprocals
* Fit splines through this revised data

This gives me splines that appear, when plotted, to be a reflection of the original splines in y = x, but do not tally in fact with the original splines. If I look up the value of y given by the original splines for a given value of x and then feed that value of y into the inverted splines, I get a value of x that is right to only two or sometimes only one decimal place. This level of precision is not adequate for my application.

Is there something wrong with what the procedure I have described above, or have I overlooked something? It looks mathematically sound to me. The second derivatives are set by the spline-fitting function and do not need to be set by the calling function, as far as I can see. Why should it be that the precision is so poor? Are there accumulated rounding errors in the code or something? I notice that the second derivatives are computed as a recurrence relation, so this might be a source of error.

Note that my splines are strictly monotonic and so are functions when inverted, so it is not a question of there being multiple solutions.

Can any of the authors comment?

Thanks,

Paul Giaccone

paolog
08-02-2006, 08:42 AM
No comment has ever been posted, I notice, which suggests to me that the authors don't read this forum very often, or perhaps not very thoroughly.

Correct me if I am wrong, but I think the code is probably buggy.

paolog
09-29-2006, 09:10 AM
I recommend that readers do not use the spline-fitting code as it is demonstrably buggy: it does not fit correctly to inverted coordinates, and therefore does not fit correctly at all.

I have access to better spline-fitting code. If anyone wants it, contact me at paul g at cinesite co uk, removing spaces and inserting the necessary punctuation.

Opinions in this posting are my own.

kuelite
12-01-2007, 02:16 AM
your email address is paulog@cinesite.co.uk?
I sent a message to you about spline interpolation.
the nr3 codes is not right, Can you send me some other right codes?
Thanks in advance.

My email is kuelite@gmail.com