Skip to content

Commit 647cb67

Browse files
authored
Use github math display in readme (#415)
* Use github math display in readme * Fix missing math section
1 parent d554649 commit 647cb67

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,46 @@ This package supports Julia v1.6 and later.
1717

1818
## Available Types of Polynomials
1919

20-
* `Polynomial` –⁠ standard basis polynomials, `a(x) = a₀ + a₁ x + a₂ x² + … + aₙ xⁿ`, `n ≥ 0`
20+
* `Polynomial` –⁠ standard basis polynomials, $a(x) = a_0 + a_1 x + a_2 x^2 + … + a_n x^n$ for $n ≥ 0$.
2121
* `ImmutablePolynomial` –⁠ standard basis polynomials backed by a [Tuple type](https://docs.julialang.org/en/v1/manual/functions/#Tuples-1) for faster evaluation of values
2222
* `SparsePolynomial` –⁠ standard basis polynomial backed by a [dictionary](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1) to hold sparse high-degree polynomials
23-
* `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ⁿ`
23+
* `LaurentPolynomial` –⁠ [Laurent polynomials](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1), $a(x) = a_m x^m + … + a_n x^n$ for $m ≤ n$ and $m,n ∈ ℤ$. This is backed by an [offset array](https://github.com/JuliaArrays/OffsetArrays.jl); for example, if $m<0$ and $n>0$, we obtain $a(x) = a_m x^m + … + a_{-1} x^{-1} + a_0 + a_1 x + … + a_n x^n$
2424
* `FactoredPolynomial` –⁠ standard basis polynomials, storing the roots, with multiplicity, and leading coefficient of a polynomial
2525
* `ChebyshevT` –⁠ [Chebyshev polynomials](https://en.wikipedia.org/wiki/Chebyshev_polynomials) of the first kind
2626
* `RationalFunction` - a type for ratios of polynomials.
2727

2828
## Usage
2929

30-
```jldoctest
30+
```julia
3131
julia> using Polynomials
3232
```
3333

3434
### Construction and Evaluation
3535

3636
Construct a polynomial from an array (a vector) of its coefficients, lowest order first.
3737

38-
```jldoctest
38+
```julia
3939
julia> Polynomial([1,0,3,4])
4040
Polynomial(1 + 3*x^2 + 4*x^3)
4141
```
4242

4343
Optionally, the variable of the polynomial can be specified.
4444

45-
```jldoctest
45+
```julia
4646
julia> Polynomial([1,2,3], :s)
4747
Polynomial(1 + 2*s + 3*s^2)
4848
```
4949

5050
Construct a polynomial from its roots.
5151

52-
```jldoctest
52+
```julia
5353
julia> fromroots([1,2,3]) # (x-1)*(x-2)*(x-3)
5454
Polynomial(-6 + 11*x - 6*x^2 + x^3)
5555
```
5656

5757
Evaluate the polynomial `p` at `x`.
5858

59-
```jldoctest
59+
```julia
6060
julia> p = Polynomial([1, 0, -1]);
6161
julia> p(0.1)
6262
0.99
@@ -66,7 +66,7 @@ julia> p(0.1)
6666

6767
Methods are added to the usual arithmetic operators so that they work on polynomials, and combinations of polynomials and scalars.
6868

69-
```jldoctest
69+
```julia
7070
julia> p = Polynomial([1,2])
7171
Polynomial(1 + 2*x)
7272

@@ -103,7 +103,7 @@ Polynomial(0.25 - 0.5*x)
103103

104104
Most operations involving polynomials with different variables will error.
105105

106-
```jldoctest
106+
```julia
107107
julia> p = Polynomial([1, 2, 3], :x);
108108
julia> q = Polynomial([1, 2, 3], :s);
109109
julia> p + q
@@ -183,7 +183,7 @@ Integrate the polynomial `p` term by term, optionally adding a constant
183183
term `k`. The degree of the resulting polynomial is one higher than the
184184
degree of `p` (for a nonzero polynomial).
185185

186-
```jldoctest
186+
```julia
187187
julia> integrate(Polynomial([1, 0, -1]))
188188
Polynomial(1.0*x - 0.3333333333333333*x^3)
189189

@@ -195,7 +195,7 @@ Differentiate the polynomial `p` term by term. For non-zero
195195
polynomials the degree of the resulting polynomial is one lower than
196196
the degree of `p`.
197197

198-
```jldoctest
198+
```julia
199199
julia> derivative(Polynomial([1, 3, -1]))
200200
Polynomial(3 - 2*x)
201201
```
@@ -206,7 +206,7 @@ Polynomial(3 - 2*x)
206206
Return the roots (zeros) of `p`, with multiplicity. The number of
207207
roots returned is equal to the degree of `p`. By design, this is not type-stable, the returned roots may be real or complex.
208208

209-
```jldoctest
209+
```julia
210210
julia> roots(Polynomial([1, 0, -1]))
211211
2-element Vector{Float64}:
212212
-1.0
@@ -227,7 +227,7 @@ julia> roots(Polynomial([0, 0, 1]))
227227

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

230-
```jldoctest
230+
```julia
231231
julia> xs = 0:4; ys = @. exp(-xs) + sin(xs);
232232

233233
julia> fit(xs, ys) |> p -> round.(coeffs(p), digits=4) |> Polynomial

0 commit comments

Comments
 (0)