Start of topic | Skip to actions
This page contains the scribe notes for the Fall 2009 COMP 617 seminar. The scribe should add a new heading and section below on this page, or attach a separate file to this page. The heading or the file should then be linked from the course schedule.

Notational conventions

We decided to drop the Blackboard font on the wiki.

  • |B: Blackboard B B (denotes the set of booleans)
  • |N: Blackboard N N (denotes the set of Natural numbers)
  • |Z: Blackboard Z Z (denotes the set of integers)
  • |R: Blackboard R R (denotes the set of Real numbers)

08/24/2009: Introduction to Exact Real Arithmetic (part 1)

Speaker: Walid

Scribe: Cherif

Introduction

This semester we plan to focus on Exact Real Arithmetic (ERA). Floating point arithmetic is not exact. When you make complex numerical computations, you can get some significant imprecisions. Things that we need to deal with include:
  • (R,1,0,+,*,-,%,exp,diff,integration,<,=,...)
  • Corky: question about the Fortran implementation of interval arithmetic and how it handles comparisons. An intuitive technique would be to create different threads following different outcomes of a comparison.

Goals

  • Survey (For next class. 1-2 pages max+references)
    • What can you find as evidence of problem of numerical inaccuracy? How big is the problem?
    • What can you find as solution technologies? (ERA, interval arithmetics, arbitrary precision arithmetic, sensitivity analysis, etc...). Are these just different names for the same thing or radically different solutions?
    • What do you believe can be achieved of solving this problem?
  • Collection of libraries.
    • Hanz fortran implementation
    • ...
  • Std. ref implementations
    • handmade (floating point and extended floating point Cleve Moler)
    • Mathematica
    • Maple
    • Matlab
    • ...
  • Collection of benchmarks.
    • We can use Acumen as tool for expressing benchmarks.
  • Collection of metrics for evaluation.
  • Evaluate performance of different libraries.
  • Ranking of libraries at end.
  • Principles of designing ERA libraries.
  • Principles for verifying ERA operators.

Possible representations

Representations of real numbers between 0 and 1.

  • Representation 1: as a function from the natural numbers to digits
B = Bool = {0,1} = {T,F}
Real1 = (N -> B)
<0 1 0 1 1 0 ...>

  • Representation 2: Lazy list (product of a bool and a delayed Real2)
Real2 = B x (1 -> Real2)

  • Representation 3:
Real3 = 1 -> (B x Real3)

  • Representation 4 (by Fulong): list of exponents
Real4 = B x N x Real4 

Bool is not needed. We need the set of integers Z instead of the set of natural numbers N. We need the list to be a lazy list (by delaying Real4)

  • Representation 4++ (revised):
Real4++ = Z x (1 -> Real4++)

  • Representations -1 & -2:
Real-1/-2 = Dedekind cut (I & II)

Homework (for Wednesday, bring to class as a printout)

  1. Survey
  2. Write the meaning function [|.|]: Reali -> R for each representation (use floating points for reals)
  3. Define OCaml types for each representation
  4. Define + & * for each representation

08/26/2009: Introduction to Exact Real Arithmetic (part 2)

Speaker: Walid

Scribe: Cherif

Meaning: Real -> R
B = {T,F} = {0,1} = 2 (blackboard 2)
N = {0,1,2,...}

Reviewing Representation 1

  • A function from natural numbers to booleans. When applied to a natural number, this function returns the value of the binary digit in the corresponding position.
Real1 = N -> B
Example: 0.01101001....
  • Can all the numbers between 0 and 1 be represented using this way? Does this representation capture all of the reals?
  • Next assignment: write my_pi:Real1
  • There are infinitely many real numbers. We need infinitely many functions to be able to represent them. We need to prove that the set of real numbers is bigger than the set of integer values and we need to prove that the set of function is equal to the set of the reals.
  • For a given real number, is this representation unique? Note that equality on functions is duck equality: Two functions are the same if for the same inputs they produce the same values.

if x=0.9999... 
then 10x=9.9999...
and 9x=9 (by subtracting 10x-x)
however 9x being equal to 9 means that x = 1.0
which shows that x=0.9999... and 1.0 are equivalent so there are no canonical representation for reals.

  • These are things that we need to have:
(Real,0,1,+,-,*,/,exp,log,d/dx,integration,...)

  • Addition:
add: (N->B) -> (N->B) -> (N->B)
=RealxReal->Real
    • We need to design addition such that:
      • Meaning(a+b)=Meaning(a)+Meaning(b)
The + on LHS is our implementation of addition while the + on the RHS is the mathematical +
      • Meaning(1/a)=1/Meaning(a)
1/ on the LHS is our implementation while on the RHS it is the mathematical 1/

Homework (for Friday)

  • Finish original homework
  • We will exchange submitted homework in class and each student will present the homework he read on the next class (Monday)

8/28/09: Survey of Number Inaccuracy Problems and Solutions

Speaker: Walid

Scribe: Travis

Things to Cover

  • Questions on implementation
    • Adding infinite sequences
    • OCaml
  • Stream Processing
    • How to be Lazy - paper
    • Dong's paper

Remarks on Errors Caused By Inaccurate Real Number Representation

  • If you are doing physical modelling, small errors can add up over many iterations
  • In real life applications, floating point errors usually aren't a problem. People are concerned, but no strong evidence that problems have happened in the past.
    • Most analysis programs conclude that these floating point errors are ok
    • people have effective error control algorithms The values of exact reals is in knowing how accurate your computations are.
  • Found several incedents where roundoff errors caused problems.
  • Example of uncertainty analysis: there was a satelite re-entering, and Bush wanted to shoot it down with a missile but wanted to know how certian people were that it would succeed.

Ways to Deal With Errors

  • Libraries
    • Taylor 1+
    • Make addition etc algorithms that are more accurate.
    • Arbitrary precision arithmetic
    • Nested Intervals
    • A sequence of intervals that get smaller and smaller where the size of the interval tends to 0
    • Interval Arithmetic
    • Continued Fractions
  • Analysis
    • Affine Arithmetic
    • Sensitivity analysis
      • Forward Analysis
      • Backward Analysis
  • Evvor-Aware Algorithms
  • Definitions of Reals in Math (related to libraries)
    • Taylor
    • Cauchy Sequences
    • Dedekind
  • Sidenote: use Tiny Examples in your surveys

Homework (for Monday)

  • Finish Surveys
  • Think about how to represent .1000... and .0000... in OCaml

8/31/2009: Stream Programming in OCaml

Speaker: Jun

Scribe: Marisa

Stream programming in OCAML

Type declarations, general form:

type name = T of type | T of type

One of the homework representations was

type r2 = R2 of bool * (unit-->r2)

Star refers to pairing; multiple pairings can be used.

type iorb = int | bool (It's either an integer or a Boolean, but need explicit tag to say which.) The tag to distinguish is: type iorb = I of int | B of bool

In OCaml, all types are lost when put into an executable because it is statically typed. Explicit tags that are put in, however, stay.

Computation done primarily with pattern matching, such as:

match x with 
   | I I --> I (I + 1) 
   | B b --> B (not b) 
;; 

The integer line is wrapped in the same tag (I).

Instead of having an infinite suffix, have just one bit (first bit is actually computed), then next bit is “promised” to calculate on demand. Unit means type that has no interesting value, so it is used to represent uninteresting arguments or return values. (Cannot declare a function with no arguments, so use unit for the uninteresting.)

( ) is an object, but it is the uninteresting object. 
f: unit &#61664; r2
f ( ) 

In Java for example, there is actually a type Void that represents the null value, but that isn’t the case here.

Ex:

 
let f (r: r2)  =                   (*type annotation on the function*) 
   match r with 
   | R2 (b, f') 
   match f'( ) with 
R2 (b', _)  --> b' 

(Underscore is a keyword.) Example: R2 (a,a) is a syntax error, so R2 (,) would be used. Note: Doesn't quite work like a lazy sequence in terms of pattern matching.

If we want to get the nth bit: (keyword rec is recursive function) Note: From Scheme, the difference between let and let rec depends on whether f can be used in its own definition (which would be a recursive definition).

let rec f r n = 
   match n with 
   | 0 --> match r with 
      | R2 (b,_) --> b 
   | _ --> match r with 
      | R2 (_,g) --> 
      match g ( ) with 
         f(g( )) (n') 

The first bit is discarded in the underscore of (_, g), and then g( ) gives rest of sequence.

Conceptually, when representing a list the tail of the list is an empty list (canonical). However, for an infinite list, there is no tail. Instead, there is a function in between each cell that takes a unit. This serves as a cutoff so that there is no tail. This ends up being delayed computation ("promise" to compute).

Example: writing addition

let rec plus r s = 
   match r, s with          (*this r,s is the same as creating a pair and matching the pair*)
   | R2 (b,f), R2 (c,g) -->             want to return something of type R2
   let (carry, rest) = plus ' (f( )) (g( )) 
   let carry1 = 
(carry 1, R2(b+c+carry2, rest) 
;;
-get the carry from the rest of the bits

let plus r s = match plus ' r s with |(_, sum) --> sum
(*parens act as tags here*)

For adding, for example:

0.01010.. + 0.00101.. = 0.01.. no carry yet. As long as keep getting one and not a carry, need to check the next bit to see if there is a carry. Thus, want to precompute carry just by looking at the first bit.

let rec carry r s     
   match r,s with 
   |R2 (b,f), R2(c,g) --> (*bool arith. here*) 
      match b + c  with                                  

      | (cry,0) --> cry                                      
      | (cry,1) --> cry + carry (f( )) (g( ))         

9/2/2009: Functions Representing Streams

Speaker: Walid

Scribe: Mathias

Walid's Comments About Notes

  • Drop blackboard font on the wiki. Just write R instead of |R.
  • 1/. is not the percent sign! It's a reciprocal sign for the inverse operation.
  • Still waiting for 1st homeworks.

Comparison of Collection Types

Collection Type Notes Cardinality Definition
Lists also known as: - finite - recursive + base case
sequences, vectors, products, tuples - can ask how many elements  
       
Streams ~= R, isomorphic to constructive real numbers in terms of cardinality - infinite - recursive, no base case
for reference, see Monograph    
       
Functions   - depends on domain - primitive
  - can't ask how many elements if domain is infinite  
  - can capture both lists and streams  
  - can implement lists if language doesn't have them: Church encodings  

Homework on Isomorphism

Prove that B ~= 2)

where B = {T,F} and 2) = {1,2}.

Def: A ~= B iff there exist f, g, such that
for all a in A, g(f(a)) = a, and
for all b in B, f(g(b)) = b.

Addition of Exact Reals Implemented Using Functions

Notation:

Meaning function: [|X|] = Meaning(X)

Definition:

Real = N -> B
(Real, +, ...)

(Reals are functions from natural numbers to Booleans)

[| + |]  : R x R -> R
plus = + : Real x Real -> Real
         : (N -> B) x (N -> B) -> (N -> B)
           \___a__/   \___b__/    \result/

OCaml:

let rec plus (a, b) = let result n =
                        ... a n ...
                        ... b n ...
                        ... plus (rest a) (rest b) ...

let rec because the function calls itself, i.e. it is recursive. plus is supposed to add the digits from a and b, and take care of the carry. We don't have a way to return the carry separately, though. Instead, when adding the n'th digit of a and the n'th digit of b, we return the carry of that operation. The n'th digit of the sum actually is the (n+1)'th digit.

              [| A |] + [| B |]
[| A + B |] = -----------------
                      2

We push everything back. Since we move the digits to the right, this has the effect of dividing the sum by two.

plus "n'th digit of a" and "n'th digit of b" returns the carry of a_n + b_n

We can do a case analysis on the n'th digits of a and b:

n'th digit of a n'th digit of b carry (n'th digit of sum)
0 0 0: guaranteed no carry
0 1 ?: carry if carry from rest
1 0 ?: carry if carry from rest
1 1 1: guaranteed carry

OCaml:

let rec plus (a, b) = let result n =
                        match (a n, ab n) with
                        | (0, 0) -> 0
                        | (0, 1) -> (plus (rest a) (rest b)) n
                        | (1, 0) -> (plus (rest a) (rest b)) n
                        | (1, 1) -> 1

What does rest do? It shifts digits to the left.

(rest a) n

is the same as

a (n + 1)

Therefore:

let rest a = let result n = a (n + 1) in result

Summary

Functions are powerful, but it may be easier to just use streams. For example, how do we make sure there is no infinite recursion?

Homework and further discussion were left for Friday.

9/4/2009: Acumen and ERA

Speaker: Walid

Scribe: Marisa

Handout points: standing research questions as a guide for the semester -Need to have real-world goals in mind that can be solved by the work we do. What are results of numerical inaccuracy (natural disasters, etc.) that could be prevented by solving the issue with exact real arithmetic?

For floating point, computations are considered to be done in constant time. Essentially, each computation is one step no matter what the input is. For ERA, this is not the case. Rather, the user may wish to see the result to an arbitrary number of digits, and the cost may be large. (Cannot guarantee the next bit in a certain amount of time.) Each digit that results in the computation can be as big as the time it takes for the whole computation. This is the price of ERA's arbitrary precision.

We're not building a calculator. We are solving bigger problems. We will use Acumen for example problems and compare to other implementations.

We will build things on top of Acumen and beneath Acumen to explore this.

Where can we win with ERA? -Exact answers to things that previously had inexact answers or no answers. -Maybe, get exact answers and run faster as well.

How would this double advantage be possible? Ideas: Plausible, but only on a large scale; over a long series of computations. This would be where the advantage would come in. Floating point might end up spending more on controlling error, and ERA wouldn't need to. Counterpoint: More accurate algorithms wouldn't necessarily run faster. (Eliminating error control won't necessarily speed time.) Because era operators are smarter, they will be more expensive. More control overhead to achieve their flexibility.

Automatic storage managmt vs manual storage mangmt: there are cases where manual is much better than automatic. Huge policy overheads. For any computation oyu do in era, you use ordinary arithmetic. How could speed be improved?

There are reasons we can expect era to be faster. Numerical codes are written by hand. There is a limit to writing things efficiently by hand--it takes time. If you are able to do things at a higher level, more structure, you have more control with more opps for optimization. Automates more things. Also, you don't necessarily know that every computation is necessary for final result. (padding with extra bits to make sure there aren't too few bits) There could be cases like multiplying by zero and that takes time, when with era, you don't need to do that. (Get only the very necessary work done, so save extra time.)

Note: We are talking about two kinds of speed here: designing algorithms, and then actual effective computation.

Last point on handout refers to things that we need to understand. If you have a stream rep, how do you know that .999 = 1? Could take arbitrary number of steps to determine. So, we say that equality or comparison are undecidable. How does this affect our ability to compute? Redundancy, incrementality, and fairness are also things that need to be considered for their impact on computation. Strictness analysis and abstract interpretation can be applied to ERA to our advantage.

The research questions here are dynamic. As we go forward, keep the questions in mind as a guide, and address them. Additions can be made to the list.

Implementation: of addition:

using rep. N-->B and indexing from 0

(handout notes) 
for zero == <.0000...>
defined as 
let zero n = false

one == <.111...> 
let one n = true 

representing half: 
half == <.1000...> 
let half n = match n with | 0 --> true 
(see handout notes) 

We can define one, zero, half, first, and rest. Case analysis for determining first carry: A concise way to find second digit (first after carry) is an 'if then else' involving same cases (if d1=d2 then d3 is the digit, if not then the opposite of d3 is the digit). Extend this logic to say what the carry is (first digit).

This 'hardware' representation exists because real numbers exist, essentially. (It is how the computer figures out if it's adding two numbers, on the most basic level.) Code in handout has a function plus that does what the d1, d2, d3 method does. Converting float to these reps, and vice versa.

Generating pi: spend some time figuring it out on your own then look up what the research is on generating pi.

Think about how to do subtraction and pi for next time.

Keep this representation in mind (the d1, d2, d3) because it doens't show up in code. There is a lot of number shuffling in the current code, because of N--> B. Are there other reps that would make it ieasier to think and write about? (Consider.)

9/9/2009: Multiplication

Speaker: Walid

Scribe: Henry

  • When we multiply in this representation, we have (N->B) * (N->B)-> (N->B)
  • According to Dr. Taha, a divide and conquer strategy is necessary
  • Thus, from the simple example .1 * .0, we can affix streams and have a recursive algorithm:
  • .1C * .0D, where C and D are streams of digits-- we'll define the product in terms of C and D, as we can calculate more of those later-- we leave computation of those until we need to. We don't necessarily know what each digit is until we know the next one
  • Another suggestion-- explore the fact that multiplication can be defined in terms of addition,
  • In the example of .C*.0D= .0+.0(C*D), and .C*.1D= .0C+ .0 (C*D)
  • Sanity check for numbers of digits-- just check with typical arithmetic example, like .1*.0123
  • Metaphor: it's like a mortgage, you pay down as much as you need to to stay in your house, rather than paying it all at once-- except that we're computing digits instead of paying money
  • Let us define A=.01A, B=.11B
  • Defining A:
f n= if n=0 then false
else if n=1 then true
else f(n-2)
  • Defining B:
 g n= true
  • Meaning of A & B:
[[B]]]=1
[[A]]= 1/4+ 1/16+1/64+1/252...
  • What is this value? We can see: 4S=1+S, so 3S=1, so S=1/3, where S is the series defining A
[[AXB]]= [[A]]X[[B]] = 1/3
  • A*B= A*.1B= .0A+.0(A*B)=.0(A+A*B)=.01A+(A*B)... recursively calling itself again...
  • However, is this a problem with the addition, or a problem with our algorithm not looking deeply enough?

9/11/2009: Notes on cost estimation:

Speaker: Walid

Scribe: Cherif

The fib function:

fib n =
if n = 0 then 0
if n = 1 then 1
else fib (n-1) + fib (n-2)

Estimating the cost for various inputs:

fib 0
= if 0 = 0 then 0 ...
= if true then 0 ...
= 0
If we count the number of recursive calls, then cost is 0, if we count all the operations, then the cost is 3

fib 1
= if 1 = 0 then 0 else if 1 = 1 ...
= if false then 0 else if 1 = 1 ...
= if 1 = 1 then 1
= if true then 1
= 1
Cost is 5

fib 2
= if ...
= if ...
= else ...
= if ...
= else ..
=
= fib (2-1) + fib (2-2)
cost is the cost of computing 2-1 (which is 1) + cost of computing 2-2 (which is 1) and the cost of computing fib 1 (which is 5) and fib 0 (which is 3) and then adding them (which is 1) + the cost of the overhead to reach the recursive calls (which is 4) Cost is 15

fib 3
Cost is 27

fib n
Cost is ?

Cost table:

n #steps for fib n
0 3
1 5
2 15
3 27
n ?

9/14/2009 Polishing Writing

Speaker: Walid

Scribe: Jun

Standardized structures

What are the patterns that we see in newspapers?

  • Every newspaper has headline (title is big)
    • Headline for each point, and a main headline
  • Fairly narrow columns
    • Easier to read
  • Important stories begin in the front page and jump to later pages
    • Front page is a prime real estate
    • Tends to be more subtle for technical writing but the technique is applicable
      • Abstract is the front page, intro is a detailed front page
  • Pictures in the front page
    • Draw attention, organize
  • Each paragraph starts out with indentation, and paragraphs are fairly uniformaly sized
    • Regular paragraph structure is a sign of well-developed writing

In speech you can often wander into tangents but not in writing!

The most important thing in writing is logical development.

If your report has a lot of white space, you're not using space efficiently.

What are the structures common to technical papers?

  • Always start by title, author(s), date an abstract/summary
    • "AI memo" is like technical report
    • Papers from some sources (like people's homepages) don't have dates, which is annoying for the reader.
    • You want to write the draft abstract first, but the final abstract last.
      • The writing forces you to do a lot of thinking
  • First section (almost always intro)
    • Explain the problem, contribution, value of the work, pointers to the different section (paper structure)
    • Say "we do this (Section 2.1)" or "we prove foo (Theorem 2, Section 3)"
    • Surprises are not good

The section names "Introduction" and "Conclusions" should not be changed. They're anchors and you want to follow standard nomenclature to guide the reader.

The survey report

What are the necessary sections?

  • The problem
    • Most people have illustrated this by collecting examples of real-world disasters
  • Various methods to solve and what we gain
    • Could be 1 section or more
    • Think what the reader will be asking: which method is better?
  • Last question for the survey asked what would happen if we solved this problem.

Other points.

  • Start with text.
  • Tables are great. Sentences with repeating structure can be better off as a table.
    • Tables are useful for collecting data.
    • Sparse tables might be better organized into a paragraph or some other style.
      • Marisa's example: a table with the names of methods (for addressing floating point error) filled in regularly but not their descriptions.
    • Thinking about comparisons in terms of tables is always a good idea, but for presentation the tables should be small and pretty.
  • Never too early to start writing acknowledgements.
  • Beginning section for the paper (intro and abstract) explains what's in the whole paper; do the same for each section (maybe except for intro).
  • References should have name of author(s), venue

9/16/2009 Complexity of Multiplication

Speaker: Walid

Scribe: Alexandre Chapoutot

The subject of the seminar is the complexity of the operation of multiplication between binary streams. By complexity, we mean the amount of work to get the nth digit of A * B. This complexity is expressed by a function f of n.

Claims

Following the different study of the participants we have these claims:

  • Linear: the complexity is described by a function f(n) = k n + c. This case happen in few cases but not always.
  • Quadratic: the complexity is described by a function f(n) = k_1 n^2 + k_2 n + c. This case happen in few cases but not always also.
  • Cubic: the complexity is described by a function f(n) = k_1 n^3 + k_2 n^2 + k_3 n + c. In few cases.
  • Exponential: the complexity is described by a function f(n) = k^n. Once again it is not always the case.

Operations to count

The main point into the study of the complexity is to know what we are looking at. In other words, what are we counting:

  • The number of additions beaten streams, or
  • The number of Boolean operations, or
  • The number of recursive calls of the function.

Assignment

Redo the study of the complexity with such things in mind. In particular, making some experimentation and making time analysis. To do that, we can use MetaOcaml? which offers a convenient way to make time analysis see for example:

  1. W.~Taha. A Gentle Introduction to Multi-Stage Programming, Part I. Domain-Specific Program Generation, pages 30--50, 2004.
  2. W.~Taha. A Gentle Introduction to Multi-Stage Programming, Part II. Generative and Transformational Techniques in Software Engineering II, pages 260--290, 2008.

Analysis

The study of the complexity brings a deeper understanding the multiplication algorithm.

The following operation introduces two stream addition if the element (a.c) is put in front of the stream (B.D).

    a B
 x  c D
 -------
   0 (a.c)
   0 0 (a.D)
   0 0 (c.B)
   0 0 (B.D)

The question is what happen following the different values of the digits of streams to add. We do a case analysis and we study the values of the complexity following the number of stream additions, the number of Boolean operations and the number of recursive calls.

  • Case 0+0:
    • numbers of additions is 0
    • numbers of Boolean operation (AND) is 1/2 * n
    • numbers of recursive calls is 1/2 * n

It seems that this case induces a linear complexity. Taking into account the implementation indeed we have no Boolean operation but 1/2 * n tests. Combining with the number of recursive calls we get a quadratic complexity (n tests made n times). Explanation: test involve the "first" and "rest" functions on streams, but "rest" is constant time (it is only a shift). And unfortunately the "first" operation is linear in function of n so the result.

Note: Travis asked if compilers cannot optimize such things. Walid answered that compilers do silly things in general that is they usually do not change the class of complexity of problems with their optimizations.

Remark: It is very important to not forget the implementation. It can change the understanging of algoruthms.

The other cases will be study in the next seminar.

9/18/2009 Complexity of Multiplication (part2)

Conclusions From Last Time

Examining a certain digit is a linear time operator, because it is constructed by a sequence of 'rests'. This is true no matter what number we are trying to get a number from.

Examining Multiplication of 0x0

Do we have to do work for all previous digits? Yes: because of the way the algorithm is designed, you start at the beginning of the number and look at one digit at a time till you get to the digit you desire.

Is it possible to write a version of multiplication that doesn't require us to look at all of the previous digits? No. They can all influence the answer.

A fascinating question is what is the lower bound for computation time for multiplication (with the best possible algorithm).

We conclude that 0x0 is O(n^2).

Examining Multiplication of 1x0 (or 0x1).

We only have on addition. We will assume it costs constant time.

C(n) = A(n+2) + C(n+2) + n.

We decide that this formula doesn't actually accurately represent multiplication, because we need to do n additions for each n'th digit. Walid says that every time we introduce an addition, addition must be done for every future digit of the multiplication. A consensus that this is true isn't reached.

But this would give us O(n^3) complexity.

9/21/2009 Complexity of Multiplication (part3)

Speaker: Walid

Scribe: Marisa

Assignment for next class: Bring final version of survey papers and of complexity analysis. For complexity analysis homework, do the hand derivation.

Class will divide into groups of 2 to do collaborative revisions to the surveys, keeping notes about the collaborative process at the end of each iteration of the paper. Groups will merge into groups of 4, then 2 groups, then finally the class will collaborate on one final version. Space guidelines (page count) are loose guidelines--more space may be used if necessary.

Complexity analysis:

The issues with performance: -delayed cost on remaining streams ("rest" operation) -Do we need previous digits? -How many digits do we need after n? (present digit) These issues are of concern in defining any operation.

At this level of defining the real numbers, the number of digits needed becomes a notion of sensitivity analysis.

Sensitivity of a function is defined as df(x)/dx. For example, a straight horizontal line has no sensitivity to input. (It will not ask for digits of input in order to give output, because output is always the same.)

A sensitive function has a high rate of change. The smaller the interval of x for which we want to know the value of the function y(x), (with x and y axes), the more digits we need.

(This approach does not deal with discontinuities. It is for continuous and differentiable functions.)

For multiplication: to compute x*y, extract head of x and rest of x, and head of y and rest of y. Just extracting each head is cost of n, because doing that requires doing "rest" operation, which is more expensive based on current position.

Need to do the derivation by hand (full computation, tracing the evaluation) for the hw, in order to see how the program works.

Eventually, timings will test the clock speed. Ultimately both speed and space are important for this programming.

0/0 case: linear-->quadratic 01/10 case: quadratic-->cubic

(The intuition for this is that addition is linear.)

1/1 case: cubic

Additional notes:

The right thing to do when analyzing the complexity of multiplication and addition is using higher order complexity functions. So for example we want to get the complexity of addition as function is inputs (where inputs themselves are functions).

Is memoization helpful? can it reduce the cost of getting any of the bits of an input to a constant?

9/23/2009 Complexity of Addition

Speaker: Walid

Scribe: Henry

Recapping: In multiplication, getting the nth digit has n cost (as we take rest of rest of rest... of n). The Question: are the additions done dependent on n as well, or independent of it?

Reexamining addition

     a  B
  +  c  D
-----------
     d1 d2 R

Where:

d1=0 if a=c=0
d1=1 if a=c=1
d1=0 if a!=c, head of B+D=0
d1=1 if a!=c, head of B+D=1 -- otherwise, this doesn't get looked up
d2=h if a=c
d2=!h if a!=c

Negating h would require us to look inside B+D, otherwise, h remains uncomputed Optimization for d1: d1=a if a=c d2: essentially, if a=c then B+D (remains uncomputed) else Toggle (B+D) (gets the first digit of B+D and flips its value)

Definition of Toggle

let toggle f=
    let h n=
        if n=0 then
       not (f(0))
   else f(n)
    in h;

Cheap: returning a function. Costly when pulling out digits.

Looking up d1 has constant cost if the comparison comes out right, possibly explosive in cost if comparisons don't work out

Cost formulation

Ignoring explosive case, looking up second digit has constant cost when it occurs, but could cause more costs down the road

Let's call the cost of addition A(0)

A F, G(0)= F(0)+G(0)+ 1
A F, G(n+1)= F(0)+G(0)+1+A R(F) R(G) (n)
R(G)(n)= G(n+1)+1
[Edwin Westbrook Formulation] Even if we shift and have the first thing that we're looking at as the nth position, as per Alexandre's formulation, we still have extra work.

Suggestion: Have recurrences on constant functions, remove operators on F and G in the second parts, simply have:

A F, G (n+1) =A F, G(0) +A RF, RG, (n)

10/05/2009 Complexity of Addition (continued)

Speaker: Walid

Scribe: Cherif

Addition Revised

    a   B 
+   c   D 
---------------
    d1  d2  R 

Where:

d2 = a=c?d:not d 
d1 = a=c?a:d
d  R = B+D

Notation, Higher order function, and Carrying

Note that:

f(x,y,z)
is the same as:
f x y (z)
It is also possible to have x,y as a subscript for f(z) to mean the same thing.

These things have different names like:

  • Higher order functions
  • Functionals
More functional examples:
  • Summations
  • Products

Another related concept is carrying: A function f (n,m) takes in a pair and returns an answer. The same task can be achieved using a function F (n) (m) which takes a value and returns a new function waiting for a second value to return an answer. See the example below:

f (n,m) = n + m
F (n) = 
  let h (m) = n + m
  in h

Going from f to F is called Curry(ing) or Shonfinkel(ing). Going in the inverse direction (from F to f) is called uncurrying.

Back to Addition

We will use A(F,G,n) for the Cost of computing the nth bit while adding two reals whose digit lookups have costs F(n) and G(n).

The cost of getting the 0th digit is:

A(F,G,0) = F(0)+G(0)+1   
//Lookup a, lookup c, evaluating if condition

The cost of getting the 1st digit is:

A(F,G,1) = F(0)+G(0)+1+A(F+,G+,0)
         = A(F,G,0) + A(F+,G+,0)
//Lookup a, lookup c, evaluating if condition, recurse on rests

The cost of getting the 2nd digit is:

A(F,G,2) = A(F+,G+,1)+1 
//The last +1 is because we need to check that n != 0 and n != 1

In general:

A(F,G,n+2)=A(F+,G+,n+1)+1

Let's see if this works for n = 5

A(F,G,5)
=1+A(F+,G+,4) 
=1+1+A(F++,G++,3)
=1+1+1+1+A(F++++,G++++,1)
=4+F++++(0)+G++++(0)+1+A(F+5,G+5,0)
=5+F+4(0)+G+4(0)+1+F+5(0)+G+5(0)

But:

F+(n)=F(n+1)+1
therefore:
A(F,G,5)=
6+F(4)+4+G(4)+4+F(5)+5+G(5)+5

So we can generalize:

A(F,G,n)
=n+1+F(n-1)+G(n-1)+n-1+n-1+F(n)+G(n)+n+n
=5n-1+F(n)+G(n)+F(n-1)+G(n-1)

We can change addition from linear to quadratic (assuming F and G are constants) if we are strict about computing d1 and d2 instead of jumping directly to the rest.

10/7/2009 Acumen Poster

The overall structure is good. Descriptions of problem, solution stands out. "Acument saves time" is a good advertisement.

Pictures illustrating what a CPS is? (IOW, we have no intro.) Pressure on real estate. Don't focus on PhyDL? in particular but should present acumen as a whole. Pendulum might be good.

Edwin thinks bus controller illustrates the CPS idea well. It might be a bit too detailed.

Turn examples into "modeling in Acumen". Best if we can pick diverse 3 examples. Don't write Acumen ASCII code, but put the pretty-printed code. Include the ASCII code in a tiny box.

Marcie's example is nice because it demonstrates a bunch of ideas like Lagrangian, partial diff. Nice if we can write a discrete controller for Marcie's example. A simple controller that tries to stabilize it should be fine. Goal is to reduce total energy.

Any other examples?

Marcie's example showcases recent progress. We need other systems. Bouncing ball is potentially a good example. Maybe get mechies to help us write the equations. What's the controller part? We don't need controller because bouncing ball already has discrete transitions when it bounces. Tricky thing is that derivatives wouldn't be continuous. Old Acumen solves for highest-order derivative (which may be discontinuous). RIDL can discretely change any variable upon an event.

We could illustrate interactivity (the haptic stuff). We might have to tweak title to say just (virtual) physical systems instead of CPS. We don't have to get into the hybrid aspect. Marcie' example is hybrid, interactive exmaple is not but includes discrete observations.

Bouncing ball and juggling will have to wait for next year. You can remove the words like "Examples" or "Case Studies". Follow the style at the top of page and that should give you more space. Have big eye-catching pictures with a short detailed description in small text.

Three pictures: stablizing a mechanical system (pendulum); implementing haptic feedback system; modeling complex oil-exploration robots. Include "Problem" with the pictures box. Acumen code right below them (connect code with corresponding examples). Small foot notes like "Expressive Mathematical Language", "Capturing Discrete Events", and "Modular Specification" or "Powerful Abstraction Mechanisms".

Include the flow diagram of design (the one that depicts the iterative nature) in the Problem part.

10/9/2009 Creating Reading List

Reading list:

-Pursuit of real answers -read from 2 perspectives: learning what's there, and also revising it to send it as a journal paper -if there are performance analyses or exercises that can be done in seminar, note them

-MSB Arithmetic paper (Most significant bit)

-BBP/BPP Paper on computing digits of pi

-Corky's paper: Fortran and ERA

-Edalat's paper on ERA integration

-Journal paper by Edalat, Computing with real numbers

A helpful perspective to take on the implementation is circuits. In the pursuit paper, it is proved that for any output of demand, only need a fixed amount of look-ahead. It would be interesting to see if we can eliminate buffering. We can have a multitude of implementation strategies as long as output is the same. An idea for a seminal paper is to compare different strategies.

For each paper, everyone will write a one-page response: summary of work, strong points, and weak points. Strong points--what information can we, and other people, build on out of this paper? Weak points--what are limitations in the work, and what opportunities might there be for us to jump in and add to this work?

Everyone will share their responses and discuss. Do one paper every 2 lectures. Someone is assigned to read the paper the first lecture, then they give a talk to help others with the notation, before everyone reads it. (Not discussing content, however.) The reader will write a one-pager about the notation used in the paper.

Scheduling: first reader of each paper

Pursuit--Marisa

Pi--Henry

MSB--Cherif

Corky's paper--Edwin

Edalat's integration paper--Jun

Edalat's Computing with real numbers

10/23/2009 Acumen Paper Abstract and Reading List

Speakers: Cherif and Eddy

Scribe: Mathias

Acumen Paper Abstract

Every abstract should answer the following seven questions:

  1. What is the problem/focus of this work?
  2. Why is it important?
  3. What is the context?
  4. What are the methods?
  5. What are the results?
  6. What are the unique contributions?
  7. What are the possible applications?

We read the abstract of the Acumen paper "Mathematical Equations as Executable Models of Mechanical Systems" and identify the sentences that answer the questions.

  1. What is the problem/focus of this work?
    • "While numerous tools support later stages of developing simulation codes, there is inadequate tool support for turning high-level analytical models into running simulation codes."
  2. Why is it important?
    • "Increasingly, hardware and software components must interact directly with a physical environment. This trend significantly complicates testing, as it necessitates modeling and simulation of physical phenomena."
  3. What is the context?
    • "While numerous tools support later stages of developing simulation codes"
  4. What are the methods?
    • "we study the form of analytical models that arise in this domain, and the process by which domain experts map them to executable codes."
    • "We then present a series of analyses and transformations that automate this mapping"
    • "and which we have implemented in a cyber-physical system modeling environment called Acumen."
  5. What are the results?
    • "many mechanical systems can be mapped automatically to simulation codes"
  6. What are the unique contributions?
    • "1) a light-weight algebraic solver"
    • "2) partial evaluation"
    • "and 3) efficient symbolic differentiation."
  7. What are the possible applications?
    • "testing..." "hardware and software components must interact directly with a physical environment."

Reading List

  1. In Pursuit of Real Answers (IEEE)
  2. Most significant bit (MSB) arithmetic (ask Walid for reference)
  3. RealLib: An efficient implementation of exact real arithmetic (ACM)
  4. Lazy Algorithms for Exact Real Arithmetic (ScienceDirect)
  5. Exact real arithmetic: a case study in higher order programming (ACM) or (ACM), but cannot find document for the latter
  6. Paper on Pi (ask Walid for reference)
  7. Computing with Real Numbers (SpringerLink)
  8. Numerical Integration with Exact Real Arithmetic (SpringerLink)

Note: For the article links to work, you may have to be on campus.

We decided to read these papers, approximately one every two seminars. A randomly selected person will talk about a paper; that way, everyone has to be prepared.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.