infrastructure for generic code in sagemath categories
play

Infrastructure for generic code in SageMath : categories, axioms, - PowerPoint PPT Presentation

Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Infrastructure for generic code in SageMath : categories, axioms, constructions Nicolas M. Thi ery LRI, Universit e Paris Sud 11 July


  1. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Infrastructure for generic code in SageMath : categories, axioms, constructions Nicolas M. Thi´ ery LRI, Universit´ e Paris Sud 11 July 28th of 2016, CICM, Bia� lystok

  2. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Abstract The SageMath systems provides thousands of mathematical objects and tens of thousands of operations to compute with them. A system of this scale requires an infrastructure for writing and structuring generic code, documentation, and tests that apply uniformly on all objects within certain realms. In this talk, we describe the infrastructure implemented in SageMath . It is based on the standard object oriented features of Python, together with mechanisms to scale (dynamic classes, mixins, ...) thanks to the rich available semantic (categories, axioms, constructions). We relate the approach taken with that in other systems, and discuss work in progress

  3. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives SageMath : a general purpose software for mathematics 9 , I + sqrt (3) 42, 7 Numbers : , π , 2 . 71828182845904523536028747? 2     4 − 1 1 − 1 1 . 000 0 . 500 0 . 333 Matrices : − 1 2 − 1 − 1  , 0 . 500 0 . 333 0 . 250    0 5 1 3 0 . 333 0 . 250 0 . 200 − 9 x 8 + x 7 + x 6 − 13 x 5 − x 3 − 3 x 2 − 8 x + 4 Polynomials : 2 x 2 + 1 6 x 3 + 1 24 x 4 + 120 x 5 + · · · 1 + 1 x + 1 1 Series : cos ( x ) 2 + sin ( x ) 2 == 1 Symbolic expressions, equations : Finite fields, algebraic extensions, elliptic curves, ...

  4. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives SageMath : a general purpose software for mathematics 9 , I + sqrt (3) 42, 7 Numbers : , π , 2 . 71828182845904523536028747? 2     4 − 1 1 − 1 1 . 000 0 . 500 0 . 333 Matrices : − 1 2 − 1 − 1  , 0 . 500 0 . 333 0 . 250    0 5 1 3 0 . 333 0 . 250 0 . 200 − 9 x 8 + x 7 + x 6 − 13 x 5 − x 3 − 3 x 2 − 8 x + 4 Polynomials : 2 x 2 + 1 6 x 3 + 1 24 x 4 + 120 x 5 + · · · 1 + 1 x + 1 1 Series : cos ( x ) 2 + sin ( x ) 2 == 1 Symbolic expressions, equations : Finite fields, algebraic extensions, elliptic curves, ...

  5. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives SageMath : a general purpose software for mathematics 9 , I + sqrt (3) 42, 7 Numbers : , π , 2 . 71828182845904523536028747? 2     4 − 1 1 − 1 1 . 000 0 . 500 0 . 333 Matrices : − 1 2 − 1 − 1  , 0 . 500 0 . 333 0 . 250    0 5 1 3 0 . 333 0 . 250 0 . 200 − 9 x 8 + x 7 + x 6 − 13 x 5 − x 3 − 3 x 2 − 8 x + 4 Polynomials : 2 x 2 + 1 6 x 3 + 1 24 x 4 + 120 x 5 + · · · 1 + 1 x + 1 1 Series : cos ( x ) 2 + sin ( x ) 2 == 1 Symbolic expressions, equations : Finite fields, algebraic extensions, elliptic curves, ...

  6. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives SageMath : a general purpose software for mathematics 9 , I + sqrt (3) 42, 7 Numbers : , π , 2 . 71828182845904523536028747? 2     4 − 1 1 − 1 1 . 000 0 . 500 0 . 333 Matrices : − 1 2 − 1 − 1  , 0 . 500 0 . 333 0 . 250    0 5 1 3 0 . 333 0 . 250 0 . 200 − 9 x 8 + x 7 + x 6 − 13 x 5 − x 3 − 3 x 2 − 8 x + 4 Polynomials : 2 x 2 + 1 6 x 3 + 1 24 x 4 + 120 x 5 + · · · 1 + 1 x + 1 1 Series : cos ( x ) 2 + sin ( x ) 2 == 1 Symbolic expressions, equations : Finite fields, algebraic extensions, elliptic curves, ...

  7. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives SageMath : a general purpose software for mathematics 9 , I + sqrt (3) 42, 7 Numbers : , π , 2 . 71828182845904523536028747? 2     4 − 1 1 − 1 1 . 000 0 . 500 0 . 333 Matrices : − 1 2 − 1 − 1  , 0 . 500 0 . 333 0 . 250    0 5 1 3 0 . 333 0 . 250 0 . 200 − 9 x 8 + x 7 + x 6 − 13 x 5 − x 3 − 3 x 2 − 8 x + 4 Polynomials : 2 x 2 + 1 6 x 3 + 1 24 x 4 + 120 x 5 + · · · 1 + 1 x + 1 1 Series : cos ( x ) 2 + sin ( x ) 2 == 1 Symbolic expressions, equations : Finite fields, algebraic extensions, elliptic curves, ...

  8. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Combinatorial objects ✘ ✘ ❍❍ ✇ ✉ ✘ 14 ✘ ✘ ❍ ✭ ✭ ✭ �❍❍ ✭ ✉ ✉ ✭ 10 ✉ 16 1 3 4 7 ✭ ❅ � ✭ ❅ ❍ ✏ ❍❍ ✏ ✉ ✉ ✉ 4 ✉ 11 15 18 ✏ ❅ � ✏ ❅ ❍ � ❳❳❳❳ 2 5 6 ✉ ✉ ✉ 1 ✉ 5 13 17 ❅ ❅ ❳ � � ✟ ✉ ✉ 2 ✉ 9 12 ❅ ✟ ❅ ✟ 8 ✉ 3 7 ✉ �❅ � ❅ ✉ 6 8 0100101001001010010100100101001001010010 · · · a a 1 6 q 2 − 1 1 q 2 6 q 2 q a + + q 5+2 q 4+3 q 3+3 q 2+2 q +1 q 5+2 q 4+3 q 3+3 q 2+2 q +1 b c q 4+ q 3+2 q 2+ q +1 b c b d c d d

  9. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Graphs 1 1 2 2 3 4 4 2 1 1 2 2 1 1 1 3 1 1 1 4 4 1 4 4 4 4 3 3 1 2 3 3 2 3 4 4 1 3 3 1 1 1 1 1 4 4 1 1 2 1 3 3 4 1 1 1 2 2 3 4 3 4 1 3 3 1 1 1 1 2 2 3 3 2 2 2 2 2 3 2 3 3 2 3 1 1 2 2 2 2 4 4 4 4 4 4 2 3 3 1 3 4 3 2 1 2 2 2 2 3 3 1 1 3 3 2 3 4 2 2 3 1 2 3 3 3 3 1 1 1 3 4 2 1 3 4 1 4 4 3 3 2 4 1 1 1 1 3 2 2 2 2 3 3 2 2 4 3 3 3 4 3 1 1 1 1 1 2 1 3 3 4 2 1 1 4 4 2 2 3 2 4 2 2 1 3 3 1 2 3 4 1 1 2 2 3 4 3 3 1 3 4 1 1 1 2 3 3 2 2 2 3 4 2 1 3 3 1 2 1 2 2 1 2 3 4 4 1 3 4 3 1 1 3 2 4 2 4 2 4 3 1 3 4 3 4 4 4 1 2 2 2 2 1 1 2 2 2 3 2 2 2 2 3 1 3 4 2 1 3 2 4 3 3 2 2 1 2 3 3 3 1 2 3 2 3 3 3 2 2 4 2 2 4 2 2 4 2 3 3 1 3 3 3 4 4 4 2 1 1 1 2 2 1 2 4 1 1 3 1 1 3 1 1 3 2 3 3 2 2 2 3 3 3 1 2 4 3 3 3 2 3 3 3 3 1 1 2 4 1 2 4 1 2 4 3 4 1 2 4 4 4 1 1 1 4 1 2 2 1 2 1 1 4 2 3 1 1 4 1 1 4 3 3 2 3 3 4 4 1 1 4 3 4 3 1 1 1 4 2 4 2

  10. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Geometric objects

  11. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Sage : a large library of mathematical objects and algorithms • 1.5M lines of code/doc/tests (Python/Cython) + dependencies • 1k+ types of objets • 2k+ methods and functions • 200 regular contributors Problems • How to structure this library • How to guide the user • How to promote consistency and robustness ? • How to reduce duplication ?

  12. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Sage : a large library of mathematical objects and algorithms • 1.5M lines of code/doc/tests (Python/Cython) + dependencies • 1k+ types of objets • 2k+ methods and functions • 200 regular contributors Problems • How to structure this library • How to guide the user • How to promote consistency and robustness ? • How to reduce duplication ?

  13. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Example : binary powering sage : m = 3 sage : m^8 == m*m*m*m*m*m*m*m == ((m^2)^2)^2 True sage : m = random_matrix(QQ, 4) sage : m^8 == m*m*m*m*m*m*m*m == ((m^2)^2)^2 True • Complexity : O (log( k )) instead of O ( k ) ! • We would want a single generic implementation !

  14. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Example : binary powering sage : m = 3 sage : m^8 == m*m*m*m*m*m*m*m == ((m^2)^2)^2 True sage : m = random_matrix(QQ, 4) sage : m^8 == m*m*m*m*m*m*m*m == ((m^2)^2)^2 True • Complexity : O (log( k )) instead of O ( k ) ! • We would want a single generic implementation !

  15. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Example : binary powering II Algebraic realm • Semigroup : a set S endowed with an associative binary internal law * • The integers form a semigroup • Square matrices form a semigroup We want to • Implement pow_exp(x,k) • Specify that • if x is an element of a semigroup • then x k can be computed with pow_exp(x,k) What happens if • x is an element of a group ? of a finite group ?

  16. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Example : binary powering II Algebraic realm • Semigroup : a set S endowed with an associative binary internal law * • The integers form a semigroup • Square matrices form a semigroup We want to • Implement pow_exp(x,k) • Specify that • if x is an element of a semigroup • then x k can be computed with pow_exp(x,k) What happens if • x is an element of a group ? of a finite group ?

  17. Genericity and selection mechanisms Pioneers In SageMath Scaling Summary Conclusion and perspectives Example : binary powering II Algebraic realm • Semigroup : a set S endowed with an associative binary internal law * • The integers form a semigroup • Square matrices form a semigroup We want to • Implement pow_exp(x,k) • Specify that • if x is an element of a semigroup • then x k can be computed with pow_exp(x,k) What happens if • x is an element of a group ? of a finite group ?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend