Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-25 Thread Hans W Borchers
Thanks for your offer. The function above was only a test case, but I had requests where it was necessary to return zeros exactly in double precision. I solved this -- for the test and other functions -- utilizing the 'mpfr' software for arbitrary precision. Actually, Ridders' method can be app

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-25 Thread Simon Byrne
On Monday, 24 February 2014 11:34:22 UTC, Hans W Borchers wrote: > > This innocent looking test function appears to be so flat that only an > arbitrary precision solver will locate this root more exactly. > I think what is required in this case is a more accurate implementation of the function

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-25 Thread Hans W Borchers
Well, functions like `x -> exp(-x^3)-1` or `x -> (x^3 + 1) - 1` have obvious roots. The root of the test function above is not that obvious. To tell the rest of the story: I once tried to symbolically solve it with Mathematica Mathematica> Solve[Log[x] + x*x/(2*Exp[1]) - 2*x/Sqrt[Exp[1]] +

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Jason Merrill
On Monday, February 24, 2014 8:16:28 PM UTC-8, Stefan Karpinski wrote: > > This sort of comparison seems inevitably bound to favor bisection for > objective functions that are fast to evaluate and to favor "sophisticated" > methods when the objective function is costly, no? > Yes, that's right.

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Stefan Karpinski
This sort of comparison seems inevitably bound to favor bisection for objective functions that are fast to evaluate and to favor "sophisticated" methods when the objective function is costly, no? On Mon, Feb 24, 2014 at 11:01 PM, Jason Merrill wrote: > On Monday, February 24, 2014 7:48:50 PM UT

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Jason Merrill
On Monday, February 24, 2014 7:48:50 PM UTC-8, Jason Merrill wrote: > > On Monday, February 24, 2014 3:34:22 AM UTC-8, Hans W Borchers wrote: > >> BTW It would be nice to have Ridders' algorithm available in Julia, too, >> about which the "Numerical Recipes" say: >> >> "*In both reliability and s

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Jason Merrill
On Monday, February 24, 2014 3:34:22 AM UTC-8, Hans W Borchers wrote: > > The following function is one of the most difficult test functions for > univariate root finding I know of, > > julia> function fn(x::Real) >return log(x) + x^2/(2*exp(1)) - 2 * x/sqrt(exp(1)) + 1 >

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Hans W Borchers
The following function is one of the most difficult test functions for univariate root finding I know of, julia> function fn(x::Real) return log(x) + x^2/(2*exp(1)) - 2 * x/sqrt(exp(1)) + 1 end whose exact root between 1.0 and 3.4 is sqrt(e) = 1.6487212707001282...

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-24 Thread Ivar Nesje
You can change rounding mode with http://docs.julialang.org/en/latest/stdlib/base/#Base.set_rounding kl. 08:16:20 UTC+1 mandag 24. februar 2014 skrev Jason Merrill følgende: > > Thanks for the kind words. > > Is the goal of the linked float range code to make things like > `1.0:1/n:2.0` work mor

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread Jason Merrill
Thanks for the kind words. Is the goal of the linked float range code to make things like `1.0:1/n:2.0` work more reliably? Seems like a nice approach. On Sunday, February 23, 2014 10:28:24 AM UTC-8, Stefan Karpinski wrote: > > This is a lovely blog post. I've given a few talks on floating-point

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread Jason Merrill
Thanks for the reference. I enjoyed this quite a bit--both the writing and the content. Where would we be without Kahan? Kahan seems to get a lot of mileage out of running programs with directed rouding. Does Julia provide a way to set floating point rounding modes? I'm curious why you feel Mul

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread Stefan Karpinski
Also, thought this would be of general interest on Hacker News, so I submitted it: https://news.ycombinator.com/item?id=7286926. On Sun, Feb 23, 2014 at 1:28 PM, Stefan Karpinski wrote: > This is a lovely blog post. I've given a few talks on floating-point > arithmetic using Julia for live codin

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread Stefan Karpinski
This is a lovely blog post. I've given a few talks on floating-point arithmetic using Julia for live coding and demonstrations. The fact that there is a next and previous floating point number – with nothing in between – always blows people's minds, even though this is an immediate and fairly obvio

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread Jiahao Chen
Great post! It may interest you that William Kahan has written quite extensively on the pitfalls of iterative algorithms on floating point numbers; his discussion of Muller's pathological recurrence on pp. 14+ of this paper seems particularly relevant. http://www.cs.berkeley.edu/~wkahan/Mindless.

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-23 Thread John Myles White
This is really great material, Jason. Are you using MathJax? For me, the LaTeX-like code doesn’t seem to get processed. — John On Feb 22, 2014, at 5:52 PM, Jason Merrill wrote: > I'm working on a series of blog posts that highlight some basic aspects of > floating point arithmetic with examp

[julia-users] Blog post on floating point basics with Julia examples

2014-02-22 Thread Jason Merrill
I'm working on a series of blog posts that highlight some basic aspects of floating point arithmetic with examples in Julia. The first one, on bisecting floating point numbers, is available at http://squishythinking.com/2014/02/22/bisecting-floats/ The intended audience is basically a version