Yagami.CurtisGodson.QuadraturePoints
— TypeA structure to hold quadrature points and weights for numerical integration. Where N
is the number of quadrature points and T
is the type of the points and weights.
Yagami.CurtisGodson.get_quadrature_points
— Methodget_quadrature_points(_, n)
Get quadrature points and weights for numerical integration using Gauss-Legendre quadrature. The function returns a QuadraturePoints
object containing the points and weights.
Arguments
T
: Type of the quadrature points (default isFloat64
).n
: Number of quadrature points (must be positive).
Returns
A QuadraturePoints
object with the quadrature points and weights.
Yagami.CurtisGodson.linintegral!
— Methodlinintegral!(out, f, Q, t, p)
Compute the linear integral of a function f
over the quadrature points Q
scaled by a factor t
. It is assumed that the integral starts at 0
and ends at t
. The function uses the quadrature points and weights to evaluate the integral numerically. The function evaluates f
at the quadrature points scaled by t
, computes the dot product with the weights, and stores the result in the output array out
. The function f needs to have the following signature:
f(points::AbstractVector{T}, p) where {T<:AbstractFloat}
where p is an optional parameter that can be passed to the function to account for additional parameters in the integral.
Arguments
out
: An output array to store the results of the integral.f
: A function that takes a vector of points and an optional parameterp
.Q
: AQuadraturePoints
object containing the quadrature points and weights.t
: the end of the integral path, which is a vector of the same size asout
.p
: An optional parameter passed to the functionf
. Can be a vector of the same size ofout
or a single value.
Returns
The output array with the computed linear integrals.
Yagami.CurtisGodson.linintegral
— Methodlinintegral(f, Q)
linintegral(f, Q, t)
linintegral(f, Q, t, p)
Compute the linear integral of a function f
over the quadrature points Q
scaled by a factor t
. It is assumed that the integral starts at 0
and ends at t
. The function uses the quadrature points and weights to evaluate the integral numerically. The function evaluates f
at the quadrature points scaled by t
, computes the dot product with the weights, and returns the result multiplied by t/2
.
The function f needs to have the following signature:
f(points::AbstractVector{T}, p) where {T<:AbstractFloat}
where p is an optional parameter that can be passed to the function to account for additional parameters in the integral.
Arguments
f
: A function that takes a vector of points and an optional parameterp
.Q
: AQuadraturePoints
object containing the quadrature points and weights.t
: the end of the integral path, which is a scalar value.p
: An optional parameter passed to the functionf
.
Returns
The computed linear integral as a scalar value.