Skip to content

LauraBMo/BudanTables.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BudanTables.jl https://img.shields.io/badge/docs-stable-blue.svg https://img.shields.io/badge/docs-dev-blue.svg https://github.com/LauraBMo/BudanTables.jl/workflows/CI/badge.svg https://codecov.io/gh/LauraBMo/BudanTables.jl/branch/master/graph/badge.svg

Install

add https://github.com/LauraBMo/BudanTables.jl.git

or

import Pkg
Pkg.add(url="https://github.com/LauraBMo/BudanTables.jl.git")

Introduction

Plots the Budan’s table of a polynomial (see https://hal.inria.fr/hal-00653762/document). The type T representing polynomials needs methods

  • BudanTables.degree(p::T) and BudanTables.derivative(p::T, i::Int) must be defined,
  • and it have to be compatible with the function _ROOTS computing roots (see set_getting_roots help).

The defaults are type Polynomial and function Polynomials.roots from Polynomials.jl. But, if PolynomialRoots.jl is loaded, it uses PolynomialRoots.roots (accepting polynomials of type Polynomial).

Examples

Default use, type Polynomials and roots Polynomials.roots

using Plots
using Polynomials
using BudanTables
P = fromroots([0,0,1,2,2,4,4])
budantable(P)

Use type Polynomials and roots PolynomialRoots.roots

using Plots
using Polynomials
using PolynomialRoots
using BudanTables
P = fromroots([0,0,1,2,2,4,4])
budantable(P)

Or define our own API for julia vectors:

Type Vector and roots PolynomialRoots.roots

using Plots
using BudanTables

# Setting function to compute roots from a polynomial represented
# as a vector.
import PolynomialRoots
_BigFloat(A::AbstractArray) = BigFloat.(A)
# Notice we do not precompose by `coeffs`
set_getting_roots(PolynomialRoots.roots_BigFloat)

BudanTables.degree(v::AbstractVector) = length(v) - 1
BudanTables.derivative(v::AbstractVector) = .*(v[begin+1:end], 1:(length(v)-1))
function BudanTables.derivative(v::AbstractVector, i::Int)
    out = copy(v)
    while i > 0
        i-=1
        out = derivative(out)
    end
    return out
end

import Polynomials
P = Polynomials.coeffs(Polynomials.fromroots([0,0,1,2,2,4,4]))
budantable(P)

About

Package for ploting Budan's tables (see https://hal.inria.fr/hal-00653762/document)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages