FourierPolynomial

Type Alias FourierPolynomial 

Source
pub type FourierPolynomial<'a, T> = Polynomial<'a, FourierBasis<T>, T>;
Expand description

Type alias for a Fourier polynomial (Polynomial<FourierBasis, T>).

Aliased Type§

pub struct FourierPolynomial<'a, T> { /* private fields */ }

Implementations§

Source§

impl<T: Value> FourierPolynomial<'_, T>

Source

pub fn new(x_range: (T, T), constant: T, terms: &[(T, T)]) -> Self

Create a new Fourier polynomial with the given constant and Fourier coefficients over the specified x-range.

§Parameters
  • x_range: The range of x-values over which the Fourier basis is defined
  • constant: The constant term of the polynomial
  • terms: A slice of (a_n, b_n) pairs representing the sine and cosine coefficients
§Returns

A polynomial defined in the Fourier basis.

For example to create a Fourier polynomial:

f(x) = 3 + 2 sin(2πx) - 0.5 cos(2πx)
use polyfit::FourierPolynomial;
let poly = FourierPolynomial::new((-1.0, 1.0), 3.0, &[(2.0, -0.5)]);