Automated Symbolic and Numerical Testing of DLMF Formulae using - - PowerPoint PPT Presentation

automated symbolic and numerical testing of dlmf formulae
SMART_READER_LITE
LIVE PREVIEW

Automated Symbolic and Numerical Testing of DLMF Formulae using - - PowerPoint PPT Presentation

Automated Symbolic and Numerical Testing of DLMF Formulae using Computer Algebra Systems Howard S. Cohl , Andr Greiner-Petter and Moritz Schubotz *Applied and Computational Mathematics Division, NIST, Mission Viejo, California,


slide-1
SLIDE 1

Automated Symbolic and Numerical Testing of DLMF Formulae using Computer Algebra Systems

Howard S. Cohl∗, André Greiner-Petter† and Moritz Schubotz†

*Applied and Computational Mathematics Division, NIST, Mission Viejo, California, U.S.A., †Department of Computer and Information Science, University of Konstanz, Konstanz, Germany

11th Conference on Intelligent Computer Mathematics, Research Institute for Symbolic Computation (RISC), Johannes Kepler Universität Linz, Hagenberg, Austria Wed., August 15, 2018

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 1 / 20

slide-2
SLIDE 2

Collecting information on special functions and OP

1964: Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables

Milton Abramowitz and Irene Stegun, editors. 1064 pages (book) definitions, approximations, identities, plots and numerical tables

2010: NIST Digital Library of Mathematical Functions (DLMF)

NIST Handbook of Mathematical Functions as successor of A&S Olver, Lozier, Boisvert, Olde Daalhuis, Miller, Saunders, ... editors. 968 pages (printed version), MathML version (online) Links, MathSearch, info boxes, metadata Bruce Miller’s L

AT

Exml package

2013: Digital Repository of Mathematical Formulae (DRMF)

Top down semantic information regarding individual formulae Additional Sources Currently MediaWiki/Wikitech (Wikimedia Foundation) Community interaction and collaboration

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 2 / 20

slide-3
SLIDE 3

Enhanced semantics of mathematical L

AT

EX expressions

Special Functions and Orthogonal polynomials:

Trigonometric sine function Euler gamma function Jacobi polynomial little q-Laguerre/Wall polynomial

Rendered as:

sin z, Γ(z), P (α,β)

n

(x), and pn(x; a|q).

L

AT

EX presentations given by

\sin z, \Gamma(z), P_n^{(\alpha,\beta)}(x), p_n(x;a|q).

Semantic L

AT

EX representations (Bruce Miller’s macro set)

\sin@@{z} \EulerGamma@{z} \JacobipolyP{\alpha}{\beta}{n}@{x} \littleqLaguerre{n}@{x}{a}{q}

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 3 / 20

slide-4
SLIDE 4

Bruce Miller’s OPSF DLMF macro set

Provides semantic content in formulas DLMF OPSF Macros via L

AT

EXML-server

546 semantic DLMF/DRMF L

AT

EX OPSF macros additional 180 semantic DRMF L

AT

EX macros

Objects: \sum,\int,\deriv{f}{x},\qderiv[n]{q}@{z} Constants: \expe,\iunit,\cpi,\EulerConstant Special Functions and Orthogonal Polynomials

Γ(z) \EulerGamma@{z} http://dlmf.nist.gov/5.30.E1 Jν(z) \BesselJ{\nu}@{z} http://dlmf.nist.gov/10.2.E2 Qµ

ν(z)

\assLegendreQ[\mu]{\nu}@{z}: http://dlmf.nist.gov/14.3.E7 P (α,β)

n

(x) \JacobipolyP{\alpha}{\beta}{n}@{x} http://dlmf.nist.gov/18.3#T1.t1.r2

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 4 / 20

slide-5
SLIDE 5

Semantic macro classification

685 semantic DLMF/DRMF L

AT

EX macros (Bruce Miller’s development) 395 macros for real and complex valued functions 185 macros for polynomials (orthogonal and whatnot) 29 macros for integer valued functions 40 macros for various semantic operators 14 macros for quantifiers, set operators and symbols 9 macros for sets of numbers 5 macros for constants 5 macros for linear algebra 3 macros for distribution theory

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 5 / 20

slide-6
SLIDE 6

Information associated with macros

For each macro there is associated metadata: The name of the macro Example calling sequence Example rendering of called semantic macro Concise Description Summary and description of calling options Link to url giving precise definition (either in the DLMF or to a definition page on the DRMF). OpenMath Content Dictionaries Bruce Miller will publish content dictionary for DLMF macros Currently developing content dictionary for extra DRMF macros

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 6 / 20

slide-7
SLIDE 7

Computer Algebra System (CAS) seeding and translation

One can effectively take advantage of semantic macro set to: seed the DRMF using CAS libraries

Use data produced in CAS languages to produce semantic L

AT

EX for inclusion in Digital Mathematics Libraries using L

AT

Exml Two examples eCF and CFSF datasets

Bijective translation to and from CAS source representations and semantic L

AT

EX

Provide CAS output source to user. Given semantic L

AT

EX source for a mathematical expression, assuming that the necessary semantic information is provided, then we can use tools such as Youssef’s POM tagger:

  • A. Youssef, Lecture Notes in Computer Science 10383, Springer, 2017,
  • pp. 243-257,

and; Greiner-Petter’s CAS translation tools. Perform round-trip testing and verification of formulae. (powerful tool for digital mathematics libraries.)

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 7 / 20

slide-8
SLIDE 8

Abdou Youssef’s L

AT

EX POM tagger (first scan)

Examines terms and groups them into sub-expressions when indicated, e.g., \frac{1}{2} is a sub-expression of numerator and denominator. A term (in the sense of Backus-Naur) is a pre-defined non-terminal expression and can represent L

AT

EX macros, environments, reserved symbols (e.g., line break command \\[0.2cm]) or numerical or alphanumerical expressions. Sub-expressions and terms get tagged due the first scan of the tagger, with two separate tag categories:

1 definite tags (such as operation, function, exponent, etc.) that the

tagger is certain of;

2 tags which consist of alternative and tentative features which include

alternative roles and meanings. (drawn from a knowledge base which has been collected for the tagger).

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 8 / 20

slide-9
SLIDE 9

Greiner-Petter’s tool to translate semantic L

AT

EX

used mathematical language parser (MLP) as an interface for the first scan of the POM tagger to build syntax trees of mathematical expressions in L

AT

EX and provide CAS translations. Macro information is stored in CSV files. CAS translations for Greek letters, mathematical constants, and built-in commands for mathematical functions are stored separately in JSON files. Maple to semantic L

AT

EX translations use Maple syntax and various representations using their OpenMaple API. Round trip tests start from a valid semantic L

AT

EX expression or from a valid Maple expression. CAS translations from start representation to the other representation is called one cycle. Round trip tests reach a fixed point when the string representation is identical to its previous

  • representations. We reached a fixed point in semantic L

AT

EX after one cycle and in Maple after 11

2 cycles in most cases we tried (useful in

identifying syntax errors, since the CAS translation fails.)

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 9 / 20

slide-10
SLIDE 10

Extraction of 9919 DLMF semantic L

AT

EX formulae

Identified all relevant (36) L

AT

EX chapter files. Extracted all DLMF formulae on September 16th 2016 (prior to major update to macros naming convention) Formulas contained within: {equation, math, equationmix, equationgroup, aligned, align, displaymath} environments and mapped to a single line in a text file. Extracted \label and \constraint formula metadata Split ± and ∓ formula doubles, e.g., tan u ± tan v = sin(u ± v) cos u cos v Replicated formulae with multiple equal signs, e.g., P2(x) = P2(x) = 3x2 − 1 2

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 10 / 20

slide-11
SLIDE 11

Refinement of DLMF formulae

Reduced to 9919→4078 formulas. Removed formulas containing

no semantic information z = (\tfrac{3}{2}\zeta)^{2/3} \label{eq:AI.RL.AIZ} integrals, \int \sinh@@{x} \diff{x} = \cosh@@{x} sums, \sum_{\ell=0}^n \LaguerrepolyL[\alpha]{\ell}@{x} = \LaguerrepolyL[\alpha+1]{n}@{x} products, \JordanJ{k}@{n} = n^k \prod_{p \divides n} (1 - p^{-k}) asymptotic expressions, \expe^{\iunit x} = \BigO@{1} expressions containing ellipsis, \EulerGamma@{\tfrac{1}{3}} = 2.67893\;85347\;07747\;63365\;\dots, matrices, case statements, and lattices.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 11 / 20

slide-12
SLIDE 12

Constraint handler

DLMF provides constraint metadata for formulae We would like to provide support for these constraints in CAS e.g., interpret the constraint a,b\in A, or more general a_1,\dots,a_n\in A. similar conventions are used for other sets such as the sets of Q, R, C

  • r for subsets of these sets.

One must be able to interpret the constraints as variables in sets defined using an equals notation such as n=0,1,2,\dots or together n,m=0,1,2,\dots Since mathematicians who write L

AT

EX are often casual about expressions such as these, one should know that 0,1,2,\dots is the same as 0,1,\dots

  • ne must also be able to correctly interpret infinite sets (represented

as strings) such as =1,2,\dots =1,2,3,\dots =3,7,11,\dots =5,9,13,\dots

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 12 / 20

slide-13
SLIDE 13

Constraint handler

One must also be able to interpret finite sets such as =1,2 =1,2,3 =1,2,\dots,N An entire language of translation of mathematical notation must be understood in order for CAS to be able to understand constraints. In mathematics, the syntax of constraints is often very compact and contains textual explanations. Translating constraints from L

AT

EX to CAS is a complicated task because CAS only allow precise and strict syntax formats. For example, the typical constraint 0 < x < 1 is invalid if directly translated to MAPLE, because it would need to be translated to two separate constraints, namely x > 0 and x < 1. We have improved the handling and translation of variable constraints/assumptions for simplification and numerical evaluation. Adding assumptions about the constrained variables improves the effectiveness of MAPLE’s simplify function.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 13 / 20

slide-14
SLIDE 14

Constraint handler

Our previous approach for constraint handling for numerical tests was to extract a pre-defined set of test values and to filter invalid values according to the constraints. Because of this strategy, there often was no longer any valid values remaining after the filtering. To overcome this issue, instead, we chose a single numerical value for a variable that appears in a pre-defined constraint. For example, if a test case contains the constraint 0 < x < 1, we chose x = 1/2. A naive approach for this strategy, is to apply regular expressions to identify a match between a constraint and a rule. However, we believed that this approach does not scale well when it comes to more and more pre-defined rules and more complex constraints. Hence, we used the POM tagger to create blueprints of the parse trees for pre-defined rules.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 14 / 20

slide-15
SLIDE 15

Constraint handler

For the example L

AT

EX constraint 0 < x < 1, rendered as 0 < x < 1,

  • ur textual rule is given by:

0 < var < 1 ==> 1/2. The parse tree for this blueprint constraint contains five tokens, where var is an alphanumerical token that is considered to be a placeholder for a variable. We can also distinguish multiple variables by adding an index to the

  • placeholder. For example, the rule we generated for the mathematical

L

AT

EX constraint $x,y \in \Real$, where \Real is the semantic macro which represents the set of real numbers, and rendered as x, y ∈ R, is given by: var1, var2 \in \Real ==> 3/2,3/2. A constraint will match one of the blueprints if the number, the

  • rdering, and the type of the tokens are equal. Allowed matching

tokens for the variable placeholders are Latin or Greek letters and alphanumerical tokens.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 15 / 20

slide-16
SLIDE 16

Automated CAS testing for DLMF formulae

Symbolic verification/simplification tests for formulae.

difference (LHS-RHS) and ratio (LHS/RHS) tests: f(x) − g(x) = 0, f(x) g(x) = 1. Simplification (often fails). Compare Taylor series coefficients (identifty variables).

Numerical verification

Search for DLMF formulae errors using difference (LHS-RHS) and ratio (LHS/RHS) tests. Ratio breaks at roots of f, g. Use increasing

  • precision. Use a distribution of points in the complex plane. Need

ranges of variables. DLMF in principle provides this metadata.

Provide CAS representations to users for usage, testing, examination.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 16 / 20

slide-17
SLIDE 17

Maple testing of DLMF formulae - August 2016

Translated each test case in Maple Forward translation was able to translate 2232 formulae (approx. 53.6%) Verified 477 of these Pre-conversion improved effectiveness of simplify Pre-conversion increased verified to 662 and 1570 test cases were translated but not verified Used conversions to exponential and hypergeometric form Increased verification by restricting to reduced sectors in the complex

  • plane. Sometimes due to inaccuracies produced by CAS assumptions:

e.g., √−1 := i,

  • 1/z = 1/√z.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 17 / 20

slide-18
SLIDE 18

Verification failures and successes

1751 test formulas generated translation errors:

1161 test formulas – contained semantic macros or L

AT

EX commands which could not be translated – q-hypergeometric functions, etc. 316 test formulas – assorted errors 80 test formulas – unknown sub-super-scripts – Dn

q

70 test formulas – java.lang.NullPointerExceptions 61 test formulas – unknown math term – ;, :, text, etc. 29 test formulas – unmatched brackets – [a, b), etc.

901 test formulas – translation succeeded (not symbolic or numerical) 660 test formulas – symbolic verification succeeeded 417 test formulas – symbolic failed, numerical verification succeeded 350 test formulas – translation succeeded but verification skipped

284 test formulas – ambiguous single quote 30 test formulas – no valid test values 27 test formulas – no relational operator 6 test formulas – exceeded time limit 3 test formulas – too many combinations

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 18 / 20

slide-19
SLIDE 19

Discoveries in DLMF and Maple

Discovered sign error in (14.5.14), originally printed as Q−1/2

ν

(cos θ) = −

  • π

2 sin θ 1/2 cos((ν + 1

2)θ)

ν + 1

2

Fixed in Version 1.0.16 of 2017-09-18. Identified missing comma after the -2 in constraint of (10.16.7),

  • riginally printed as

2ν = −1, −2 − 3, . . . Fixed in Version 1.0.19 of 2018-06-22. Noticed that the left-hand side of (7.18.4), given by dn dzn

  • ez2erfc z
  • ,

where n = 0, 1, 2, . . ., and erfc is the complementary error function,

  • ur translation correctly produces

diff((exp((z)ˆ2)*erfc(z)), [z$(n)]) However, Maple 2016 simplify function falsely returns 0.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 19 / 20

slide-20
SLIDE 20

Semantic enhancement via CAS representation

Were able to enhance the semantics of 74 Wronskian W(f, g) = f′g − fg′ relations for special function by rewriting the Wronskian macro to include the variable that is differentiated with respect to. 284 further test formulas in which the DLMF uses primes for derivatives. Build easy-to-use semantic macros which isolates pertinent information and presents the math using optimal notation integrals, sums, products, limits, transportable formats This is an ongoing process to maximize content in mathematical expression written in L

AT

EX which contains sufficient semantic information to translate between computer algebra systems. Because we prefer to write in L

AT

EX, and would like to know that the math is correct and error free.

(NIST/U. of Konstanz) DRMF-CAS Wed., August 15, 2018 20 / 20