johnmyleswhite/ContinuedFractions.jl
Fork: 13 Star: 12 (更新于 2024-11-28 06:27:07)
license: NOASSERTION
Language: Julia .
Types and functions for working with continued fractions in Julia
ContinuedFractions.jl
Usage
julia> using ContinuedFractions
julia> cf = ContinuedFraction(sqrt(2))
ContinuedFraction{Int64}([1,2,2,2,2,2,2,2,2,2 … 2,2,2,2,2,2,2,2,2,3])
julia> collect(convergents(cf))
22-element Array{Rational{Int64},1}:
0//1
1//1
3//2
7//5
17//12
41//29
99//70
239//169
577//408
1393//985
⋮
47321//33461
114243//80782
275807//195025
665857//470832
1607521//1136689
3880899//2744210
9369319//6625109
22619537//15994428
77227930//54608393
For additional significant digits you can use BigInt / BigFloat.
julia> cf = ContinuedFraction(sqrt(big(2)))
julia> collect(convergents(cf))
101-element Array{Rational{BigInt},1}:
1//1
3//2
7//5
17//12
41//29
99//70
239//169
577//408
1393//985
3363//2378
8119//5741
19601//13860
47321//33461
⋮
14085805418356991727446091676022499//9960168529794442859224531878561050
34006142477945877445895155433144599//24045973948151434586670623554583549
82098090374248746619236402542311697//58052116426097312032565778987728148
198202323226443370684367960517767993//140150206800346058651802181530039845
478502736827135487987972323577847683//338352530026789429336170142047807838
1155207796880714346660312607673463359//816855266853924917324142465625655521
2788918330588564181308597538924774401//1972063063734639263984455073299118880
6733044458057842709277507685523012161//4760981394323203445293052612223893281
16255007246704249599863612909970798723//11494025852381046154570560297746905442
39243058951466341909004733505464609607//27749033099085295754434173207717704165
94741125149636933417873079920900017937//66992092050551637663438906713182313772
228725309250740208744750893347264645481//161733217200188571081311986634082331709
最近版本更新:(数据更新于 1970-01-01 00:00:00)
johnmyleswhite/ContinuedFractions.jl同语言 Julia最近更新仓库
2024-09-13 13:29:38 jump-dev/JuMP.jl
2024-02-17 06:31:27 JuliaPackaging/BinaryBuilder.jl
2023-09-14 22:59:09 JuliaStats/GLM.jl
2023-08-29 00:30:41 andreasKroepelin/polylux
2023-07-28 03:48:40 invenia/ExprTools.jl
1970-01-01 00:00:00 UnofficialJuliaMirror/BioCore.jl-37cfa864-2cd6-5c12-ad9e-b6597d696c81