@@ -8288,6 +8288,76 @@ def ldpool(filename: str) -> None:
8288
8288
libspice.ldpool_c(filename)
8289
8289
8290
8290
8291
+ @spice_error_check
8292
+ def lgresp(first: float, step: float, yvals: ndarray, x: float) -> float:
8293
+ """
8294
+ Evaluate a Lagrange interpolating polynomial for a specified
8295
+ set of coordinate pairs whose first components are equally
8296
+ spaced, at a specified abscissa value.
8297
+
8298
+ https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lgresp_c.html
8299
+
8300
+ :param first: First abscissa value.
8301
+ :param step: Step Size.
8302
+ :param yvals: Ordinate Values.
8303
+ :param x: Point at which to interpolate the polynomial.
8304
+ :return: The function returns the value at `x' of the unique polynomial of degree n-1 that fits the points in the plane defined by `first', `step', and `yvals'.
8305
+ """
8306
+ n = ctypes.c_int(len(yvals))
8307
+ _first = ctypes.c_double(first)
8308
+ _step = ctypes.c_double(step)
8309
+ _yvals = stypes.to_double_vector(yvals)
8310
+ _x = ctypes.c_double(x)
8311
+ return libspice.lgresp_c(n, _first, _step, _yvals, _x)
8312
+
8313
+
8314
+ @spice_error_check
8315
+ def lgrind(
8316
+ xvals: Sequence[float], yvals: Sequence[float], x: float
8317
+ ) -> Tuple[float, float]:
8318
+ """
8319
+ Evaluate a Lagrange interpolating polynomial for a specified
8320
+ set of coordinate pairs, at a specified abscissa value.
8321
+ Return the value of both polynomial and derivative.
8322
+
8323
+ https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lgrind_c.html
8324
+
8325
+ :param xvals: Abscissa values.
8326
+ :param yvals: Ordinate values.
8327
+ :param x: Point at which to interpolate the polynomial.
8328
+ :return: Polynomial value at x, Polynomial derivative at x.
8329
+ """
8330
+ n = ctypes.c_int(len(xvals))
8331
+ xvals = stypes.to_double_vector(xvals)
8332
+ yvals = stypes.to_double_vector(yvals)
8333
+ work = stypes.empty_double_vector(n.value * 2)
8334
+ x = ctypes.c_double(x)
8335
+ p = ctypes.c_double(0)
8336
+ dp = ctypes.c_double(0)
8337
+ libspice.lgrind_c(n, xvals, yvals, work, x, p, dp)
8338
+ return p.value, dp.value
8339
+
8340
+
8341
+ @spice_error_check
8342
+ def lgrint(xvals: ndarray, yvals: ndarray, x: float) -> float:
8343
+ """
8344
+ Evaluate a Lagrange interpolating polynomial for a specified
8345
+ set of coordinate pairs, at a specified abscissa value.
8346
+
8347
+ https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lgrint_c.html
8348
+
8349
+ :param xvals: Abscissa values.
8350
+ :param yvals: Ordinate values.
8351
+ :param x: Point at which to interpolate the polynomial.
8352
+ :return: The function returns the value at `x' of the unique polynomial of degree n-1 that fits the points in the plane defined by `xvals' and `yvals'.
8353
+ """
8354
+ n = ctypes.c_int(len(xvals))
8355
+ _xvals = stypes.to_double_vector(xvals)
8356
+ _yvals = stypes.to_double_vector(yvals)
8357
+ _x = ctypes.c_double(x)
8358
+ return libspice.lgrint_c(n, _xvals, _yvals, _x)
8359
+
8360
+
8291
8361
@spice_error_check
8292
8362
def limbpt(
8293
8363
method: str,
@@ -8377,33 +8447,6 @@ def limbpt(
8377
8447
)
8378
8448
8379
8449
8380
- @spice_error_check
8381
- def lgrind(
8382
- xvals: Sequence[float], yvals: Sequence[float], x: float
8383
- ) -> Tuple[float, float]:
8384
- """
8385
- Evaluate a Lagrange interpolating polynomial for a specified
8386
- set of coordinate pairs, at a specified abscissa value.
8387
- Return the value of both polynomial and derivative.
8388
-
8389
- https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lgrind_c.html
8390
-
8391
- :param xvals: Abscissa values.
8392
- :param yvals: Ordinate values.
8393
- :param x: Point at which to interpolate the polynomial.
8394
- :return: Polynomial value at x, Polynomial derivative at x.
8395
- """
8396
- n = ctypes.c_int(len(xvals))
8397
- xvals = stypes.to_double_vector(xvals)
8398
- yvals = stypes.to_double_vector(yvals)
8399
- work = stypes.empty_double_vector(n.value * 2)
8400
- x = ctypes.c_double(x)
8401
- p = ctypes.c_double(0)
8402
- dp = ctypes.c_double(0)
8403
- libspice.lgrind_c(n, xvals, yvals, work, x, p, dp)
8404
- return p.value, dp.value
8405
-
8406
-
8407
8450
@spice_error_check
8408
8451
def lmpool(cvals: Union[ndarray, Iterable[str]]) -> None:
8409
8452
"""
@@ -10259,6 +10302,30 @@ def qcktrc(tracelen: int = _default_len_out) -> str:
10259
10302
return stypes.to_python_string(tracestr)
10260
10303
10261
10304
10305
+ @spice_error_check
10306
+ def qderiv(f0: ndarray, f2: ndarray, delta: float) -> ndarray:
10307
+ """
10308
+ Estimate the derivative of a function by finding the derivative
10309
+ of a quadratic approximating function. This derivative estimate
10310
+ is equivalent to that found by computing the average of forward
10311
+ and backward differences.
10312
+
10313
+ https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/qderiv_c.html
10314
+
10315
+ :param f0: Function values at left endpoint.
10316
+ :param f2: Function values at right endpoint.
10317
+ :param delta: Separation of abscissa points.
10318
+ :return: Derivative vector.
10319
+ """
10320
+ _ndim = ctypes.c_int(len(f0))
10321
+ _f0 = stypes.to_double_vector(f0)
10322
+ _f2 = stypes.to_double_vector(f2)
10323
+ _delta = ctypes.c_double(delta)
10324
+ _dfdt = stypes.empty_double_vector(_ndim)
10325
+ libspice.qderiv_c(_ndim, _f0, _f2, _delta, _dfdt)
10326
+ return stypes.c_vector_to_python(_dfdt)
10327
+
10328
+
10262
10329
@spice_error_check
10263
10330
def qdq2av(q: ndarray, dq: Union[ndarray, Iterable[float]]) -> ndarray:
10264
10331
"""
0 commit comments