An Arbitrary Precision Computation Package David H

Total Page:16

File Type:pdf, Size:1020Kb

An Arbitrary Precision Computation Package David H ARPREC: An Arbitrary Precision Computation Package David H. Bailey, Yozo Hida, Xiaoye S. Li and Brandon Thompson1 Lawrence Berkeley National Laboratory, Berkeley, CA 94720 Draft Date: 2002-10-14 Abstract This paper describes a new software package for performing arithmetic with an arbitrarily high level of numeric precision. It is based on the earlier MPFUN package [2], enhanced with special IEEE floating-point numerical techniques and several new functions. This package is written in C++ code for high performance and broad portability and includes both C++ and Fortran-90 translation modules, so that conventional C++ and Fortran-90 programs can utilize the package with only very minor changes. This paper includes a survey of some of the interesting applications of this package and its predecessors. 1. Introduction For a small but growing sector of the scientific computing world, the 64-bit and 80-bit IEEE floating-point arithmetic formats currently provided in most computer systems are not sufficient. As a single example, the field of climate modeling has been plagued with non-reproducibility, in that climate simulation programs give different results on different computer systems (or even on different numbers of processors), making it very difficult to diagnose bugs. Researchers in the climate modeling community have assumed that this non-reproducibility was an inevitable conse- quence of the chaotic nature of climate simulations. Recently, however, it has been demonstrated that for at least one of the widely used climate modeling programs, much of this variability is due to numerical inaccuracy in a certain inner loop. When some double-double arithmetic rou- tines, developed by the present authors, were incorporated into this program, almost all of this variability disappeared [12]. The double-double (32 digits) package mentioned above and a related quad-double (64 digits) package have been used in other scientific applications as well [13]. These include a vortex roll- up simulation [10] and a bound-state calculation of Coulomb three-body systems [11]. In each case, the computational results would have been meaningless without the additional numeric precision. In fact, the Coulomb three-body calculations eventually had to rely on arbitrary precision arithmetic software, as more than 100 digit accuracy was required. It is also expected that future analysis of vortex roll-up phenomena will require significantly more precision than provided by the quad-double package. Perhaps the most interesting applications of high precision arithmetic are in the arena of experimental mathematics. One key computation used in this research is integer relation de- tection. Given a vector x =(x1,x2,x3, ···,xn) of real or complex numbers, an integer relation algorithm finds integers ai, not all zero, such that a1x1 + a2x2 + ···+ anxn =0 At the present time, the most effective algorithm for integer relation detection is the recently discovered “PSLQ” algorithm of mathematician-sculptor Helaman Ferguson [6]. PSLQ was 1This work is supported by the Director, Office of Computational and Technology Research, Division of Math- ematical, Information, and Computational Sciences of the U.S. Department of Energy, under contract number DE-AC03-76SF00098. 1 recently named one of ten “algorithms of the century” by the editors of Computing in Science and Engineering [3]. For almost all applications of an integer relation algorithm such as PSLQ, very high precision arithmetic must be used. Such computations are typically done using 100-500 digit precision, although some problems require thousands of digits. The best-known result found using integer relation computations is the “BBP” formula for π, which was discovered in 1997 using a 2-level version of PSLQ implemented with the MPFUN multiple-precision arithmetic package [5]: ∞ π 1 4 − 2 − 1 − 1 = k k k k k k=0 16 8 +1 8 +4 8 +5 8 +6 This formula, after a minor manipulation, yields a very simple algorithm to directly compute hexadecimal or binary digits of π beginning at the n-th digit, without needing to compute any of the first n − 1 digits, and requiring only a very small amount of computer memory. Since 1997, similar formulas have been found, using PSLQ computations, for numerous other mathematical constants, including logarithms of certain integers, the Riemann zeta function evaluated at certain odd integers, arctangents of certain rational numbers, and certain constants that arise in quantum field theory. In some cases, such as Catalan’s constant, the new computer- discovered formulas are the best known formulas for computing high-precision numerical values (independent of the individual binary digit calculation property). A compendium of these “BBP- type” formulas is available online [1]. As an aside, recently it has been shown that these computer-discovered BBP-type formu- las have deep implications for the centuries-old question of whether (and why) mathematical constants such as π and log 2 are normal. Here normal base b means that every m-long string of digits in the base-b expansion appears with limiting frequency b−m, namely the frequency one would expect if the digits had been generated at random. It is easy to show using mea- sure theory that “almost all” real numbers are normal. Further, it is widely believed, based on computational√ studies, that many of the well-known constants of mathematics, including π, e, 2, log 2, log 10 and many others, are normal to commonly used number bases. But it is an embarrassing fact of modern mathematics that none of these constants has ever been proven normal to any base. Recently some significant progress was achieved in this arena. In particular, it has been demonstrated that the normality of the class of real constants for which BBP-type formulas are known (which includes π, log 2 and others), reduces to a plausible conjecture from the field of chaotic dynamics [9]. In the latest development along this line, a certain class of real numbers, uncountably infinite in number (but not yet including π), has been proven normal base 2 [9]. In another application of high-precision computing to mathematical research, PSLQ compu- tations have been used to investigate sums of the form 1 S k ( )= k 2n n>0 n n For small k, these constants are known to satisfy simple mathematical identities, such as S(4) = 17π4/3240. For many years researchers have sought generalizations of these formulas for k>4. Recently some general formulas were found using PSLQ. In particular, the constants {S(k)|k = 5 ...20} have now been evaluated in terms of multiple zeta values, which are defined by ζ s ,s , ···,s 1 ( 1 2 r)= s1 s2 sr k1 k2 ···kr k1>k2>···>kr>0 2 and multiple Clausen values of the form b sin(n1π/3) 1 M(a, b)= a n nj n1>n2>...>nb>0 1 j=1 A sample result, obtained using PSLQ, is the following: 8 8 13921 S(9) = π 2M(7, 1) + M(5, 3) + ζ(2)M(5, 1) − ζ(9) 3 9 216 6211 8101 331 8 + ζ(7)ζ(2) + ζ(6)ζ(3) + ζ(5)ζ(4) − ζ3(3) 486 648 18 9 Recently S(20) was evaluated with this methodology, which involved an integer relation problem of size n = 118. This solution required 5,000 digit arithmetic and several hours of computation on a high-end workstation. The solution is given explicitly in [6]. One other result that we shall mention here arose from the numerical discovery, using PSLQ, by British physicist David Broadhurst that (α315 − 1)(α210 − 1)(α126 − 1)2(α90 − 1)(α3 − 1)3(α2 − 1)5(α − 1)3 α630 − 1= (α35 − 1)(α15 − 1)2(α14 − 1)2(α5 − 1)6α68 where α =1.176280818259917 ... is the larger real root of Lehmer’s polynomial 0=α10 + α9 − α7 − α6 − α5 − α4 − α3 + α +1 The relation led Broadhurst to believe that a valid ladder of polylogarithms exists at order n = 17, contrary to a suggestion in [15]. Later, he and one of the present authors were able to find 125 non-zero integers a, bj, ck, up to 292 digits in size, such that the relation 8 2j 17−2j −k aζ(17) = bj π (log α) + ck Li17(α ) j=0 k∈D(S) holds to more than 50,000 decimal digits. This set of 125 integers was found in more than more way. One of these computations was performed on the NERSC Cray T3E, a highly parallel system at Lawrence Berkeley Laboratory. In this calculation one of the present authors employed a three-level, multi-pair PSLQ algorithm, implemented using the MPFUN multiple- precision software, and using MPI for parallel execution. This computation required 50,000 decimal digit arithmetic, and approximately 44 hours on 32 CPUs of the T3E, completing after 236,713 iterations [7]. 2. Overview of the ARPREC Package The new Arbitrary Precision (ARPREC) computation package is based in part on the Fortran-90 MPFUN package [2], which in turn is based on an earlier Fortran-77 package [4]. Both of the earlier packages were targeted to a Fortran environment. With the Fortran-77 MP- FUN package, users indicate which variables are to be treated as multiple precision by means of special comments inserted in the code. A translation tool then transforms the code into a pro- gram that includes explicit calls to routines from the MPFUN library. In the Fortran-90 version of MPFUN, the object-oriented facilities built into the Fortran-90 language (notably custom datatypes and operator overloading) are exploited to provide the same functionality without the 3 need of a translation tool. In addition, the Fortran-90 version of MPFUN incorporates some advanced algorithms that provide better accuracy and performance.
Recommended publications
  • Mathematics Calculation Policy ÷
    Mathematics Calculation Policy ÷ Commissioned by The PiXL Club Ltd. June 2016 This resource is strictly for the use of member schools for as long as they remain members of The PiXL Club. It may not be copied, sold nor transferred to a third party or used by the school after membership ceases. Until such time it may be freely used within the member school. All opinions and contributions are those of the authors. The contents of this resource are not connected with nor endorsed by any other company, organisation or institution. © Copyright The PiXL Club Ltd, 2015 About PiXL’s Calculation Policy • The following calculation policy has been devised to meet requirements of the National Curriculum 2014 for the teaching and learning of mathematics, and is also designed to give pupils a consistent and smooth progression of learning in calculations across the school. • Age stage expectations: The calculation policy is organised according to age stage expectations as set out in the National Curriculum 2014 and the method(s) shown for each year group should be modelled to the vast majority of pupils. However, it is vital that pupils are taught according to the pathway that they are currently working at and are showing to have ‘mastered’ a pathway before moving on to the next one. Of course, pupils who are showing to be secure in a skill can be challenged to the next pathway as necessary. • Choosing a calculation method: Before pupils opt for a written method they should first consider these steps: Should I use a formal Can I do it in my Could I use
    [Show full text]
  • Neural Correlates of Arithmetic Calculation Strategies
    Cognitive, Affective, & Behavioral Neuroscience 2009, 9 (3), 270-285 doi:10.3758/CABN.9.3.270 Neural correlates of arithmetic calculation strategies MIRIA M ROSENBERG -LEE Stanford University, Palo Alto, California AND MARSHA C. LOVETT AND JOHN R. ANDERSON Carnegie Mellon University, Pittsburgh, Pennsylvania Recent research into math cognition has identified areas of the brain that are involved in number processing (Dehaene, Piazza, Pinel, & Cohen, 2003) and complex problem solving (Anderson, 2007). Much of this research assumes that participants use a single strategy; yet, behavioral research finds that people use a variety of strate- gies (LeFevre et al., 1996; Siegler, 1987; Siegler & Lemaire, 1997). In the present study, we examined cortical activation as a function of two different calculation strategies for mentally solving multidigit multiplication problems. The school strategy, equivalent to long multiplication, involves working from right to left. The expert strategy, used by “lightning” mental calculators (Staszewski, 1988), proceeds from left to right. The two strate- gies require essentially the same calculations, but have different working memory demands (the school strategy incurs greater demands). The school strategy produced significantly greater early activity in areas involved in attentional aspects of number processing (posterior superior parietal lobule, PSPL) and mental representation (posterior parietal cortex, PPC), but not in a numerical magnitude area (horizontal intraparietal sulcus, HIPS) or a semantic memory retrieval area (lateral inferior prefrontal cortex, LIPFC). An ACT–R model of the task successfully predicted BOLD responses in PPC and LIPFC, as well as in PSPL and HIPS. A central feature of human cognition is the ability to strategy use) and theoretical (parceling out the effects of perform complex tasks that go beyond direct stimulus– strategy-specific activity).
    [Show full text]
  • Banner Human Resources and Position Control / User Guide
    Banner Human Resources and Position Control User Guide 8.14.1 and 9.3.5 December 2017 Notices Notices © 2014- 2017 Ellucian Ellucian. Contains confidential and proprietary information of Ellucian and its subsidiaries. Use of these materials is limited to Ellucian licensees, and is subject to the terms and conditions of one or more written license agreements between Ellucian and the licensee in question. In preparing and providing this publication, Ellucian is not rendering legal, accounting, or other similar professional services. Ellucian makes no claims that an institution's use of this publication or the software for which it is provided will guarantee compliance with applicable federal or state laws, rules, or regulations. Each organization should seek legal, accounting, and other similar professional services from competent providers of the organization's own choosing. Ellucian 2003 Edmund Halley Drive Reston, VA 20191 United States of America ©1992-2017 Ellucian. Confidential & Proprietary 2 Contents Contents System Overview....................................................................................................................... 22 Application summary................................................................................................................... 22 Department work flow................................................................................................................. 22 Process work flow......................................................................................................................
    [Show full text]
  • Ball Green Primary School Maths Calculation Policy 2018-2019
    Ball Green Primary School Maths Calculation Policy 2018-2019 Contents Page Contents Page Rationale 1 How do I use this calculation policy? 2 Early Years Foundation Stage 3 Year 1 5 Year 2 8 Year 3 11 Year 4 14 Year 5 17 Year 6 20 Useful links 23 1 Maths Calculation Policy 2018– 2019 Rationale: This policy is intended to demonstrate how we teach different forms of calculation at Ball Green Primary School. It is organised by year groups and designed to ensure progression for each operation in order to ensure smooth transition from one year group to the next. It also includes an overview of mental strategies required for each year group [Year 1-Year 6]. Mathematical understanding is developed through use of representations that are first of all concrete (e.g. base ten, apparatus), then pictorial (e.g. array, place value counters) to then facilitate abstract working (e.g. columnar addition, long multiplication). It is important that conceptual understanding, supported by the use of representation, is secure for procedures and if at any point a pupil is struggling with a procedure, they should revert to concrete and/or pictorial resources and representations to solidify understanding or revisit the previous year’s strategy. This policy is designed to help teachers and staff members at our school ensure that calculation is taught consistently across the school and to aid them in helping children who may need extra support or challenges. This policy is also designed to help parents, carers and other family members support children’s learning by letting them know the expectations for their child’s year group and by providing an explanation of the methods used in our school.
    [Show full text]
  • Calculation Devices
    Type 2 Calculation Devices Description of Accommodation This accommodation provides an alternate method of computation for a student with a disability who is unable to effectively use paper-and-pencil methods. Assessments For a student who meets the eligibility criteria, this accommodation may be used on • STAAR grades 3–8 mathematics tests and STAAR grades 5 and 8 science tests • STAAR Spanish grades 3–5 mathematics tests and STAAR Spanish grade 5 science test • STAAR L grades 3–8 mathematics tests and STAAR L grades 5 and 8 science tests • STAAR Modified grades 3–8 mathematics tests and STAAR Modified grades 5 and 8 science tests Student Eligibility Criteria A student may use this accommodation if he or she receives special education or Section 504 services, routinely, independently, and effectively uses the accommodation during classroom instruction and testing, and meets at least one of the following for the applicable grade. Grades 3 and 4 Grades 5 through 8 • The student has a physical disability • The student has a physical disability that prevents him or her from that prevents him or her from independently writing the numbers independently writing the numbers required for computations and cannot required for computations and cannot effectively use other allowable effectively use other allowable materials to address this need (e.g., materials to address this need (e.g., whiteboard, graph paper). whiteboard, graph paper). • The student has an impairment in • The student has an impairment in vision that prevents him or her from vision that prevents him or her from seeing the numbers they have seeing the numbers they have written during computations and written during computations and cannot effectively use other allowable cannot effectively use other allowable materials to address this need (e.g., materials to address this need (e.g., magnifier).
    [Show full text]
  • Mathematics Calculation Strategies
    Mathematics Calculation Strategies A guide to mental and written calculations and other useful strategies we use in our school. ‘To inspire and educate for life’ Introduction Introduction This booklet explains how children are taught to carry out written calculations for each of the four number operations (addition / subtraction / multiplication / division). In order to help develop your child’s mathematical understanding, each operation is taught according to a clear progression of stages. Generally, children begin by learning how written methods can be used to support mental calculations. They then move on to learn how to carry out and present calculations horizontally. After this, they start to use vertical methods, first in a longer format and eventually in a more compact format (standard written methods). However, we must remember that standard written methods do not make you think about the whole number involved and don’t support the development of mental strategies. They also make each operation look different and unconnected. Therefore, children will only move onto a vertical format when they can identify if their answer is reasonable and if they can make use of related number facts. (Advice provided by Hampshire Mathematics Inspector). It is extremely important to go through each of these stages in developing calculation strategies. We are aware that children can easily be taught the procedure to work through for a compact written method. However, unless they have worked through all the stages they will only be repeating the
    [Show full text]
  • How the Founder of Modern Dialectical Logic Could Help the Founder of Cybernetics Answer This Question
    Industrial and Systems Engineering What Is Information After All? How The Founder Of Modern Dialectical Logic Could Help The Founder Of Cybernetics Answer This Question EUGENE PEREVALOV1 1Department of Industrial and Systems Engineering, Lehigh University, Bethlehem, PA, USA ISE Technical Report 21T-004 What is information after all? How the founder of modern dialectical logic could help the founder of cybernetics answer this question E. Perevalov Department of Industrial & Systems Engineering Lehigh University Bethlehem, PA 18015 Abstract N. Wiener’s negative definition of information is well known: it states what infor- mation is not. According to this definition, it is neither matter nor energy. But what is it? It is shown how one can follow the lead of dialectical logic as expounded by G.W.F. Hegel in his main work [1] – “The Science of Logic” – to answer this and some related questions. 1 Contents 1 Introduction 4 1.1 Why Hegel and is the author an amateur Hegelian? . 5 1.2 Conventions and organization . 16 2 A brief overview of (Section I of) Hegel’s Doctrine of Essence 17 2.1 Shine and reflection . 19 2.2 Essentialities . 23 2.3 Essence as ground . 31 3 Matter and Energy 36 3.1 Energy quantitative characterization . 43 3.2 Matter revisited . 53 4 Information 55 4.1 Information quality and quantity: syntactic information . 61 4.1.1 Information contradictions and their resolution: its ideal universal form, aka probability distribution . 62 4.1.2 Form and matter II: abstract information, its universal form and quan- tity; Kolmogorov complexity as an expression of the latter .
    [Show full text]
  • Mental Versus Calculator Assisted Arithmetic
    Should I Use My Calculator?: Mental versus Calculator Assisted Arithmetic Wendy Ann Deslauriers ([email protected]) Clara John Gulli ([email protected]) Institute of Cognitive Science, Carleton University, Ottawa, ON, K1S 5B6, Canada Keywords: calculators; mathematics; mental arithmetic calculators and other technological tools, yet, these studies often involved a control group that had been taught very Introduction: Calculators and Mathematics differently from the experimental group. It could be the Early studies investigating the influence of calculators on teaching, and not the actual usage of the calculator, that learning found that participants using calculators were faster influences the mathematical performance and understanding and more accurate than their counterparts without of students. Since participants in the present study calculators. Participants using calculators, however, showed completed the same tasks under the same conditions, their no attitudinal improvements, and conceptual improvements performance should only have been affected by the use, or were only evident for those already working at a higher non-use, of the calculator. Thus, the inefficiency of computational level (for a review see Roberts, 1980). More calculator assisted arithmetic becomes apparent. recent studies have found that mental calculation is critical Although technological tools may support mathematical for recall of mathematical learning, and have supported the conceptual exploration, and provide a feeling of security for position that calculators may be more useful for students students with math anxiety, they may not actually improve who already possess the cognitive processes necessary to calculation fluency. One can begin mentally calculating the retrieve answers, than for students with weak mathematical next problem while still writing down a previous response.
    [Show full text]
  • A Tutorial on the Decibel This Tutorial Combines Information from Several Authors, Including Bob Devarney, W1ICW; Walter Bahnzaf, WB1ANE; and Ward Silver, NØAX
    A Tutorial on the Decibel This tutorial combines information from several authors, including Bob DeVarney, W1ICW; Walter Bahnzaf, WB1ANE; and Ward Silver, NØAX Decibels are part of many questions in the question pools for all three Amateur Radio license classes and are widely used throughout radio and electronics. This tutorial provides background information on the decibel, how to perform calculations involving decibels, and examples of how the decibel is used in Amateur Radio. The Quick Explanation • The decibel (dB) is a ratio of two power values – see the table showing how decibels are calculated. It is computed using logarithms so that very large and small ratios result in numbers that are easy to work with. • A positive decibel value indicates a ratio greater than one and a negative decibel value indicates a ratio of less than one. Zero decibels indicates a ratio of exactly one. See the table for a list of easily remembered decibel values for common ratios. • A letter following dB, such as dBm, indicates a specific reference value. See the table of commonly used reference values. • If given in dB, the gains (or losses) of a series of stages in a radio or communications system can be added together: SystemGain(dB) = Gain12 + Gain ++ Gainn • Losses are included as negative values of gain. i.e. A loss of 3 dB is written as a gain of -3 dB. Decibels – the History The need for a consistent way to compare signal strengths and how they change under various conditions is as old as telecommunications itself. The original unit of measurement was the “Mile of Standard Cable.” It was devised by the telephone companies and represented the signal loss that would occur in a mile of standard telephone cable (roughly #19 AWG copper wire) at a frequency of around 800 Hz.
    [Show full text]
  • A Guide to Calculation Methods Used in School
    A guide to calculation methods used in school St John’s and St Clement’s CE Primary Want to learn more about how calculation is taught and how you can help your child? Suitable for parents with children in any year group. -scary Please come along to our (gentle non maths) parent sessions!!! Addition and Subtraction workshops Monday 11th March 2013 9am and 6pm Multiplication workshops Wednesday 22nd May 2013 9am and 6pm Division workshops Thursday 4th July 2013 9am and 6pm Calculation Booklet Teaching methods in maths have changed over the years. The information in this booklet is to inform you of the various methods that we teach so you can help you to help your child at home. Much time is spent on teaching mental calculation strategies. Up to the age of about 8 or 9 (Year 4), informal written recording should take place regularly as it is an important part of learning and understanding. Formal written methods, which you will be more familiar with, should follow only when your child is able to use a wide range of mental calculation strategies. Contents Use of mental strategies p1 Stages in addition p3 Stages in subtraction p6 Stages in multiplication p10 Stages in division p14 Number fun & games p18 Use of mental strategies Children are taught a range of mental strategies. At Key Stage 1, a lot of time is spent teaching number bonds to 10, 100 and 20, so that children know that 7 + 3 make 10, 70 + 30 make 100 and 17 + 3 make 20. Strategies for teaching mental addition include: Putting the largest number first: 5 + 36 is the same as 36 + 5.
    [Show full text]
  • Slide Rules and Log Scales
    Name: __________________________________ Lab – Slide Rules and Log Scales [EER Note: This is a much-shortened version of my lab on this topic. You won’t finish, but try to do one of each type of calculation if you can. I’m available to help.] The logarithmic slide rule was the calculation instrument that sent people to the moon and back. At a time when computers were the size of rooms and ran on tapes and punch cards, the ability to perform complex calculations with a slide rule became essential for scientists and engineers. Functions that could be done on a slide rule included multiplication, division, squaring, cubing, square roots, cube roots, (common) logarithms, and basic trigonometry functions (sine, cosine, and tangent). The performance of all these functions have all been superseded in modern practice by the scientific calculator, but as you may have noted by now, the calculator has a “black box” effect; that is, it doesn’t give you much of a feel for what an answer means or whether it is right. Slide rules, by the way they were manipulated, gave users more of an intrinsic feel for how operations were performed. The slide rule consists of nine scales of varying size and rate – some are linear, while others are logarithmic. Part 1 of 2: Calculations (done in class) In this lab, you will use the slide rule to perform some calculations. You may not use any other means of calculation! You will be given a brief explanation of how to perform a given type of calculation, and then will be asked to calculate a few problems of each type.
    [Show full text]
  • Calculation Aids
    Calculation Aids Description of Designated Support This designated support provides an alternate method of computation for a student who is unable to effectively use paper-and-pencil methods. Assessments For a student who meets the eligibility criteria, this designated support may be used on • STAAR grades 3–7 mathematics • STAAR grade 5 science • STAAR Spanish grades 3–5 mathematics • STAAR Spanish grade 5 science Student Eligibility Criteria A student may use this designated support if he or she • receives Section 504 or special education services, • routinely, independently, and effectively uses it during classroom instruction and classroom testing, and • meets at least one of the following for the applicable grade. Grades 3 and 4 • The student has a physical disability that prevents him or her from independently writing the numbers required for computations and cannot effectively use other accessibility features to address this need (e.g., whiteboard, graph paper). • The student has an impairment in vision that prevents him or her from seeing the numbers they have written during computations and cannot effectively use other accessibility features to address this need (e.g., magnifier). Texas Education Agency 2020-2021 school year Student Assessment Division 1 of 3 Grades 5 through 7 • The student has a physical disability that prevents him or her from independently writing the numbers required for computations and cannot effectively use other accessibility features to address this need (e.g., whiteboard, graph paper). • The student has an impairment in vision that prevents him or her from seeing the numbers they have written during computations and cannot effectively use other accessibility features to address this need (e.g., magnifier).
    [Show full text]