For completeness, here is the definition I ended up using (probably using map 
is bad performance wise but I don’t actually use that yet):



sqrtx2(z::Complex)=sqrt(z-1).*sqrt(z+1)
sqrtx2(x::Real)=sign(x)*sqrt(x^2-1)
sqrtx2(x::Vector)=map(sqrtx2,x)

function sqrtx2(f::Fun)
    B=Evaluation(first(domain(f)))
    A=Derivative()-f*differentiate(f)/(f^2-1)
    linsolve([B,A],sqrtx2(first(f));tolerance=length(f)*10E-15)
end



> On 13 Feb 2015, at 3:11 pm, Sheehan Olver <[email protected]> wrote:
> 
> thanks! Will take a look.
> 
>       For my own case I realized I could avoid the issue by solving the ODE 
> it satisfies using ApproxFun:
> 
>               u’ - u*z/(z^2-1)
> 
> with a boundary condition using the pointwise definition.
> 
> 
> 
> 
> 
>> On 13 Feb 2015, at 2:52 pm, Jiahao Chen <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> I haven't looked at this issue, but perhaps the algorithm of Dingle and 
>> Fateman ("Branch Cuts in Computer Algebra") may be helpful for detecting 
>> removable branch cuts.
>> 
>> Thanks,
>> 
>> Jiahao Chen
>> Staff Research Scientist
>> MIT Computer Science and Artificial Intelligence Laboratory
>> 
>> On Thu, Feb 12, 2015 at 10:05 PM, Sheehan Olver <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> For z < -1 the branch cuts cancel and the function should be equivalent to 
>> -sqrt(z^2-1)  (the only non-removeable branch cut is along [-1,1]), but in 
>> Julia it is not defined.  I'm wondering if there is a special function in 
>> Julia that can take care of this, or is the only solution to write my own 
>> (with special handlers for Arrays, etc.)?
>> 
>> 
>> 
>> 
> 

Reply via email to