From owner-freebsd-numerics@freebsd.org Tue Sep 4 21:22:03 2018 Return-Path: Delivered-To: freebsd-numerics@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC308FFC781 for ; Tue, 4 Sep 2018 21:22:03 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8078225A for ; Tue, 4 Sep 2018 21:22:03 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w84LM2T6001818 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 4 Sep 2018 14:22:02 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w84LM14P001817; Tue, 4 Sep 2018 14:22:01 -0700 (PDT) (envelope-from sgk) Date: Tue, 4 Sep 2018 14:22:01 -0700 From: Steve Kargl To: "Montgomery-Smith, Stephen" Cc: "freebsd-numerics@freebsd.org" Subject: Re: j0 (and y0) in the range 2 <= x < (p/2)*log(2) Message-ID: <20180904212201.GA1752@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20180903235724.GA95333@troutmask.apl.washington.edu> <20180904041010.GA96191@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180904041010.GA96191@troutmask.apl.washington.edu> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 21:22:04 -0000 On Mon, Sep 03, 2018 at 09:10:10PM -0700, Steve Kargl wrote: > On Tue, Sep 04, 2018 at 03:56:28AM +0000, Montgomery-Smith, Stephen wrote: > > A quick google search turned up this > > > > https://www.cl.cam.ac.uk/~jrh13/papers/bessel.pdf > > > > which has the functions p0 and q0. Maybe this was the basis of this code. > > I've read that paper. It uses |x| > 45 for the cut over > to the large argument asymptotic expansion. One of the > primary results for that paper is the development of > new approximations that are robust near zeros of Jn(x). > In the the discussion of the results, the paper notes > the use of a double-double representation for intermediate > results. > > A&S claims that the remainder in truncating the series > does not exceed the magnitude of the first neglected > term. If you set x = 2 and compute the terms in > p0(x), one finds the smallest term is about |pk| = 1e-4. > To follow-up, here the individual terms and the estimated value of j0(x). pk and qk are the terms and p0(n,x) and q0(n,x) are the accumulated sum. In p0(n,x) k pk p0(n,x) 0 1.000000000000000e+00 1.000000000000000e+00 1 -1.757812500000000e-02 9.824218750000000e-01 2 2.574920654296875e-03 9.849967956542969e-01 3 -1.026783138513565e-03 9.839700125157833e-01 4 7.959574759297539e-04 9.847659699917131e-01 5 -1.015778544477541e-03 9.837501914472355e-01 6 1.931887598216261e-03 9.856820790454518e-01 7 -5.124164754615886e-03 9.805579142908359e-01 8 1.807719255473622e-02 9.986351068455721e-01 In q0(n,x) k qk q0(n,x) 0 -6.250000000000000e-02 -6.250000000000000e-02 1 4.943847656250000e-03 -5.755615234375000e-02 2 -1.341104507446289e-03 -5.889725685119629e-02 3 7.861308404244483e-04 -5.811112601077184e-02 4 -8.059069443788758e-04 -5.891703295515072e-02 5 1.280304207101901e-03 -5.763672874804882e-02 6 -2.915080393737037e-03 -6.055180914178585e-02 7 9.007320857723237e-03 -5.154448828406261e-02 8 -3.627992116888033e-02 -8.782440945294294e-02 x libm j0(x) A&S 2.000000 2.238907791412357e-01 2.429095124592851e-01 As k increases above k=8, one sees the divergence of the asymptotic series. -- Steve