Comments (6)
Now works!
julia> legendrep.(0:9,z)
10-element Vector{Num}:
1
z
1.5(z^2) - 0.5
1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)
0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))
0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))
0.9375(z^2) + 1.8333333333333333z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))) - 0.3125 - (1.4583333333333335z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))
1.142857142857143z*(1.5(z^2) - 0.5) + 1.8571428571428572z*(0.9375(z^2) + 1.8333333333333333z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))) - 0.3125 - (1.4583333333333335z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.45714285714285713z) - (1.5428571428571427z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))))
0.2734375 + 1.2760416666666667z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) + 1.875z*(1.142857142857143z*(1.5(z^2) - 0.5) + 1.8571428571428572z*(0.9375(z^2) + 1.8333333333333333z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))) - 0.3125 - (1.4583333333333335z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.45714285714285713z) - (1.5428571428571427z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))))) - (0.8203125(z^2)) - (1.6041666666666665z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))))
0.4063492063492063z + 1.3714285714285712z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) + 1.8888888888888888z*(0.2734375 + 1.2760416666666667z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) + 1.875z*(1.142857142857143z*(1.5(z^2) - 0.5) + 1.8571428571428572z*(0.9375(z^2) + 1.8333333333333333z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))) - 0.3125 - (1.4583333333333335z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.45714285714285713z) - (1.5428571428571427z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))))) - (0.8203125(z^2)) - (1.6041666666666665z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))))) - (1.015873015873016z*(1.5(z^2) - 0.5)) - (1.6507936507936507z*(0.9375(z^2) + 1.8333333333333333z*(0.5333333333333333z + 1.8z*(0.375 + 1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (1.125(z^2))) - (1.3333333333333335z*(1.5(z^2) - 0.5))) - 0.3125 - (1.4583333333333335z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))))
from classicalorthogonalpolynomials.jl.
Note you should use legendrep(0:9,z)
, which is equivalent to Base.unsafe_getindex(Legendre{typeof(z)}(), z, 1:10)
.
But that still doesn't solve the issue since we can't make ranges:
julia> zero(typeof(z)):10
ERROR: MethodError: no method matching round(::Num, ::RoundingMode{:Down})
Closest candidates are:
round(::Real, ::RoundingMode; digits, sigdigits, base) at floatfuncs.jl:129
round(::Complex, ::RoundingMode) at complex.jl:1038
round(::Complex, ::RoundingMode, ::RoundingMode; kwargs...) at complex.jl:1038
...
Stacktrace:
[1] round(x::Num, r::RoundingMode{:Down}; digits::Nothing, sigdigits::Nothing, base::Nothing)
@ Base ./floatfuncs.jl:135
[2] round(x::Num, r::RoundingMode{:Down})
@ Base ./floatfuncs.jl:131
[3] floor(x::Num; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./floatfuncs.jl:155
[4] floor(x::Num)
@ Base ./floatfuncs.jl:155
[5] unitrange_last(start::Num, stop::Num)
@ Base ./range.jl:294
[6] UnitRange{Num}(start::Num, stop::Num)
@ Base ./range.jl:287
[7] (::Colon)(start::Num, stop::Num)
@ Base ./range.jl:5
[8] (::Colon)(a::Num, b::Int64)
@ Base ./range.jl:3
[9] top-level scope
@ REPL[24]:1
julia> zero(typeof(z)):∞
ERROR: TypeError: non-boolean (Num) used in boolean context
Stacktrace:
[1] Colon
@ ~/.julia/packages/InfiniteArrays/3DoXV/src/infrange.jl:19 [inlined]
[2] (::Colon)(a::Num, b::Infinities.Infinity)
@ InfiniteArrays ~/.julia/packages/InfiniteArrays/3DoXV/src/infrange.jl:16
[3] top-level scope
@ REPL[25]:1
Here's a work around:
julia> Base.:(:)(a::Num, ::Infinities.Infinity) = InfiniteArrays.InfUnitRange(a)
julia> legendrep.(0:9,z)
10-element Vector{Num}:
1
z
1.5(z^2) - 0.5
1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)
1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))
1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))
1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))
1.8571428571428572z*(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))) - (0.8571428571428571(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))))
1.875z*(1.8571428571428572z*(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))) - (0.8571428571428571(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))))) - (0.875(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))))
1.8888888888888888z*(1.875z*(1.8571428571428572z*(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))) - (0.8571428571428571(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))))) - (0.875(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))))) - (0.8888888888888888(1.8571428571428572z*(1.8333333333333333z*(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))) - (0.8333333333333334(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))))) - (0.8571428571428571(1.8z*(1.75z*(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)) - (0.75(1.5(z^2) - 0.5))) - (0.8(1.6666666666666667z*(1.5(z^2) - 0.5) - (0.6666666666666666z)))))))
from classicalorthogonalpolynomials.jl.
The issue may be in Symbolics.jl: is this really desirable behaviour?
julia> sign(one(z))
sign(1)
from classicalorthogonalpolynomials.jl.
Thanks for the quick check!
Great to see that it is potentially working
from classicalorthogonalpolynomials.jl.
Do you know if it's possible to tell z
to work over the rationals instead of Float64
? Then it'd be completely symbolic
from classicalorthogonalpolynomials.jl.
great to see it working with Floats. I do not know about the rational
from classicalorthogonalpolynomials.jl.
Related Issues (20)
- Quadratically shifted bases HOT 4
- Stackoverflow for P'P
- Lanczos Jacobi matrices and `^` HOT 2
- long compilation time for Jacobi(m,n) \ Jacobi(0,0) HOT 3
- Chebyshev() \ exp.(im*x) errors
- Make P[0.1,10] allocation free
- Ambiguities in ClassicalOrthogonalPolynomials and its dependencies
- Fourier{BigFloat} HOT 6
- UndefVarError in docs HOT 2
- Cholesky Jacobi matrices are insanely slow HOT 9
- Infinite loop converting between ChebyshevU and Ultraspherical HOT 1
- Can't print slices of orthogonal polynomials
- Can't compute scalar times squared jacobmatrix HOT 3
- A \ B never completes when B is a `Normalized` basis HOT 2
- no method matching combine_axes() when indexing a transposed \(A, B)
- copy(Ldiv(A, B)) for Normalized(A) and Weighted(Normalized(B)) ambiguity
- Clenshaw errs with degree-0 polynomial
- Identity mapping wT -> wU HOT 1
- How to cite the package? HOT 4
- How to get BigFloat accurate conversion operators? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classicalorthogonalpolynomials.jl.