Skip to content

Commit 88ce29d

Browse files
authored
Merge pull request #253 from hurak/master
Minor polishing of README, mainly formatting.
2 parents 1570dfc + e7fae14 commit 88ce29d

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Polynomials.jl
22

3-
Basic arithmetic, integration, differentiation, evaluation, and root finding over dense univariate polynomials.
3+
Basic arithmetic, integration, differentiation, evaluation, and root finding over dense univariate [polynomials](https://en.wikipedia.org/wiki/Polynomial).
44

55
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaMath.github.io/Polynomials.jl/stable)
66
[![Build Status](https://travis-ci.org/JuliaMath/Polynomials.jl.svg?branch=master)](https://travis-ci.org/JuliaMath/Polynomials.jl)
@@ -10,31 +10,33 @@ Basic arithmetic, integration, differentiation, evaluation, and root finding ove
1010
## Installation
1111

1212
```julia
13-
(v1.4) pkg> add Polynomials
14-
15-
julia> using Polynomials
13+
(v1.5) pkg> add Polynomials
1614
```
1715

18-
## Usage
16+
## Available Types of Polynomials
17+
18+
* `Polynomial` –⁠ standard basis polynomials, `a(x) = a₀ + a₁ x + a₂ x² + … + aₙ xⁿ`, `n ∈ ℕ`
19+
* `ImmutablePolynomial` –⁠ standard basis polynomials backed by a [Tuple type](https://docs.julialang.org/en/v1/manual/functions/#Tuples-1) for faster evaluation of values
20+
* `SparsePolynomial` –⁠ standard basis polynomial backed by a [dictionary](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1) to hold sparse high-degree polynomials
21+
* `LaurentPolynomial` –⁠ [Laurent polynomials](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1), `a(x) = aₘ xᵐ + … + aₙ xⁿ` `m ≤ n`, `m,n ∈ ℤ` backed by an [offset array](https://github.com/JuliaArrays/OffsetArrays.jl); for example, if `m<0` and `n>0`, `a(x) = aₘ xᵐ + … + a₋₁ x⁻¹ + a₀ + a₁ x + … + aₙ xⁿ`
22+
* `ChebyshevT` –⁠ [Chebyshev polynomials](https://en.wikipedia.org/wiki/Chebyshev_polynomials) of the first kind
1923

20-
#### Available Polynomials
24+
## Usage
2125

22-
* `Polynomial` - Standard basis polynomials, `a_0 + a_1⋅x + a_2⋅x^2 + ⋯ + a_n⋅xⁿ`, `n ∈ ℕ`
23-
* `ImmutablePolynomial` - Standard basis polynomials backed by a tuple for faster evaluation of values
24-
* `SparsePolynomial` - Standard basis polynomial backed by a dictionary to hold sparse high-degree polynomials
25-
* `LaurentPolynomial` - Laurent polynomials, `a_m⋅x^m + ⋯ a_n⋅x^n` `m ≤ n`, `m,n ∈ ℤ` backed by an offset array
26-
* `ChebyshevT` - Chebyshev polynomials of the first kind
26+
```julia
27+
julia> using Polynomials
28+
```
2729

28-
#### Construction and Evaluation
30+
### Construction and Evaluation
2931

30-
Construct a polynomial from its coefficients, lowest order first.
32+
Construct a polynomial from an array (a vector) of its coefficients, lowest order first.
3133

3234
```julia
3335
julia> Polynomial([1,0,3,4])
3436
Polynomial(1 + 3x^2 + 4x^3)
3537
```
3638

37-
An optional variable parameter can be added.
39+
Optionally, the variable of the polynomial can be specified.
3840

3941
```julia
4042
julia> Polynomial([1,2,3], :s)
@@ -56,7 +58,7 @@ julia> p(0.1)
5658
0.99
5759
```
5860

59-
#### Arithmetic
61+
### Arithmetic
6062

6163
The usual arithmetic operators are overloaded to work on polynomials, and combinations of polynomials and scalars.
6264

@@ -86,7 +88,7 @@ julia> q ÷ p # `div`, also `rem` and `divrem`
8688
Polynomial(0.25 - 0.5x)
8789
```
8890

89-
Note that operations involving polynomials with different variables will error.
91+
Operations involving polynomials with different variables will error.
9092

9193
```julia
9294
julia> p = Polynomial([1, 2, 3], :x)
@@ -95,11 +97,11 @@ julia> p + q
9597
ERROR: Polynomials must have same variable.
9698
```
9799

98-
#### Integrals and Derivatives
100+
### Integrals and Derivatives
99101

100-
Integrate the polynomial `p` term by term, optionally adding constant
102+
Integrate the polynomial `p` term by term, optionally adding a constant
101103
term `k`. The degree of the resulting polynomial is one higher than the
102-
degree of `p`.
104+
degree of `p` (for a nonzero polynomial).
103105

104106
```julia
105107
julia> integrate(Polynomial([1, 0, -1]))
@@ -117,12 +119,11 @@ julia> derivative(Polynomial([1, 3, -1]))
117119
Polynomial(3 - 2x)
118120
```
119121

120-
#### Root-finding
122+
### Root-finding
121123

122124

123125
Return the roots (zeros) of `p`, with multiplicity. The number of
124-
roots returned is equal to the degree of `p`. By design, this is not type-stable,
125-
the returned roots may be real or complex.
126+
roots returned is equal to the degree of `p`. By design, this is not type-stable, the returned roots may be real or complex.
126127

127128
```julia
128129
julia> roots(Polynomial([1, 0, -1]))
@@ -141,7 +142,7 @@ julia> roots(Polynomial([0, 0, 1]))
141142
0.0
142143
```
143144

144-
#### Fitting arbitrary data
145+
### Fitting arbitrary data
145146

146147
Fit a polynomial (of degree `deg` or less) to `x` and `y` using a least-squares approximation.
147148

@@ -159,7 +160,7 @@ Visual example:
159160

160161
![fit example](https://user-images.githubusercontent.com/14099459/70382587-9e055500-1902-11ea-8952-3f03ae08b7dc.png)
161162

162-
#### Other methods
163+
### Other methods
163164

164165
Polynomial objects also have other methods:
165166

0 commit comments

Comments
 (0)