c_ftcurvs(3NCARG)

πŸ“¦ version 6.6.2, in epel 9, fedora 43, fedora 44

πŸ’– c_ftcurvs β€” NCAR GRAPHICS ✨

okay bestie, welcome to the c_ftcurvs page from the NCAR GRAPHICS manual (that's section 3NCARG if you're keeping score) πŸ’… this is the one that computes a smoothing spline, and yes she eats, let's get into it


πŸŽ€ NAME πŸŽ€

c_ftcurvs β€” compute a smoothing spline. that's it, that's the whole vibe πŸ¦‹


🌸 FUNCTION PROTOTYPE 🌸

lowkey the glow-up version of the signature, in all its C-flavored glory:

int c_ftcurvs (int, float [], float [], int, float [], int, float [],
float []);

✨ SYNOPSIS ✨

and here's how you actually call her, bestie:

int c_ftcurvs (n, xi, yi, dflg, d, m, xo, yo);

πŸ’œ DESCRIPTION πŸ’œ

here's the rundown on every single argument, no skips, no cap:

  • n β€” the number of input data points. and btw she has requirements: n > 1. periodt.
  • xi β€” an array holding the abscissae for the input function.
  • yi β€” an array holding the functional values of the input function. so like, yi[k] is the functional value at x[k] for k=0,n-1.
  • dflg β€” a switch that decides how we read the value of d (more on that below, stay with me 🫢). if dflg=0, then d is an array of length n β€” meaning one error estimate for each input data value. if dflg=1, then d is a scalar and it serves as the error estimate for every single data item. one number, all the data, iconic.
  • d β€” a user-specified value containing the observed weights. d can be an array or a scalar, and which one it is depends on the value of dflg. iykyk.
  • m β€” the number of output values.
  • xo β€” contains the abscissae for the output values.
  • yo β€” contains the functional values for the smoothing spline. (yo[k] is the functional value at xo[k] for k=0,n-1.)

πŸ”₯ RETURN VALUE πŸ”₯

c_ftcurvs hands you back an error value, and here's the whole chart, memorized so you don't have to:

  • = 1 if n is less than 2.
  • = 2 if smt is negative.
  • = 3 if eps is negative or greater than 1.
  • = 4 if x values are not strictly increasing.
  • = 5 if d is negative.
heads up bestie: every one of those is a real "fix your input" moment, not a suggestion 🌈

πŸ¦‹ USAGE πŸ¦‹

so what does she actually do? this function computes an interpolatory smoothing spline under tension through a sequence of functional values. chef's kiss.

two parameters and one function argument control the degree of smoothness β€” the parameters are smt and eps, and the function argument is d. three little knobs, so much power πŸ‘‘

the argument d is a value indicating the degree of confidence in the accuracy of the input function values β€” it should be an approximation of the standard deviation of error. effectively, the value of d controls how close the smoothed curve comes to the input data points. if d is small, then the interpolated curve will pass close to the input data. the larger the value of d, the more freedom the smooth curve has in how close it comes to the input data values. so small d = clingy curve, big d = free-spirited curve πŸ’«

the parameter smt is a more subtle global smoothing parameter, and smt must be non-negative. for small values of smt, the curve approximates the tension spline; for larger values of smt, the curve is smoother. a reasonable value for smt is (float) n. noted πŸ“

the parameter eps controls the precision to which smt is interpreted, and eps must be between 0. and 1. inclusive. a reasonable value for eps is sqrt( 2./(float) n ).

c_ftcurvs is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, and c_ftsetc. order matters, don't skip ahead 🫠

control parameters that apply to c_ftcurvs are: sig, smt, eps, sf2.

the value for the parameter sig specifies the tension factor. values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. a typical value is 1. β€” which is also the default, conveniently ✨


🌈 ACCESS 🌈

to use c_ftcurvs, load the NCAR Graphics library ngmath. that's the whole assignment πŸŽ€


⭐ SEE ALSO ⭐

go read these next, bestie, they're the friend group:

  • fitgrid_params
  • c_ftseti
  • c_ftsetr
  • c_ftsetc

complete documentation for Fitgrid is available at URL http://ngwww.ucar.edu/ngdoc/ng/ngmath/fitgrid/fithome.html 🌐


Copyright (C) 2000 University Corporation for Atmospheric Research

The use of this Software is governed by a License Agreement.


and that's the page!! this one came straight out of the UNIX manual, dated March 1998, filed under c_ftcurvs(3NCARG) β€” so if you ever need to cite her, that's the source, and that's the version. mwah πŸ’‹ go smooth some splines, you got this 🫢🌸

πŸ“¦ where this page comes from