I've written a simple legendre quadrature in MAPLE to compute the integral$\int_{-1}^1 r^2 dr = \frac{r^3}{3} |_{-1}^1=\frac{2}{3}$ restart; with(orthopoly): with(LinearAlgebra):legendre_quad := proc (n, digits)     local i, s, w, location;     w := Vector(n, fill = 0);     location := Vector(sort([evalf[digits](solve(P(n, x) = 0, x))], `<`));    for i to n do         w[i] := eval[digits](2/((1-location[i]^2)*(diff(P(n, x), x))^2), [x = location[i]])     end do;     s := (w, location) end proc,such that (weights, location) := legendre_quad(10, 50);int := DotProduct(location^~2, weights),which results in 0.666666635631640303. But this is only accurate up to 7 digits, even doubling the number of digitsHow can I increase the accuracy of this quadrature?
How to increase precision of Gauss-Legendre Quadrature in MAPLE?
quadrature;maple
evalf evaluates using floating-point arithmetic. Increase the floating-point precision by modifying the built-in parameter Digits using the command Digits:=n.