Hey thats cool. Thank you very much!
Since I have been only working with normal Julia numbers: Do you know a 
root finding algorithm which directly uses ACB or ARB numbers? (So in 
principle I dont need to convert back directly)

Am Samstag, 28. Mai 2016 16:30:57 UTC+2 schrieb Fredrik Johansson:
>
> On Sat, May 28, 2016 at 4:02 PM, digxx <diger...@hotmail.com <javascript:>> 
> wrote: 
> > maybe one more thing. How can I extract the number from this form 
> [0.1234... 
> > +- 12341e-12341] + i*0 to a normal number such that I can work with it 
> in 
> > later calculations 
>
> You can do this: 
>
> julia> Float64(real(hyp1f1(R(1), R(1), R(1)))) 
> 2.718281828459045 
>
> Looks like conversion to BigFloat has not been implemented yet (though 
> conversion from a BigFloat works). But it can be done with a few lines 
> of code: 
>
> julia> function bf(x::arb) 
>            mid = ccall((:arb_mid_ptr, :libarb), Ptr{Void}, (Ptr{arb}, ), 
> &x) 
>            y = BigFloat() 
>            ccall((:arf_get_mpfr, :libarb), Int, (Ptr{BigFloat}, 
> Ptr{Void}, Int), &y, mid, 0) 
>            return y 
>        end 
> bf (generic function with 1 method) 
>
> julia> x = hyp1f1(R(1), R(1), R(1)); 
>
> julia> bf(real(x)) 
> 2.718281828459045235360287471352662497747295538978622980871818032370215364509352
>  
>
>
> julia> bf(imag(x)) 
> 0.000000000000000000000000000000000000000000000000000000000000000000000000000000
>  
>
>
> Another thing worth pointing out is that R(128) can give results with 
> much less than 128 bits of accuracy in the final result. You can check 
> the number of accurate bits like this: 
>
> julia> accuracy_bits(x) 
> 126 
>
> If the accuracy is too low, you can try again with higher precision. 
> Here's an example: 
>
> julia> x = hyp1f1(R(-100), R(1), R(20)) 
> [1854.0367 +/- 4.44e-5] + i*0 
>
> julia> accuracy_bits(x) 
> 26 
>
> julia> R2 = AcbField(256); 
>
> julia> x = hyp1f1(R2(-100), R2(1), R2(20)) 
> [1854.0367283243398148762134198258916179287877866 +/- 4.48e-44] + i*0 
>
> julia> accuracy_bits(x) 
> 154 
>
> So you can easily write a hyp1f1 wrapper for BigFloat that 
> automatically doubles the precision until the result is guaranteed to 
> be accurate to any accuracy you want. 
>
> Fredrik 
>

Reply via email to