I was pretty sure I'd done something with splines years back,  but CTRL-E I "spline" only in my user folder revealed two relevant scripts.  One was my edited crib from ~addons/demos/wdplot/plexam.ijs, the other a copy of what Patrick Harrington posted to the J Forum way back in 2004. The latter starts with triPGA,  "Solve tridiagonal matrix iteratively using the Parallel Gauss Algorithm";  it has a preamble very similar to that for tridgl near the top of spline.ijs in the link Scott gives,  just below here.  That link doesn't obviously indicate authorship.  Patrick might
wish to comment;  I see he's still corresponding about matters J.

But Ruda has since commented that he considers that "the data as a whole do not follow a simple trend."  It seems to me that to use mere (my term!) linear interpolation is still to impose some kind of mathematical model.  Anyway,  if the independent values are "even quite random",  you might find that some values are repeated,  in which case I suppose you take the average value at a repeated X value.  Also, what should happen if your data points are at,
say,  X =: 0 5 6 8 12 26 ?   (How) should Y(6) and Y(8) both be used?

Thanks,

Mike

On 07/05/2021 12:12, Scott Locklin wrote:
FWIIW there's a splines mini package here:

https://www.astro.umd.edu/~jph/J_page.html

-SL

On Fri, May 7, 2021 at 11:58 AM 'Rudolf Sykora' via Programming <
[email protected]> wrote:

Dear Raul,


thanks for your writing, and also for directing this from the general to
the programming forum, where I probably should have posted it.

On the topic. I am afraid you misunderstood what I meant. The data
as a whole do not follow a simple trend, like lying on a line. they can
be even quite random. The task is to go from

X: 0    5  6  26
Y: 10 _10 80 100

to, say:

U: 0    5 10 15 20 25  30    NB. Equidistant mesh.
V: 10 _10 84 90 94 99 104    NB. Linear interpolation and extrapolation
when needed.
                              NB. The numbers with U>5 are rounded here for
readability.
                              NB. If U=26 were, by chance, in the mesh,
                              NB. the value would be (exactly) 100.

(This is not what the data look like in reality, but as an example it
could suffice.)

Thanks once more!


Ruda
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to