Skip to content

Commit 5380fb7

Browse files
committed
Merge branch 'refactor' of github.com:mileslucas/polynomials.jl into refactor
2 parents 6ffb392 + a3df2d8 commit 5380fb7

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Basic arithmetic, integration, differentiation, evaluation, and root finding ove
1010

1111
## Installation
1212

13-
```julia-repl
13+
```julia
1414
(v1.2) pkg> add Polynomials
1515

1616
julia> using Polynomials
@@ -27,28 +27,28 @@ julia> using Polynomials
2727

2828
Construct a polynomial from its coefficients, lowest order first.
2929

30-
```julia-repl
30+
```julia
3131
julia> Polynomial([1,0,3,4])
3232
Polynomial(1 + 3x^2 + 4x^3)
3333
```
3434

3535
An optional variable parameter can be added.
3636

37-
```julia-repl
37+
```julia
3838
julia> Polynomial([1,2,3], :s)
3939
Polynomial(1 + 2s + 3s^2)
4040
```
4141

4242
Construct a polynomial from its roots.
4343

44-
```julia-repl
44+
```julia
4545
julia> fromroots([1,2,3]) # (x-1)*(x-2)*(x-3)
4646
Polynomial(-6 + 11x - 6x^2 + x^3)
4747
```
4848

4949
Evaluate the polynomial `p` at `x`.
5050

51-
```julia-repl
51+
```julia
5252
julia> p = Polynomial([1, 0, -1])
5353
julia> p(0.1)
5454
0.99
@@ -58,7 +58,7 @@ julia> p(0.1)
5858

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

61-
```julia-repl
61+
```julia
6262
julia> p = Polynomial([1,2])
6363
Polynomial(1 + 2x)
6464

@@ -86,7 +86,7 @@ Polynomial(0.25 - 0.5x)
8686

8787
Note that operations involving polynomials with different variables will error.
8888

89-
```julia-repl
89+
```julia
9090
julia> p = Polynomial([1, 2, 3], :x)
9191
julia> q = Polynomial([1, 2, 3], :s)
9292
julia> p + q
@@ -99,7 +99,7 @@ Integrate the polynomial `p` term by term, optionally adding constant
9999
term `k`. The order of the resulting polynomial is one higher than the
100100
order of `p`.
101101

102-
```julia-repl
102+
```julia
103103
julia> integrate(Polynomial([1, 0, -1]))
104104
Polynomial(x - 0.3333333333333333x^3)
105105

@@ -110,7 +110,7 @@ Polynomial(2.0 + x - 0.3333333333333333x^3)
110110
Differentiate the polynomial `p` term by term. The order of the
111111
resulting polynomial is one lower than the order of `p`.
112112

113-
```julia-repl
113+
```julia
114114
julia> derivative(Polynomial([1, 3, -1]))
115115
Polynomial(3 - 2x)
116116
```
@@ -122,7 +122,7 @@ Return the roots (zeros) of `p`, with multiplicity. The number of
122122
roots returned is equal to the order of `p`. By design, this is not type-stable,
123123
the returned roots may be real or complex.
124124

125-
```julia-repl
125+
```julia
126126
julia> roots(Polynomial([1, 0, -1]))
127127
2-element Array{Float64,1}:
128128
-1.0
@@ -161,8 +161,7 @@ Visual example:
161161

162162
Polynomial objects also have other methods:
163163

164-
* 0-based indexing is used to extract the coefficients of $a_0 + a_1
165-
x + a_2 x^2 + ...$, coefficients may be changed using indexing
164+
* 0-based indexing is used to extract the coefficients of `[a0, a1, a2, ...]`, coefficients may be changed using indexing
166165
notation.
167166

168167
* `coeffs`: returns the entire coefficient vector

0 commit comments

Comments
 (0)