Skip to content

The precision of gausslegendre can be improved #126

@hyrodium

Description

@hyrodium

MWE:

julia> using FastGaussQuadrature, LinearAlgebra, Plots

julia> errors = Float64[]
Float64[]

julia> for n in 6:100
           nodes, weights = gausslegendre(n)
           push!(errors, norm([dot(weights, nodes.^p) - 2/(1+p) for p in 2:2:10], Inf))
       end

julia> plot(6:100, errors)

gausslegendre

The precision with $n\le60$ is worse than with $n>60$, and FastGaussQuadrature.rec can be improved.

elseif n 60
# NEWTON'S METHOD WITH THREE-TERM RECURRENCE:
return rec(n)
else
# USE ASYMPTOTIC EXPANSIONS:
return asy(n)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions