@@ -200,30 +200,30 @@ variable(p::Poly{T}) where {T} = variable(T, p.var)
200200variable (var:: SymbolLike = :x ) = variable (Float64, var)
201201
202202"""
203- truncate{T}(p::Poly{T}; reltol ::Real = Base.rtoldefault(real(T)), abstol ::Real = 0)
203+ truncate{T}(p::Poly{T}; rtol ::Real = Base.rtoldefault(real(T)), atol ::Real = 0)
204204
205- Return a polynomial with coefficients `a_i` truncated to zero if `|a_i| <= reltol *maxabs(a)+abstol `.
205+ Return a polynomial with coefficients `a_i` truncated to zero if `|a_i| <= rtol *maxabs(a)+atol `.
206206"""
207- function truncate (p:: Poly{T} ; reltol :: Real = Base. rtoldefault (real (T)),
208- abstol :: Real = 0 ) where {T}
207+ function truncate (p:: Poly{T} ; rtol :: Real = Base. rtoldefault (real (T)),
208+ atol :: Real = 0 ) where {T}
209209 a = coeffs (p)
210210 amax = maximum (abs,a)
211- thresh = amax * reltol + abstol
211+ thresh = amax * rtol + atol
212212 anew = map (ai -> abs (ai) <= thresh ? zero (T) : ai, a)
213213 return Poly (anew, p. var)
214214end
215215
216216"""
217- chop(p::Poly{T}; reltol ::Real = Base.rtoldefault(real(T)), abstol ::Real = 0)
217+ chop(p::Poly{T}; rtol ::Real = Base.rtoldefault(real(T)), atol ::Real = 0)
218218
219219Chop off leading values from a polynomial which are approximately zero. The tolerances
220- `reltol ` and `abstol ` are passed to `isapprox` to check for zeros.
220+ `rtol ` and `atol ` are passed to `isapprox` to check for zeros.
221221"""
222- function chop (p:: Poly{T} ; reltol :: Real = Base. rtoldefault (real (T)),
223- abstol :: Real = 0 ) where {T}
222+ function chop (p:: Poly{T} ; rtol :: Real = Base. rtoldefault (real (T)),
223+ atol :: Real = 0 ) where {T}
224224 c = copy (p. a)
225225 for k= length (c): - 1 : 1
226- if ! isapprox (c[k], zero (T); rtol= reltol , atol= abstol )
226+ if ! isapprox (c[k], zero (T); rtol= rtol , atol= atol )
227227 resize! (c, k)
228228 return Poly (c, p. var)
229229 end
@@ -396,29 +396,29 @@ rem(num::Poly, den::Poly) = divrem(num, den)[2]
396396== (n:: Number , p1:: Poly ) = (p1 == n)
397397
398398"""
399- isapprox{T,S}(p1::Poly{T}, p2::Poly{S}; reltol ::Real = Base.rtoldefault(T,S, 0), abstol ::Real = 0, norm::Function = vecnorm)
399+ isapprox{T,S}(p1::Poly{T}, p2::Poly{S}; rtol ::Real = Base.rtoldefault(T,S, 0), atol ::Real = 0, norm::Function = vecnorm)
400400
401401Truncate polynomials `p1` and `p2`, and compare the coefficient vectors using the
402- given `norm` function. The tolerances `reltol ` and `abstol ` are passed to both
402+ given `norm` function. The tolerances `rtol ` and `atol ` are passed to both
403403`truncate` and `isapprox`.
404404"""
405405function isapprox (p1:: Poly{T} , p2:: Poly{S} ;
406- reltol :: Real = (@compat Base. rtoldefault (T,S, 0 )), abstol :: Real = 0 , norm:: Function = vecnorm) where {T,S}
406+ rtol :: Real = (@compat Base. rtoldefault (T,S, 0 )), atol :: Real = 0 , norm:: Function = vecnorm) where {T,S}
407407 p1. var == p2. var || error (" Polynomials must have same variable" )
408- p1t = truncate (p1; reltol = reltol, abstol = abstol )
409- p2t = truncate (p2; reltol = reltol, abstol = abstol )
410- length (p1t) == length (p2t) && isapprox (coeffs (p1t), coeffs (p2t); rtol = reltol ,
411- atol = abstol , norm = norm)
408+ p1t = truncate (p1; rtol = rtol, atol = atol )
409+ p2t = truncate (p2; rtol = rtol, atol = atol )
410+ length (p1t) == length (p2t) && isapprox (coeffs (p1t), coeffs (p2t); rtol = rtol ,
411+ atol = atol , norm = norm)
412412end
413413
414- function isapprox (p1:: Poly{T} , n:: S ; reltol :: Real = (@compat Base. rtoldefault (T,S, 0 )),
415- abstol :: Real = 0 ) where {T,S<: Number }
416- p1t = truncate (p1; reltol = reltol, abstol = abstol )
417- degree (p1t) == 0 && isapprox (coeffs (p1), [n]; rtol = reltol , atol = abstol )
414+ function isapprox (p1:: Poly{T} , n:: S ; rtol :: Real = (@compat Base. rtoldefault (T,S, 0 )),
415+ atol :: Real = 0 ) where {T,S<: Number }
416+ p1t = truncate (p1; rtol = rtol, atol = atol )
417+ degree (p1t) == 0 && isapprox (coeffs (p1), [n]; rtol = rtol , atol = atol )
418418end
419419
420- isapprox (n:: S , p1:: Poly{T} ; reltol :: Real = (@compat Base. rtoldefault (T,S, 0 )),
421- abstol :: Real = 0 ) where {T,S<: Number } = isapprox (p1, n; reltol = reltol, abstol = abstol )
420+ isapprox (n:: S , p1:: Poly{T} ; rtol :: Real = (@compat Base. rtoldefault (T,S, 0 )),
421+ atol :: Real = 0 ) where {T,S<: Number } = isapprox (p1, n; rtol = rtol, atol = atol )
422422
423423hash (f:: Poly , h:: UInt ) = hash (f. var, hash (f. a, h))
424424isequal (p1:: Poly , p2:: Poly ) = hash (p1) == hash (p2)
0 commit comments