CURVPS(3NCARG)

✨ CURVPS ✨ (bestie edition, from the NCAR Graphics manual πŸ’–)

okay so real talk: this one is CURVPS, and it lives in the NCAR Graphics docs. she's a Fortran-era queen and she's here to help you smooth out a periodic function. let's get into it πŸ¦‹


πŸ’… NAME πŸ’…

CURVPS β€” calculate values for a smoothing spline for a periodic function.

periodt. that's the whole job.


🌸 SYNOPSIS 🌸

CALL CURVPS (N, X, Y, P, D, ISW, S, EPS, YS, YSP, SIGMA, TEMP, IER)

so here's the tea β˜• β€” this subroutine calculates certain values that are used by CURVP2 in order to compute an interpolatory smoothing spline under tension through a sequence of functional values for a periodic function. and listen, because this part matters: the actual computation of the interpolated values must be done using CURVP2. CURVPS is the setup girlie, CURVP2 is the one who actually shows up to the party. two different jobs, both iconic. πŸ‘‘

three parameters are used to control the degree of smoothness β€” D, S, and EPS. let's vibe check them one by one:

  • D β€” a value indicating the degree of confidence in the accuracy of the input function values, and 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 like… small D = clingy, big D = giving the curve space to breathe. 🫢
  • S β€” a more subtle global smoothing parameter, okay? she's lowkey but highkey important. S must be non-negative. for small values of S, the curve approximates the tension spline, and for larger values of S, the curve is smoother. a reasonable value for S is REAL(N). ✨
  • EPS β€” controls the precision to which S is interpreted. EPS must be between 0. and 1. inclusive. a reasonable value for EPS is SQRT(2./REAL(N)). no cap, that's literally what the docs say. πŸŽ€

πŸŽ€ DESCRIPTION πŸŽ€

here come the arguments, bestie. every single one, no skipping, we do not gatekeep πŸ’–

  • N (integer, input) β€” the number of input data values. (N > 1)
  • X (integer, input) β€” an array containing the abscissae for the input function.
  • Y (integer, input) β€” an array containing the functional values for the input function. Y(K) is the functional value at X(K) for K=1,N.
  • P (real, input) β€” the period of the function.
  • D (integer, input) β€” a user-specified value containing the observed weights. D may be either an array or a scalar, depending on the value of ISW (as described below). she's flexible like that πŸ’
  • ISW (integer, input) β€” a switch for interpreting the value of D. if ISW=0, then D is an array of length N (D contains an individual error estimate for each input data value); if ISW=1, then D is a scalar that serves as an error estimate for every single data item. pick your fighter. πŸ₯Š
  • S (integer, input) β€” contains the value for smoothing. S must be non-negative. larger values for S yield greater smoothing. a reasonable value is REAL(N).
  • EPS (integer, input) β€” contains a tolerance value for the relative precision to which S should be interpreted. EPS must be between 0. and 1. inclusive. a reasonable value is SQRT(2./REAL(N)).
  • YS (integer, input) β€” an array of length N.
  • YSP (integer, input) β€” an array of length N.
  • SIGMA (integer, input) β€” 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. so SIGMA is basically the drama meter 🎭 β€” tiny SIGMA = soft and flowy, big SIGMA = sharp and angular.
  • TEMP (integer, input) β€” scratch space. she's just there to hold your stuff, no questions asked. πŸ™ˆ
  • IER (integer, input) β€” an error return value. if IER is returned as 0, then no errors were detected. otherwise, she will tell on you:
    • = 1 if N is less than 2.
    • = 2 if S is negative.
    • = 3 if EPS is negative or greater than 1.
    • = 4 if X values are not strictly increasing.
    • = 5 if D is negative.
    • = 6 if P is less than or equal to X(N)-X(1).
not me coding IER checks into my personality 😭 fr fr, read your error codes. she's not being dramatic, she's being informative.

🌈 ACCESS 🌈

to use CURVPS, load the NCAR Graphics library ngmath.

that's it. that's the access. go off. πŸ’«


πŸ¦‹ SEE ALSO πŸ¦‹

  • curvp2
  • fitgrid_params

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

iykyk, go read the whole Fitgrid saga if you want the lore. πŸ“š


Copyright (C) 2000 University Corporation for Atmospheric Research

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


and that's the whole page, bestie β€” this was CURVPS(3NCARG) from the UNIX manual, dated March 1998, and you absolutely ate by reading the whole thing. slay πŸ’…βœ¨ πŸŽ€ πŸ¦‹ 🌸 πŸ’–