JuliaApproximation / ContinuumArrays.jl

A package for representing quasi arrays with continuous indices
MIT License
27 stars 6 forks source link

Expansion short cut #131

Open dlfivefifty opened 2 years ago

dlfivefifty commented 2 years ago

A common pattern to expand a function is:

P = Legendre()
x = axes(P,1)
f = P / P \ exp.(x)

But perhaps a shortcut would be useful so this is one line:

expand(Legendre(), exp)

That is, add the function:

function expand(P, f)
    x = axes(P,1)
    P / P \ f.(x)
end
TSGut commented 2 years ago

Yes, this is a good idea. I think for people who may really only want to do very specific computations with the packages (sort of like what I've seen some people do with ApproxFun), having syntax that can side-step the quasimatrix concept would be helpful. And it would make the docs easier to understand if we can compare the two syntax options and say they do the same thing.

It may even be worth having an optional integer argument that gives you only the first $N$ entries of the vector (without computing the whole thing to convergence).