Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sheehan Olver
    @dlfivefifty

    Not an easy way.

    I take that back. I think you can always do ApproxFun.SpaceOperator(op, newdomainspace, newrangespace) change the spaces of an operator. So just write Q with the "right" spaces

    Is this the style ApproxFun is expected to be used?

    In Julia, capital letters are only used when it returns a special type of the same name. So this would be better as lower case. Also, there is support for Green's functions in https://github.com/JuliaApproximation/SingularIntegralEquations.jl including Helmholtz / hankel kernels

    Mitko Georgiev
    @mitkoge
    I see. I will check SpaceOperator and will have to learn what rangespace is.
    And thank you for the link. It is probably some more efficient implementation? Will check it.
    I tried hankel as an learning example.
    The kind of high level style the ApproxFun works is fascinating me.
    Like a poetry for the crowd. I do not necessarily understand but like it. :-)
    Mitko Georgiev
    @mitkoge
    here is the revised
    function hankel(fx::Fun, spx,spa::Space)
        spxa= spx ⊗ spa
        fx2= Fun((x,a)-> fx(x), spxa)
        fjx= Fun((x,a)-> x*besselj0(x*a), spxa)
        fa2= (DefiniteIntegral(spx.domain) ⊗ I)*(fx2*fjx)
        fa= Fun(a->fa2(0,a), spa)
    end
    Mitko Georgiev
    @mitkoge

    when i blind try

    spx= Space(0..1); spa= Space(0..π); spxa= spx ⊗ spa
    Q2= DefiniteIntegral(spx.domain) ⊗ I
    Q1= ApproxFun.SpaceOperator(Q2, spxa, spa ) 
    
    x=Fun((x,a)->x,spxa); a=Fun((x,a)->a,spxa)
    (Q2*(x*a))(0,1)  #=0.5
    (Q1*(x*a))(1)      #=0.5*pi/2

    it seems to work up to scaling cofficient

    Mitko Georgiev
    @mitkoge
    i gues it is because the default domain for I is -1..1
    Mitko Georgiev
    @mitkoge
    may i ask if a least quare fit by bivariate Fun to data is possible?
    Given data is Array{Float64,2}.
    I liked your nice 1D example from the docs and wonder how to extend to 2D.
    Sheehan Olver
    @dlfivefifty
    Yes an example is in the FAQ
    Mitko Georgiev
    @mitkoge
    Thank you! I found it and will have a look.
    Is the example for standard grid ponts also extendable for 2D?
    Or it is not preferable because data points in 2D are mostly large ammont?
    Art Gower
    @arturgower

    I'm quite sure Fun used to work on intervals in the complex domain. But now

    f(x) = cos(x)
    Fun(f, Interval(1.0+1.0im, 2.0+2.0im))

    throws the error

    ERROR: MethodError: no method matching isless(::Complex{Float64}, ::Complex{Float64})
    Closest candidates are:
      isless(::Missing, ::Any) at missing.jl:66
      isless(::InfiniteArrays.OrientedInfinity{Bool}, ::Number) at /.julia/packages/InfiniteArrays/Z4yap/src/Infinity.jl:145
      isless(::Number, ::InfiniteArrays.OrientedInfinity{Bool}) at /.julia/packages/InfiniteArrays/Z4yap/src/Infinity.jl:144
      ...
    Stacktrace:
     [1] <(::Complex{Float64}, ::Complex{Float64}) at ./operators.jl:260
     [2] >(::Complex{Float64}, ::Complex{Float64}) at ./operators.jl:286
     [3] isempty(::Interval{:closed,:closed,Complex{Float64}}) at /.julia/packages/IntervalSets/xr34V/src/IntervalSets.jl:153
    Sheehan Olver
    @dlfivefifty
    Use Segment(a,b) for line segments in the complex plane. (The previous support for intervals in the complex plane violated the definition of an interval.)
    Art Gower
    @arturgower
    A ha! Yes I see. Thanks so much
    Shi Pengcheng
    @shipengcheng1230

    Hello, I was playing around with the poisson equation example and wonder if I could replace the RHS ff with something like δ(x)δ(y)\delta (x) \delta (y). I tried to construct the RHS like this:

    fx = KroneckerDelta()
    fy = KroneckerDelta()
    f = Fun((x,y) -> fx(x) * fy(y))

    But I got the error that ERROR: MethodError: no method matching isless(::Int64, ::Nothing). What is the proper way for me to do that? Thanks in advance!

    Sheehan Olver
    @dlfivefifty
    Essentially you want to calculate the Greens function? That’s a tough question which we are looking at right now.
    Shi Pengcheng
    @shipengcheng1230
    Thanks for the reply. I guess I have to wait for now :)
    Quentin C.
    @robocop
    Hello ! I would like to consider ApproxFun for the following problem: I have a N-L operator Phi: L_s -> L_s, where L_s is the set of continuous functions that goes exponentially fast to zero at speed s > 0, that is: x belongs to Ls if \sup{t \geq 0} |x(t)| e^{s t} < +oo. Moreover given x in L_s, Phi(x) is the solution of a Volterra integral equation of the form Phi(x)(t) = K_0(x)(t) + \int_0^t{K(x) (t, u)Phi(x) (u) du}, where the Kernels K_0(x) and K(x) are known explicitly in term of x. I would like to compute the spectrum of the Frechet differential of Phi at the point x = 0. Do you think it is possible to do that?
    Let me know if the question is unclear... I do not have a background in numerical simulations. Thanks :)
    Quentin C.
    @robocop
    I think I have started to understand how to do that with ApproxFun. But, I have got few questions. How to encode the domain R+\mathbb{R}_+?
    and how to encode {(x,y)mathbbR+,xy}\{ (x, y) \in mathbb{R}_+, x \geq y \} ?
    Quentin C.
    @robocop
    More generally the fact that I want to work on R+\mathbb{R}_+ and not on a segment seems to be a problem. Is that correct?
    Sheehan Olver
    @dlfivefifty
    Sorry forgot to reply. I have a student working on Volterra integral equations so once that’s up and running your problem should be easy. We’d love to know the application so we can mention it in the paper
    Quentin C.
    @robocop
    Ok great! Looking forward to see that. The Volterra equation I am looking at appears in a neuroscience problem (see https://arxiv.org/abs/1810.08562) The dynamic of the mean-field network can be reduce to a N-L Volterra equation (see equations (7) and (8) of the paper). Btw the same problem can be solved numerically by looking at the associated PDE (see equation (3)) - but I am curious to know if more efficient numerically methods can be develop by specifically exploit this Volterra equation.
    Art Gower
    @arturgower
    Hello! For the space of Jacobi polynomials, what package does ApproxFun use? Or is it internally implemented? I struggled to find it in the code... =(
    Sheehan Olver
    @dlfivefifty
    Internal: see src/Spaces/Jacobi
    Art Gower
    @arturgower
    Cheers! What method do you use: is it Clenshaw for all PolynomialSpaces? In which case, where do you specify the recurrence relation?
    Sheehan Olver
    @dlfivefifty
    Yes. There’s a bunch of recα , etc., overrides
    Clenshaw is implemented in PolynomialSpace.jl
    Art Gower
    @arturgower
    thanks, I get it now
    Mitko Georgiev
    @mitkoge
    May i ask may be not directly related to ApproxFun
    I found FastAsyTransforms.m on github and wondered if such functionality is already available as julia code?
    I looked at FastTransforms.jl but could not find something like a HankelTransform. Would you kindly direct?
    May be SingularIntegralEquations.jl? But no idea how to start with it? Or other place?
    Sheehan Olver
    @dlfivefifty
    @MikaelSlevinsky should be able to help, but I'm not aware of anything.
    Christoph Ortner
    @cortner

    I’m trying to implement something like this FAQ example,

    S = Chebyshev(1..2);
    p = points(S,20); # the default grid
    v = exp.(p);      # values at the default grid
    f = Fun(S,ApproxFun.transform(S,v));

    but multi-variate (2D tensor Chebyshev will do). The canonical thing,

    S = Chebyshev((1..2)^2)
    p = points(S, 20)

    errors. Of course I could just construct the points via tensor products, but then I’m unsure how to use the ApproxFun.transform(S,v) correctly. Is this documented somewhere? Is there an example I can look at?

    Basically, I just want to freeze the polynomial degree, rather than prescribe a solver tolerance.

    Sheehan Olver
    @dlfivefifty
    You want Chebyshev(1..2)^2. It actually uses Padua points so if you say ` Fun(f, S, div(n*(n+1),2)) it should give the degree n interpolant.
    Christoph Ortner
    @cortner
    Interesting - thanks. are tensor product grids a special case of these?
    I didn’t know about this family of points, readig up on it now, very very interesting...
    Sheehan Olver
    @dlfivefifty
    No, but anything other than Chebyshev^2 will use a tensor grid. Padua points are nice because you don’t oversample, and the transform is a single one dimensional DCT (though as implemented we form a tensor product by filling with zeros and use the 2D DCT, which due to aliasing we can recover the coefficients)
    There’s a Chebfun example describing it
    Christoph Ortner
    @cortner
    So this is very interesting, but for teaching purposes I would have still preferred the standard tensor Chebyshev grid. But this is not as straightforward?
    Sheehan Olver
    @dlfivefifty
    If you comment out the lines after ## Multivariate in https://github.com/JuliaApproximation/ApproxFun.jl/blob/master/src/Spaces/Chebyshev/Chebyshev.jl it will go back to the default tensor version, probably a keyword would be appropriate here to allow switching
    Christoph Ortner
    @cortner
    ok - I’ll try
    thanks for the suggestions
    Christoph Ortner
    @cortner
    Do I understand correctly that if I wanted to have fast and direct access to the transforms between the various spaces then it would be best to go around ApproxFun.jl and use FastTransforms.jl directly?
    Though I’d probably still need ApproxFun to evaluate the basis functions...
    In general, I wonder whether a “manual mode” of ApproxFun might be useful. I noticed e.g. that restricting the degree in \ rather than the tolerance throws warnings even if it is intended. By “manual mode” I mean non-adaptive.
    Sheehan Olver
    @dlfivefifty
    The long term plan is to do “Manual mode” via https://github.com/JuliaApproximation/ContinuumArrays.jl. This will also support FEM (in fact @jagot has a package for splines building on ContinuumArrays.jl) and make it possible to use distributed memory.
    Stefanos Carlström
    @jagot
    Actually, I don't, yet :)
    I have a FEDVR package
    But that is a bit limited at the moment, in that it only supports Dirichlet1 boundary conditions, since I've yet to fix the issue with restriction matrices (i.e. dropping the first and last basis functions)
    Sheehan Olver
    @dlfivefifty
    In any case, it’s kind of on the back burner as I have a backlog of about 10 papers to finish (and probably papers help more with promotion then making another package that does basically the same thing as ApproxFun 😅). But the basics are already implemented.
    Mitko Georgiev
    @mitkoge
    Thank you @dlfivefifty ,
    i think i will start with reading the Alex Townsend's paper behind FastAsyTransforms.mand may be in long turn
    i may figure out how to do HankelTransform(Fun)->Fun.
    Don MacMillen
    @macd
    I guess I don't really understand the support for Complex numbers in ApproxFun. If I try to evaluate a complex argument to a Fun(cos) then it returns zero if the imaginary part is non zero. Curiously, it will return a complex number with a correct real part if the imaginary part of the input is zero. Also, I can easily create Fun's with complex coefficients that will return a complex number when evaluating a real number, but again will return zero if the imaginary part is non-zero. Here are a few examples. (I believe all of these work in Chebfun, btw.)
    julia (v1.2)> f = Fun(cos);
    
    julia (v1.2)> f(.1)
    0.9950041652780257
    
    julia (v1.2)> f(.1 + .1im)
    0.0
    
    julia (v1.2)> f(.1 + .0im)
    0.9950041652780257 + 0.0im
    
    julia (v1.2)> g = Fun(Chebyshev(), randn(Complex{Float64}, 20));
    
    julia (v1.2)> g(.1)
    2.1013219596855888 - 0.11052912191219874im
    
    julia (v1.2)> g(.1 + .1im)
    0.0 + 0.0im
    
    julia (v1.2)> cos(.1 + .1im)
    0.9999833333373015 - 0.00999998888888977im