Richard Fateman CS 282 Lecture 31 Operations, representations Lecture 3.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security
Advertisements

Chapter 4 – Finite Fields. Introduction will now introduce finite fields of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key.
Richard Fateman CS 282 Lecture 21 Basic Domains of Interest used in Computer Algebra Systems Lecture 2.
CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Tyler Robison Summer
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
1 CSE1301 Computer Programming Lecture 29: Number Representation (Part 1)
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Richard Fateman CS 282 Lecture 31 Operations, representations Lecture 3.
Lecture 2: Numerical Differentiation. Derivative as a gradient
Richard Fateman CS 282 Lecture 101 The Finite-Field FFT Lecture 10.
Richard Fateman CS 282 Lecture 2b1 Basic Domains of Interest used in Computer Algebra Systems Lecture 2b.
Faster Multiplication, Powering of Polynomials
Polynomial Division, Remainder,GCD
Richard Fateman CS 282 Lecture 111 Determinants Lecture 11.
Richard Fateman CS 282 Lecture 41 Polynomial representations Lecture 4.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Richard Fateman CS 282 Lecture 2c1 Basic Extensions for Computer Algebra System Domains Lecture 2c.
Richard Fateman CS 282 Lecture 61 Evaluation/Interpolation (I) Lecture 6.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
THE REAL NUMBERS College Algebra. Sets Set notation Union of sets Intersection of sets Subsets Combinations of three or more sets Applications.
Computer Arithmetic Integers: signed / unsigned (can overflow) Fixed point (can overflow) Floating point (can overflow, underflow) (Boolean / Character)
Elementary Algebra Exam 4 Material Exponential Expressions & Polynomials.
Real Numbers and the Decimal Number System
Data Representation Number Systems.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
Number Systems - Part II
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
MATH 224 – Discrete Mathematics
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
CPSC 3730 Cryptography and Network Security
The Polynomial Time Algorithm for Testing Primality George T. Gilbert.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Intermediate Algebra Prerequisite Topics Review Quick review of basic algebra skills that you should have developed before taking this class 18 problems.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
IT253: Computer Organization
Great Theoretical Ideas in Computer Science.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Rational Expressions Much of the terminology and many of the techniques for the arithmetic of fractions of real numbers carry over to algebraic fractions,
Monomials Multiplying Monomials and Raising Monomials to Powers.
ECE 8053 Introduction to Computer Arithmetic (Website: Course & Text Content: Part 1: Number Representation.
CSC 221 Computer Organization and Assembly Language
Chapter 9 Polynomial Functions
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
Richard Fateman CS 282 Lecture 71 Polynomial Division, Remainder,GCD Lecture 7.
Chapter 4 – Finite Fields
Data Security and Encryption (CSE348) 1. Lecture # 12 2.
Great Theoretical Ideas in Computer Science.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Rational Numbers and Fields
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
Chinese Remainder Theorem Dec 29 Picture from ………………………
Copyright © Curt Hill Numerics Representation and Errors.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Nicki Dell Spring 2014.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Copyright © Cengage Learning. All rights reserved. 1.4 Fractional Expressions Fundamental Concepts of Algebra.
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Winter 2015.
Fuw-Yi Yang1 Textbook: Introduction to Cryptography 2nd ed. By J.A. Buchmann Chap 1 Integers Department of Computer Science and Information Engineering,
CS2100 Computer Organisation
Number Systems and Binary Arithmetic
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015.
CS1010 Programming Methodology
Data Structures Mohammed Thajeel To the second year students
Basic Extensions for Computer Algebra System Domains
Polynomial Division, Remainder,GCD
Presentation transcript:

Richard Fateman CS 282 Lecture 31 Operations, representations Lecture 3

Richard Fateman CS 282 Lecture 32 Recall that we can compute with any finitely representable objects, at least in principle Objects from any algebraic system, and even some ad-hoc mixtures With any algorithms –All steps specified precisely –Terminating Some processes are not-necessarily terminating. E.g. L’hôpital’s rule … use termination heuristics: time/space limits, losing some credibility for results 

Richard Fateman CS 282 Lecture 33 The Usual Operations Integer and Rational: –Ring and Field operations +- * exact quotient, remainder GCD, factoring of integers Approximation via root-finding Polynomial operations –Ring, Field, GCD, factor –Truncated power series –Solution of polynomial systems Matrix operations (add determinant, resultant, eigenvalues, etc.)

Richard Fateman CS 282 Lecture 34 More Operations Sorting (e.g. of monomials) Union (collections of objects) Tests for zero Extraction of parts (polynomial degree, constant coefficient, leading coefficient) Conversion to different forms (“expand”, express algebraic function in a minimal extension, “simplify” )

Richard Fateman CS 282 Lecture 35 Yet More Operations Differentiate Integrate Limit Prove Find region in which (in)equalities hold Confirm (as: steps in a proof)

Richard Fateman CS 282 Lecture 36 Yet More Operations Plot plot3d(exp(-x^2-y^2)*x,x,-2,2,y,-1.5,2.5)

Richard Fateman CS 282 Lecture 37 Yet More Operations Typesetting

Richard Fateman CS 282 Lecture 38 Integer representations, operations The ring operations +*- Euclidean Domain: quotient & remainder, GCD UFD : factorization

Richard Fateman CS 282 Lecture 39 Unfortunately computers don’t do these operations directly Addition modulo is rarely what we need. How do we do arbitrary precision integer arithmetic? (If we could do this, we could build the rationals, and via intervals or some other construction, we could make reals)

Richard Fateman CS 282 Lecture 310 Is it hard to do arbitrary integer (bignum) arithmetic? In spite of your belief that you are familiar with this subject, there are subtleties. Famous examples: factorization; even in long division! You must choose fast algorithms (moderate size) or asymptotically optimal algorithms (large size): what’s your target? You need fast arithmetic to compute billions of digits of  e.g. GMP or DH Bailey's home pageDH Bailey's home page Arguably, there are sensitive geometric predicates that require very high precision.

Richard Fateman CS 282 Lecture 311 Who cares about integer arithmetic? You need to be able to compute with all lengths of numbers to build a computer algebra system: without it your system lies. [SMP used floats; e.g. represented 1/3 by ] Every Common Lisp has bignum arithmetic built in, some import GMP.

Richard Fateman CS 282 Lecture 312 Some ideas just for representing integers Integers are sequences of characters, Integers are sequences of words modulo 10 9 which is the largest power of 10 less than [Maple!] Integers are sequences of hexadecimal digits. Integers are sequences of 32-bit words storing 16 bits. Integers are sequences of 32-bit words. Integers are sequences of 64-bit double-floats (with 8 bits wasted). Sequences are linked lists Sequences are vectors Sequences are stored in sequential disk locations Sign-magnitude representations possible too.

Richard Fateman CS 282 Lecture 313 Yet more ideas Integers are sequences of 64-bit double-floats (with 8 bits used to position the bits) e.g takes 2 words Integers are stored in redundant form a+b+… Integers are stored in p-adic form as a sequence of x mod p, x mod p 2, …

Richard Fateman CS 282 Lecture 314 Addition in each of these representations The fastest is the p-adic one, since all the arithmetic can be done without carry, in parallel. Not usually used because (a)You can’t tell for sure if a number is +, - (b) Parallelism is almost always irrelevant  (c)If you must see the answer converted to decimal, the conversion is O(n 2 ) (d)Conversion to decimal may be very common if your application is a bignum calculator.

Richard Fateman CS 282 Lecture 315 Multiplication Extremely well-studied. The usual method takes O(n 2 ), Karatsuba style O(n ) or FFT style O(n log n). These will be studied in the context of multiplying polynomials. Note that 345 can be mapped to p(x)=3x 2 +4x+5 where p(10) is 345. Except for the “carry”, the operation is the same.

Richard Fateman CS 282 Lecture 316 Integer Division This is too tedious to present in a lecture. Techniques for guessing the next big digit (bigit) of a quotient within +1 are available, Knuth’s Art of Computer Programming vol 2 has details. For exact division (not div+remainder) consider Newton iteration as an alternative FFT / fast multiplication helps

Richard Fateman CS 282 Lecture 317 GCD Euclid’s algorithm for integers is O(n 2 log n) but is hard to beat in practice, though see analysis of HGCD (Yap) for an O(n log 2 n) algorithm.. HGCD is portrayed as a winner for polynomials, but only by complexity analysts who (I suspect, in this case) assume that certain costs are constant when they grow exponentially, and/or subproblems, even small ones, can be done in O(n log n) time when n 2 is “faster”

Richard Fateman CS 282 Lecture 318 Reminder… A Ring R is Euclidean If there is a function 

Richard Fateman CS 282 Lecture 319 Shows the tendency to obfuscate… What Rings do we use, and what is  ? For integers, absolute value  For polynomials in x, degree in x 

Richard Fateman CS 282 Lecture 320 Where next? We could spend a semester on integer arithmetic, but this does not accomplish any higher goals of CAS We proceed to polynomials, typically with integer coefficients or finite field coeffs.