Presentation on theme: "Style for Special CS Components. Mathematics “Our confidence in any science is roughly proportional to the amount of mathematics it employs” (Bronowski."— Presentation transcript:
Mathematics “Our confidence in any science is roughly proportional to the amount of mathematics it employs” (Bronowski & Mazlish, The Western Intellectual Tradition) “The use of mathematics for expressing ideas is often the difference between a vague paper and a clear one.”
Mathematical Clarity Be correct: “Reading mathematics is difficult work, … and pointless if the mathematics doesn’t make sense.” Use mathematics to untangle convoluted statements (introducing identifiers)introducing identifiers Use words correctly. “intractable” means NP-hard, not “hard to do.” “formula” and “equation” are not the same. “subset” not to be used to mean “sub-problem” …
Theorems Motivate lemmas Prefer direct proofs Proofs are reasoned arguments Proofs are social (target intended audience) Proof step size: so reader can fill gaps “easily” No algebraic transformations
Readability Don’t start a sentence with a variable or a mathematical symbol. Break up any (long) stream of complex expressions with intermittent explanation. Break down overly complex expressions. Typeset carefully. Use (only) commonly understood symbols. Don’t overload operators. Be precise about ranges, e.g. […) Minimize use of unfamiliar letters and don’t misuse them (e.g., don’t use for ) Avoid line breaks in formulas.
Numbers Write numbers as figures ( except numbers up to twenty (except literals, measurements, percentages)) Be careful with precision, binary/decimal, percentages, units Not … 7.31 and 181 “I’m told that there are 10 kinds of people in the world, those that understand binary and those that don’t.” Make percentages clear: is it “grew by 4% from 52% to 54%” or “grew by 2% from 52% to 54%”? Plural/singular: “0.5 seconds” vs. “a half second”
Graphs, Figures, Tables “And what is the use of a book”, thought Alice, “without pictures or conversations?” (Lewis Carrol, Alice in Wonderland) “Well-chosen illustrations breathe life into a paper.” But “should be reserved for material that is central to the paper.”
ExamplesExamples (Good and Bad) Graphs Figures Tables
Illustrations and Captions Strive for independence Graphs, figures, and tables, should be fairly self explanatory and self contained. Captions should aid, making the entire unit fairly independent. But never make it entirely independent “If you don’t have anything to say about an illustration, leave it out.” Introduce illustrations on the same page or on the preceding page (in so far as possible).
Algorithms “Mostly gobbledygook …” (Eric Partridge, defining computation in Usage and Abusage) “An algorithm by itself is uninteresting: what is of value is an algorithm that has been shown to solve a problem.”
Objectives for Presenting Algorithms Demonstrate that it’s worthwhile Proof of correctness, or Experimental results showing that it has some claimed performance, or both Expectations Input/output (including scope and limitations) Steps Properties (preconditions, postconditions, loop invariants) for correctness proofs Complexity analysis Experimental validation
Auxiliary Information Figures (e.g., AVL tree rotation) Examples (e.g., B + -tree insertion/deletion) Notation Prefer mathematical notation over programming notation x i not x[i] Avoid specific programming-language syntax never: ==, a++, for(i=0;i
"name": "Auxiliary Information Figures (e.g., AVL tree rotation) Examples (e.g., B + -tree insertion/deletion) Notation Prefer mathematical notation over programming notation x i not x[i] Avoid specific programming-language syntax never: ==, a++, for(i=0;i
Performance Evaluation Basis of evaluation Be realistic: don’t (obviously, or otherwise) favor your algorithm. “If the basis of comparison is questionable, the results are questionable too.” Processing time Difficult to measure Many factors involved: CPU speed, cache size, system load, pre-fetch strategy, … Disk and network traffic Complex can’t describe mathematically “Broad approximations are often the only manageable way of describing disk performance.”
Asymptotic Complexity Bounds Upper bounds: O(n) Lower bounds: o(n), (n), (n) Tight bounds: (n) Big-O, however, is often used less formally We often mean “the complexity” rather than “the upper bound on the complexity” Both of the following, for example, are OK Comparison-based sorting takes O(n log n) time. Insertion sort always takes at least O(n) time.