Skip to content

Commit 75eb8eb

Browse files
committed
Add support for arbitrary precision arithmetic
1 parent 50da5f1 commit 75eb8eb

File tree

4 files changed

+190
-139
lines changed

4 files changed

+190
-139
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LegendrePolynomials"
22
uuid = "3db4a2ba-fc88-11e8-3e01-49c72059a882"
3-
version = "0.1.0"
3+
version = "0.2.0"
44

55
[deps]
66
HyperDualNumbers = "50ceba7f-c3ee-5a84-a6e8-3ad40456ec97"

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ The package depends on `HyperDualNumbers` and `OffsetArrays`.
1515
To install the package, run
1616

1717
```julia
18-
] add https://github.com/jishnub/LegendrePolynomials.jl.git
19-
using LegendrePolynomials
18+
] add LegendrePolynomials
2019
```
2120

2221
## Using
@@ -40,6 +39,19 @@ julia> @btime Pl(0.5,1_000_000)
4039
-0.0006062610545162491
4140
```
4241

42+
The accuracy can be increased by using Arbitrary Precision Arithmetic, through the use of
43+
`BigInt` and `BigFloat`. This comes at the expense of performance though.
44+
45+
```julia
46+
julia> @btime Pl(1/3,1_000)
47+
11.135 μs (0 allocations: 0 bytes)
48+
0.01961873093750127
49+
50+
julia> @btime Pl(big(1)/3,1_000)
51+
1.751 ms (58965 allocations: 3.13 MiB)
52+
0.01961873093750094969323575593064773353450010511010742490834078609343359408691498
53+
```
54+
4355
The way to compute the derivatives is through `dPl(x,l)` and `d2Pl(x,l)`, for example
4456

4557
```julia
@@ -70,7 +82,7 @@ julia> Pl_dPl_d2Pl(0.5,5)
7082

7183
The second class of methods return all the polynomials up to a cutoff degree `lmax`. They are returned as `OffsetArrays` that have 0-based indexing, keeping in mind that the polynomials start from `l=0`.
7284

73-
The polynomials and their derivatives can be computed in general by calling the function `P(x;lmax)`, where `P` has to be chosen appropriately as necessary. The keyword argument has to be specified in the allocating functions, whereas it can be inferred from the array in the non-allocating versions.
85+
The polynomials and their derivatives can be computed in general by calling the function `P(x;lmax)`, where `P` has to be chosen appropriately as necessary. The keyword argument has to be specified in the allocating functions, whereas it may be inferred from the array in the non-allocating versions.
7486

7587
An example of the allocating functions are
7688

0 commit comments

Comments
 (0)