On Tuesday, April 7, 2015 at 5:53:09 PM UTC-4, Sheehan Olver wrote:
>
>
>         The current problem is 
>
>         f=Fun(x->x^2,Chebyshev(Interval(a,b))) 
>
> represents a function on [a,b] as type Fun{Float64,Chebyshev}.  But 
> sometimes one needs to convert numbers to functions a la 
>
>         convert(typeof(f),5) 
>
> e.g., as part of creating the vector [f,5].  Since the parameters a and b 
> are not inferable, the current solution is for Chebyshev to support both 
> Interval and another type AnyDomain.   This has the bad effect of losing 
> type information. 
>
>         So I’m currently debating changing to template parameters: 
>
>                 f=Fun(x->x^2,Chebyshev(Interval{a,b}())) 
>
> so that typeof(f) is Fun{Float64,Chebyshev{Interval{a,b}}}.    Then it is 
> possible to convert numbers to the correct type.


Why not make something like Interval{promote_type(typeof(a),typeof(b))} ?   
That way the Interval is parameterized by its type, not by its endpoints.

Reply via email to