Skip to content

Commit 041fd67

Browse files
committed
Merge branch 'refactor' of github.com:mileslucas/polynomials.jl into refactor
2 parents 900e900 + ab890ce commit 041fd67

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

README.md

Lines changed: 11 additions & 10 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
13+
```julia-repl
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
30+
```julia-repl
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
37+
```julia-repl
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
44+
```julia-repl
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
51+
```julia-repl
5252
julia> p = Polynomial([1, 0, -1])
5353
julia> p(0.1)
5454
0.99
@@ -57,7 +57,8 @@ julia> p(0.1)
5757
#### Arithmetic
5858

5959
The usual arithmetic operators are overloaded to work on polynomials, and combinations of polynomials and scalars.
60-
```julia
60+
61+
```julia-repl
6162
julia> p = Polynomial([1,2])
6263
Polynomial(1 + 2x)
6364
@@ -85,7 +86,7 @@ Polynomial(0.25 - 0.5x)
8586

8687
Note that operations involving polynomials with different variables will error.
8788

88-
```julia
89+
```julia-repl
8990
julia> p = Polynomial([1, 2, 3], :x)
9091
julia> q = Polynomial([1, 2, 3], :s)
9192
julia> p + q
@@ -98,7 +99,7 @@ Integrate the polynomial `p` term by term, optionally adding constant
9899
term `k`. The order of the resulting polynomial is one higher than the
99100
order of `p`.
100101

101-
```julia
102+
```julia-repl
102103
julia> integral(Polynomial([1, 0, -1]))
103104
Polynomial(x - 0.3333333333333333x^3)
104105
@@ -109,7 +110,7 @@ Polynomial(2.0 + x - 0.3333333333333333x^3)
109110
Differentiate the polynomial `p` term by term. The order of the
110111
resulting polynomial is one lower than the order of `p`.
111112

112-
```julia
113+
```julia-repl
113114
julia> derivative(Polynomial([1, 3, -1]))
114115
Polynomial(3 - 2x)
115116
```
@@ -121,7 +122,7 @@ Return the roots (zeros) of `p`, with multiplicity. The number of
121122
roots returned is equal to the order of `p`. By design, this is not type-stable,
122123
the returned roots may be real or complex.
123124

124-
```julia
125+
```julia-repl
125126
julia> roots(Polynomial([1, 0, -1]))
126127
2-element Array{Float64,1}:
127128
-1.0

0 commit comments

Comments
 (0)