Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get BigFloat accurate conversion operators? #88

Open
MarcoFasondini opened this issue Feb 10, 2022 · 4 comments
Open

How to get BigFloat accurate conversion operators? #88

MarcoFasondini opened this issue Feb 10, 2022 · 4 comments

Comments

@MarcoFasondini
Copy link
Contributor

For OPs on y⁴ = 1 - x⁴ I need conversion operators between ChebyshevT() and certain semiclassical OPs, e.g.,

T = ChebyshevT{BigFloat}()
x = axes(T,1)
P₁ = LanczosPolynomial( (1 .+ x.^2).^(0.5) )
R₁ = P₁\T

This is accurate to only Float64 precision:

xv = big"0.1"
T[xv,3] - ( P₁[xv,1]*R₁[1,3] + P₁[xv,3]*R₁[3,3] )
-6.05859383536196727705447569248701020544252033186250536144991618812281214296214e-17

Another example:

P = Legendre{BigFloat}()
R = P\T

The entry R[3,3] is 4/3 but it's accurate to only Float64 precision:

R[3,3]
1.333333333333333250903485233170513237354072211061085640237818614115573313606597
@MikaelSlevinsky
Copy link
Member

Legendre to Chebyshev to Legendre transforms are available in FastTransforms in BigFloat.

@dlfivefifty
Copy link
Member

This one is actually subtle:

function \(A::ChebyshevT, B::Legendre)

Here's a MWE:

julia> BroadcastArray{BigFloat}(/, 1:10, 2:11)
(10-element UnitRange{Int64}) ./ (10-element UnitRange{Int64}):
 0.5
 0.66666666666666662965923251249478198587894439697265625
 0.75
 0.8000000000000000444089209850062616169452667236328125
 0.83333333333333337034076748750521801412105560302734375
 0.85714285714285709527615608749329112470149993896484375
 0.875
 0.888888888888888839545643349993042647838592529296875
 0.90000000000000002220446049250313080847263336181640625
 0.90909090909090906063028114658663980662822723388671875

It doesn't know that integer division produces a Float64....

The workaround is to change it to do convert(AbstractVector{T}, 1:∞). Not sure if there's a more general solution.

Can you make this change and add a PR?

@TSGut
Copy link
Member

TSGut commented Aug 21, 2023

@MarcoFasondini Did the PR associated with this (i.e. #89) fix this issue and can it be closed?

@dlfivefifty
Copy link
Member

No its not fixed yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants