Articles by %(name)s

The Kadzin Method for Parenting the Defiant Child

. Introduction First, you must shift your own focus and attention. Instead of focusing on what you don’t want the kid to do, focus on...

On Writing Well

. Simplify Strip every sentence to its cleanest components. Examine every word to see if it needs to be there, and simplify or remove...

Distributional Semantics

An alternative to the one hot representation is where you figure out the meaning of a word by the words that frequently appear nearby....

One Hot Representation

The one hot representation of a word is a vector the length of the vocabulary, with all 0’s except a 1 to represent that...

Addition

(D2.2.1): Addition of natural numbers. Let \(m\) be a natural number. To add 0 to \(m\), define \(0+m=m\). Assume inductively we have...

Multiplication

(D2.3.1) Multiplication of natural numbers. Let \(m\) be a natural number. We define \(0\times m=0\). Now if we know \(n\times m\), we...

The Peano Axioms

(D2.1.1): A natural number is any element of the set: \begin{equation*} \mathbf{N}:=\{0,1,2,3,4, \ldots\} \end{equation*} Let \(n++\)...

Generating All the Catalan Sequences

Given \(N\), how do I generate all the valid push/pop sequences (or draw all the trees)? I’ll generate the sequence of 1’s and 0’s....

Equivalence of The Number of Valid Push/Pop Sequences and the number of Binary Trees

We showed that the number of binary trees with \(N\) nodes is the Catalan numbers. It is also the number of valid push/pop sequences for...

What Fraction of Push/Pop Sequences in a Stack Are Valid?

Say we have the numbers from 1 to \(N\) in sequence. We will do a random sequence of pushes and pops into a stack: \(N\) pushes and...

Catalan Numbers

Suppose we want to populate \(2n\) positions with exactly \(n\) 1’s and \(n\) -1’s. But we have a constraint. For any given \(k\) where...

Rest of book

He describes a focusing exercise that will get you focused within two minutes. It’s a breathing/meditation exercise. I don’t want to...

The Unschedule

The Unschedule asks you to commit to starting for 30 minutes. What you accomplished is less important than the fact that you got...

Overcoming Blocks To Action

If you’ve had to go through not being able to solve a problem that others found easy, or if you’ve been criticized often for less than...

Guilt-Free Play

One of the worst things about procrastination is that it leads to putting off living. At the end, you didn’t get much work done, nor did...

How to Talk To Yourself

How you talk to yourself determines the attitudes and beliefs that determine how you feel and act. Statements like “I should do it” or...

Roots of Polynomials

Every polynomial with real coefficients can be written as a product of linear or quadratic terms, each having real coefficients. Proof:...

Descarte’s Rule of Signs

If a polynomial \(f(x)\) has real coefficients, and has a nonzero constant term, then the number of positive real roots is the number of...

Some Properties About Graphs

To check if a function is symmetric about the origin, replace \(y\) with \(-y\) and \(x\) with \(-x\) and see if the equation of the...

Conic Sections

TODO: Note the equations. Parabola A parabola is the set of all points that are equidistant from a point (the focus) and a fixed line...

Perpendicular Lines in Graphs

If two lines are perpendicular, then \(m_{1}m_{2}=-1\) where \(m_{i}\) is the slope of the line. Proof Without Trigonometry Here’s the...

Induction in Sage

Here is an example of proving something using induction in Sage. Suppose we want to prove that: \begin{equation*}...

Areas of Triangles

When You Know 2 Sides and 1 Angle \begin{equation*} A=\frac{1}{2} b c \sin \alpha \end{equation*} When You Know 1 Side and 2 Angles...

Trigonometry and Triangles

Law of Sines Consider this triangle. Draw a line vertically down from \(B\). Label the length of this line as \(h\) (for height). Now...

Trigonometric Identities

Formula for \(\cos(\alpha-\beta)\) Consider the unit circle below: Here, we make \(\overline{AB}=\overline{CD}\), so they have the...

Binomial Expansion

Some things to note: The sum of all the coefficients is \(2^{n}\). To prove this, evaluate \(\left(a+b\right)^{n}\) with \(a=1,b=1\) The...

Summing the first \(n\) terms (arbitrary power)

We know that: \begin{equation*} \sum_{k=1}^{n} k=\frac{n(n+1)}{2} \end{equation*} We want to find the expression for \begin{equation*}...

Arithmetic, Harmonic and Geometric Means

\(A\ge G\ge H\) if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) { var align = "center", indent = "0em", linebreak =...

Geometric Series

The sum of a geometric sequence is: \begin{equation*} S_{n}=\frac{a\left(r^{n}-1)}{r-1} \end{equation*} Note, this is assuming \(n\)...

Arithmetic Series

The sum of an arithmetic series is: \begin{equation*} S=\frac{1}{2}\left(a+l\right) \end{equation*} where \(l\) is the last term. if...

\(z^{n}=1\)

Say we want the roots of \(z^{n}=1\). Let \(z=re^{i\theta}\). Then \(z^{n}=r^{n}e^{in\theta}=1\). We immediately see that \(r=1\). Thus...

Roots of Quadratic Equations

Given \(x^{2}+bx+c=0\), let the roots be \(\alpha,\beta\). Then: \begin{equation*} \alpha+\beta=-b \end{equation*} \begin{equation*}...

Polynomials

Remainder Theorem If a polynomial \(p(x)\) is divided by \(x-r\), then the remainder is \(p(r)\). To prove this, let \(p(x)=Q(x)(x-r) +...

Roots of Equations

Equations of the Form \(\sqrt{ax^{2}+bx+c}\pm\sqrt{ax^{2}+bx+d}=k\) \begin{equation*} \sqrt{ax^{2}+bx+c}+\sqrt{ax^{2}+bx+d}=k...

Roots of Equations In More Than One Variable

\begin{equation*} 2*x^{2}-xy+y^{2}=4 \end{equation*} \begin{equation*} 4*x^{2}-5xy+3y^{2}=6 \end{equation*} Manipulate the two equations...

Matrices

Determinant of a 2x2 matrix: \begin{equation*} \left|\begin{array}{ll}a & b \\ c & d\end{array}\right|=ad-bc \end{equation*} The minor...

Triangle Inequality for Complex Numbers

\begin{equation*} \ ||z_{1}|-|z_{2}||\le|z_{1}+z_{2}|\le|z_{1}|+|z_{2}| \end{equation*} The second inequality follows from the triangle...

\(z^{n}+\overline{z}^{n}\)

\(z^{n}+\overline{z}^{n}\) is a real number for all positive \(n\). Proof 1 Treat \(z=re^{i\theta}\) and you can show that the sum...

Componendo/Dividendo

Given: \begin{equation*} \frac{a}{b}=\frac{c}{d} \end{equation*} Componendo: \begin{equation*} \frac{a+b}{b}=\frac{c+d}{d}...

How To Master the Art of Selling

Chapter 2 Aim high, but set incremental goals. You have to continually know people’s objections, and prepare the responses in advance....

Fibonacci Numbers

How fast is the iterative version of the Fibonacci algorithm? You’d think it is \(O(n)\), but it’s really \(O(n^{2})\), because for...

Tips For Backtracking

In backtracking algorithms, you make a sequence of decisions. Every recursive call will make one decision, and will take as an input...

Subset Sum

Given a set \(X\) of positive integers, can you find a subset that sums to \(T\)? The general idea is that you have two choices: Either...

Game Trees

Suppose you have a game on an \(n\times n\) board with some rules and players take turns. Assume no randomness in the game. For most...

Russian Peasant Multiplication

Let \(x,y\) be two non-negative integers. We want to compute \(p\), the product: Set p=0 While x > 0: if x is odd: p = p + y x = x/2...

Introduction to Statistical Learning

Let \(X\) be the vector of all your features (i.e. \(X=(X_{1}, X_{2},\dots, X_{p})\), then the output is: \begin{equation*}...

Common Concurrency Problems

There are (mostly) two types of concurrency bugs: Non deadlock and deadlock bugs. Of the non-deadlock bugs, the main types are:...

Semaphores

A semaphore has an integer value that you set when you initialize. It has two operations: wait and post. The wait operation will first...

Condition Variables

Sometimes we want a thread to check if a condition is true before continuing execution. You could just use a global variable and check...

Lock Based Concurrent Data Structures

Concurrent Counters What if you have a shared counter, and you want several threads to update it? Simply locking before update will...

Locks

Normally, we create threads, but the OS schedules them however it likes. Locking/unlocking gives the programmer some semblance of...

Thread API

When creating a lock, you must do two things: Initialize the lock Check if lock/unlock failed! (i.e. check the error code). It’s common...

Introduction to Concurrency

A thread is lot like a process, except that it shares memory with other threads. A thread has its own program counter from which it gets...

Notes From The Negotiating Game

When choosing a lawyer/agent, don’t pick the one who knows the field best. Pick the one who is the best negotiator. The two qualities do...

How To Win Friends and Influence People

. Introduction Claim: People advance in their career due to technical skills and social skills. The estimate is that 85% of success is...

Claiming Value in a Negotiation

Note that this chapter is mostly about a fixed amount of value, so it’s a zero sum negotiation. Preparing To Negotiate Step 1: Assess...

Close The Sale: Commitments and Politics

Pilot projects: If the buzz is positive, then early setbacks are seen as expected. But if the buzz is negative, then each new problem...

Make it Memorable: The Personal Touch

There are really two audiences: The rational calculator and the intuitive decision maker. If you don’t make your ideas accessible to the...

State Your Case: The Proposal

The two most reliable ways to persuade people: Offer them solid reasons to say “yes” Back those reasons up. You don’t need to do much if...

Give Them Incentives To Say Yes: Interests and Needs

Don’t assume people know what they want or need. Be prepared to educate them if you sense this is the case. Ask yourself: Why might it...

Respect Their Beliefs: A Common Language

Nervous or unconfident people tend to focus exclusively on their message rather than getting a feel of what the other person is...

Build Relationships and Credibility: Trust

The five barriers: Lack of relationships Poor credibility Miscommunication Contrary beliefs Conflicting interests Credibility is not...

Connect Your Ideas to People: Stepping Stones

A Technique For Producing Ideas He took this from James Webb Young’s book: A Technique For Creating Ideas. Strongly recommends the book....

Start With You: Persuasion Styles

Six persuasion channels: Channel 1: Interest Based Persuasion Any time someone frames a sales pitch in terms of the other person’s...

Selling Ideas: How Woo Works

There are usually four steps: Survey your situation Confront the five barriers Make your pitch Secure your commitments You must form a...

Quiet

. Introduction She points out that several of our role models (Rosa Parks, etc) were introverts. Yet the message society often gives us...

In-Process Agent

Keep in mind that the debugger interferes with the program - especially when real time behavior is involved. Read this chapter for ways...

Using GDB Under Emacs

Some useful information here. M-x speedbar could be really handy here.

Text User Interface

The GDB Text User Interface (TUI) is a terminal interface which uses the ‘curses’ library to show the source file, the assembly output,...

Extending GDB

Sequences User Defined Commands You can assign a name to a sequence of commands. You can allow for arguments. They are accessed using...

Controlling GDB

Prompt You can change the prompt. If yoru gdb has python scripting enabled, you have prompt extensions. Command History You can set the...

Configuration-Specific Information

While nearly all GDB commands are available for all native and cross versions of the debugger, there are some exceptions. This chapter...

Debugging Remote Programs

This section has information on how to do remote debugging.

Specifying a Debugging Target

This is when you want to debug remotely or on a different architecture.

GDB Files

To change the program you want to debug, type file FILENAME. It will look at $PATH if it doesn’t find it. You can also load .o files...

Altering Execution

Assignment To modify x, do print x=4 You can also use set. Or set variable. Continuing at a Different Address Use jump LOCATION to...

Examining the Symbol Table

You can do things like query which symbol is at an address (or close to it). You can demangle names. Or the information about the...

Using GDB With Different Languages

If gdb doesn’t figure out the language automatically, you can set it using set language. show language shows the current language. This...

Concluding the Analytical Stage

Now these three stages of analytical reading are the ideal. You will read very few books to this ideal. Most are not worth it.

Agreeing or Disagreeing With an Author

If you’ve read a book thoroughly and want to say “I don’t understand”, then you are saying the book has a fault. Your job is to locate...

Criticizing a Book Fairly

Reading a book is a conversation between you and the author. If you do not internalize this, you are not performing deeper reading. You...

Debugging Programs That Use Overlays

If your program is too large to fit completely in your target system’s memory, you can sometimes use “overlays” to work around this...

Tracepoints

In some applications, it is not feasible for the debugger to interrupt the program’s execution long enough for the developer to learn...

Determining an Author’s Message

We need to find out what the author’s propositions are. He may tell us outright. But keep in mind that his propositions are nothing but...

Coming To Terms With an Author

Find out all the important words/phrases in the book and examine how the author is using them. Figure out what they mean with relation...

Analytical Reading: Structure

Rule 1: You must know what kind of book you’re reading. Find this out early in the process. You should be able to state what the book...

Debugging Optimized Code

gdb has stuff for handling macros, but you likely need to compile your program in a way to add these to the debug symbols. See this...

Examining Data

Normally you would use p to examine data. You can also use a Python pretty printer. print EXPR You can use the x command to see a more...

Examining Source Files

Printing Source Lines Note: You can use GDB with Emacs, and viewing the source via Emacs is convenient. list prints 10 lines. To change...

Examining The Stack

Stack Frames GDB labels each existing stack frame with a “level”, a number that is zero for the innermost frame, one for the frame that...

Recording Inferior’s Execution and Replaying It

On some platforms, GDB provides a special “process record and replay” target that can record a log of the process execution, and replay...

Running Programs Backward

Sometimes you realize that you went past the interesting point in your program. Occasionally you can rewind if the target environment...

Questions and Notes

While reading, you should have 4 questions you need to answer: What is the book about? What is said in detail, and how? Is the book...

Inspectional Reading

Is the book even worth reading? Skim the book to find out. This post says how. First, do the following: Look at the title page,...

Stopping and Continuing

To break conditionally, do: break ... if COND … could be a function, location, address, etc. You can set a breakpoint such that it...

Running Programs Under GDB

You can modify the environment so that your program runs as if in that environment (and not the environment gdb was launched under). See...

GDB Commands

How do you repeat the last command? Just type Enter. It doesn’t work on all commands. If you want to repeat an earlier sequence of...

Invoking GDB

To attach to a running process, do: gdb PROGRAM Another way to attach is from within gdb: attach To detach, do detach. If...

Basic Info

To start gdb on a certain program, type gdb progname. If, for whatever reason, you want to change the width of the text (to fit in your...

Use of Pythagorean Triples

Hugues’s paper. Look it up.

Gal’s Accurate Table Method

This method is useful when your intermediate precision is the same as the target precision.

Table Driven Methods

Given the input \(x\), the first step is to find a \(y\) such that \(f(x)\) can easily and accurately be calculated from \(f(y)\)....

Introduction to Table Based Methods

In general, when approximating a function, we’ll split the domain into multiple intervals and approximate each one with a polynomial....

Languages and Compilers

Here are some concerns: Say you want to compute \(a+b+c+d\) and they are all of 32 bit precision, but the machine supports 64 bit....

Functions For Transforming Text

A function call can be either $(FUNCTION ARGUMENTS) or ${FUNCTION ARGUMENTS} If one of your arguments needs to have a comma or a brace,...

Conditionals

Example of a conditional: ifeq ($(CC),gcc) $(CC) -o foo $(objects) $(libs_for_gcc) else $(CC) -o foo $(objects) $(normal_libs) endif...

Variables

To refer to a variable, do either $(name) or ${name}. Now if you omit the parenthesis or the brace, like $abc, then this is interpreted...

Recipes

The recipe of a rule consists of one or more shell command lines to be executed, one at a time, in the order they appear. Typically, the...

Sequential Evaluation of Polynomials

Sequential Evaluation of Polynomials If you don’t have any parallelism available, Horner’s scheme is a good option. And if you have the...

Writing Rules

If you run make without a target, it picks the first target of the first rule. But a target beginning with a period cannot be the...

Compensated Polynomial Evaluation

The book provides an algorithm. I didn’t bother writing the details.

Compensated Dot Products

When the condition number is not high, one can do the naive algorithm for the dot product. Otherwise, one should do the...

Writing Makefiles

You can include other makefiles into the current one: include FILENAMES You can include variables and globs as filenames: include foo...

Basics

Rules The format of a rule is: TARGET ... : PREREQUISITES ... RECIPE ... ... The prerequisites are files that are required to run the...

Engineering Serendipity

Changing your environment (e.g. vacation trip) often gives you fresh ideas. Try to meet different types of people in your daily life...

Tap The Fringe

He encourages plugging into many feeds (Facebook, Twitter, etc). But the feeds should have a lot of diversity. Microcelebrities are...

Find Anchor Tenants and Feed Them

Home cooked dinners are powerful. And details like whether you have a table to put plates on, or disposable plates instead of fancy...

Pinging All The Time

80% of building and maintaining relationships is staying in touch (“pinging”). New people need to see or hear your name in at least 3...

Social Arbitrage

Two ways to gain power: Sheer will and effort By being indispensable to those around you (i.e. make others successful) When in a...

Health, Wealth and Children

The three most common motivations for doing anything: Making money, finding love, or changing the world. So to connect with others, be a...

Computing Sums More Accurately

Reordering the Operands, and a Bit More General ideas: Sort all your summands in ascending order (magnitude). Even more complex, sort...

Computing Validated Running Error Bounds

The problem with the previous error bounds is that they are in terms of quantities like \(\sum|a_{i}|\), which are not known in advance,...

Properties For Deriving Validated Running Error Bounds

Theorem for FMA Let \(x,y,z\) be nonnegative floating point numbers. Assuming underflow does not occur, then \(xy+z\le...

Some Refined Error Estimates

Let the rounding mode be RN. Assume no overflow occurs. Then if you do recursive summation, the following inequality related to the...

Notation For Error Analysis and Classical Error Estimates

Unless specified otherwise, everything in this chapter assumes no underflow. We often will have many factors of \((1+\epsilon_{i})\),...

Polynomials With Exact Representable Coefficients

An Iterative Method Compute the minimax approximation in a wider format. Then round the coefficient of the constant term. Then recompute...

Introduction to Polynomial Approximations In Finite Precision

We discussed calculating the minimax polynomial using Remez’s Algorithm, but we overlooked some subtleties. While the algorithm does...

Evaluation of the Error of an FMA

The error of an FMA calculation is not always a floating point number. However, we can use two floating point numbers to exactly...

Multiplication by an Arbitrary Precision Constant with an FMA

Suppose you need to multiply by a constant that is not exactly representable. Think \(\pi\) and the like. We’d like to multiply and...

Conversions Between Integers and Floating Point Numbers

This is a short section with some details and magic numbers. I did not bother.

Radix Conversion Algorithms

The algorithms are in the book. I did not reproduce them here. I did not read the rest of the section. There are a lot more details there.

Conditions on the Formats

This section deals with changing bases. The most obvious application is to go back and forth between decimal and binary (to make it easy...

Newton-Raphson Based Square Root With FMA

The Basic Methods One way is to use Newton’s iteration on \(f(x)=x^{2}-a\). This method for calculating square root goes back thousands...

Possible Double Rounding in Division Algorithms

This section deals with floating point \(a,b\) values, not necessarily between 1 and 2. Assume they are non-negative, though. For this,...

Using The Newton Iteration For Correctly Rounded Division With FMA

We need to calculate \(o(a/b)\) where \(a,b\) are binary floating point numbers, and \(o\) is RN, RD, RU or RZ. We have a useful proof:...

Variants of the Newton Raphson Iteration

Assume \(\beta=2\) for this section. Some of it may not work for decimal. We want to approximate \(b/a\). Assume \(1\le a,b<2\). In...

Another Splitting Technique: Splitting Around a Power of 2

In this section, assume \(\beta=2\). Now given a floating point \(x\), we want to form two floating point numbers \(x_{h}\) and...

Computation of Residuals of Division and Square Root With an FMA

For this article, define a representable pair for a floating point number \(x\) to be any pair \((M,e)\) such that...

Accurate Computation of the Product of Two Numbers

The 2MultFMA Algorithm This has been covered elsewhere. It works well when you use FMA. If No FMA Is Available If there is no FMA...

Accurate Computation of the Sum of Two Numbers

Let \(a,b\) be two floating point numbers. Let \(s\) be \(\RN(a+b)\). Regardless of which number it picks in a tie, it can be shown that...

Exact Multiplications and Divisions

When you multiply a floating point number by a power of \(\beta\), the result is exact provided there is no over or underflow. Another...

Exact Addition

Sterbenz’s Lemma: If your floating point system has denormals, and if \(x,y\) are non-negative, finite floating point numbers such that...

Computing The Precision

To get \(p\) of the floating point system you are on: i = 0 A = 1.0 B = 2 # The radix. while (A + 1.0) - A == 1.0: A = B * A i += 1...

Computing The Radix

Suppose we want to compute the radix of a floating point system. The code below will do it for you - it works assuming the...

Accurately Computing Supremum Norms

We never discussed how to calculate \(||f-p||_{\infty}\). Maple has a function to do this, but it can be inaccurate. Most people will...

Rational Approximations

Sometimes you need a fairly high degree polynomial to get reasonable accuracy, but can achieve a far greater accuracy with a much lower...

Remez’s Algorithm

Remez’s algorithm is one that converges to the minimax polynomial of a function. The author recommends using a polynomial approximation...

Miscellaneous (Chebyshev)

Chebyshev vs Minimax Note that the best minimax polynomial approximation need not be the Chebyshev polynomial. The latter is the best...

Least Maximum Polynomial Approximations

The supremum norm is given by \(||f-p||_{\infty}=\max_{a\le x\le b}|f(x)-p(x)|\). It is denoted by \(L^{\infty}\). Given a function...

Least Squares Polynomial Approximations

First, just a definition: A monic polynomial is one whose leading coefficient is 1. We want to find a polynomial of degree \(n\) that...

IEEE Support in Programming Languages

Do not assume that the operations in a programming language will map to the ones in the standard. The standard was originally written...

Introduction to The Classical Theory of Polynomial or Rational Approximations

We often will approximate functions as polynomial or rational functions. When doing this, we introduce two types of errors:...

Rest of chapter

I skipped the rest of the chapter (inlcuding hardware details).

Special Values

NaN Signaling NaNs do not appear as the result of arithmetic operations. When they appear as an operand, they signal an...

Default Exception Handling

Invalid The default result of such an operation is a quiet NaN. The operations that lead to Invalid are: Most operations on a...

Conversions To/From String Representations

This section addresses how one can convert a character sequence into a decimal/binary floating point number. Decimal Character Sequence...

Comparisons

The standard requires that you can compare any two floating point numbers, as long as they share the same radix. The unordered condition...

Exercise

Study on people with major depression. Three groups: Exercise 30 minutes a day 3 times a week Take Zoloft Exercise and take Zoloft...

Mind Wandering

Mind wandering is when our mind is thinking about something other than what we should focus on. Ruminating, jumping around, etc. Studies...

The Things We Should Want More Of

Kindness Finding ways to be more kind improves your happiness. In one study, people were asked to do 5 acts of kindness. They could do...

Motivation

If you enjoy an activity, you have an intrinsic motivation to do it. Once people give you extrinsic motivations to do it, and then take...

Attributes and Rounding

Rounding Direction Attributes IEEE 754-2008 requires that the following be correctly rounded: Arithmetic operations: Addition...

Operations Specified By The Standards

Arithmetic Operations and Square Root Handling Signed 0 If \(x,y\) are nonzero, and \(x+y=0\) or \(x-y=0\) exactly, then it is \(+0\)...

Signature Strengths And Flow

Signature Strengths Martin Seligman made a list of 24 attributes that tend to be correlated with happiness, and that aren’t culture...

Formats

The standard defines several interchange formats to allow for transferring floating point data between machines. They could be as bit...

Reset Your Reference Points

Concretely Reexperience Your Reference Points Say you got your dream job, and then a year later it has now become your reference point,...

Manipulating Double or Triple Word Numbers

The target format is the format of the result. The target precision is the precision of the target format. When computing polynomials,...

Computing the Error of a FP Addition or Multiplication

Let \(a,b\) be 2 floating point numbers. It can be shown that \((a+b)-\RN(a+b)\) is a floating point number. This may not be true for...

Other Ways To Be Happy

Savoring Activities that enhance savoring: Talking to others about how good you feel Looking for others to share it with Thinking about...

Basic Notions of Floating Point Arithmetic

Basic Notions For a binary floating point system, if \(x\) is normal, then the leading bit is 1. Otherwise it is 0. If we have some...

Experiences vs Stuff

Because of hedonic adaptation, don’t invest too much in stuff - especially long lasting stuff. Things that stick around and don’t change...

Note on the Choice of Radix

It has been shown that \(\beta=2\) gives better worst case and average accuracy than all other bases. if...

Lost and Preserved Properties of Arithmetic

Floating point addition and multiplication are still commutative. Associativity is compromised, though. An example: Let...

Floating Point Exceptions

In IEEE-754, the implementer can signal an exception along with the result of the operation. Usually (or perhaps mandated?), the signal...

Fused Multiply Add

Let \(o\) be the rounding function, and \(a,b,c\) are floating point numbers. Then \(\mathrm{FMA}(a,b,c)\) is \(o(ab+c)\). if...

ULP Errors vs Relative Errors

Converting From ULP Errors to Relative Errors Let \(x\) be in the normal range, and \(|x-X|=\alpha\ulp(x)\). Then: \begin{equation*}...

The ULP Function

There are multiple definitions of unit in the last place. I think most agree when \(x\) is not near a boundary point. Here is the...

Relative Error Due To Rounding

Ranges The normal range is the set of real numbers: \(\beta^{e_{\textit{min}}}\le|x|\le\Omega\) and the subnormal range are where...

The Relativity of Happiness

Most people’s happiness is not due to the absolute outcomes, but the relative outcomes. Medvec (1995) showed that the happiness of...

Rounding Functions

The IEEE 754-2008 specifies five rounding functions: Round toward \(-\infty\) (RD): It is the largest floating point number less than or...

The Art of Small Talk

Small talk is the “talk” between two people who do not know each other. The ability to make conversation in any circumstance is a huge...

The Other “Numbers”

0 (some systems have signed 0’s as well) NaN for any invalid operation \(\infty\) (some systems are signed, some are not). In the IEEE...

Underflow

Underflow before rounding occurs when the absolute value of the exact value is strictly less than \(\beta^{e_{\textit{min}}}\) (i.e. the...

Normalizing

We would like a unique way to represent \(x\). One approach is to pick the one which gives the smallest exponent possible (while still...

Definitions

A radix \(\beta\) floating point number \(x\) is of the form \(m\beta{e}\), where \(|m|<\beta\) is called the significand and \(e\) is...

Creating Safety

Assume there is a 30 foot plank on the ground, and your task is to walk across it. Not a big problem. Now assume it is 100 ft off the...

Expanding Your Circle

Example: Say you’re making a product to sell to lawyers. If you know a lawyer, ask if he and some friends of his would like an early...

Happiness, Genetics, and Life Circumstances

Lyubomirsky did some research on the role of genetics and life circumstances on happiness. She found that genetics affects about 50% of...

Happiness and Other Things

Material “Stuff” In 1976, they asked 12000 freshmen what material items would make them happy, and then followed up with them 20 years...

Happiness and Income

Gilbert showed that college students, when rejected for a job, did not become particularly unhappy. For a fair decision, they were very...

Savoring, Gratitude

Savoring is the act of stepping out of an experience to review it and really appreciate it while it’s happening. Think about why a...

Connecting With Connectors

Superconnectors are people with a lot of connections. You’ll probably have a few of them in your network. Don’t assume that the person...

Tracking Your Time and Procrastination

Knowing How You Spend Your Time Start with knowing where your time goes. For the next 3 days, allow yourself to behave as you normally...

The GI Joe Fallacy

The GI Joe Fallacy: People who know what makes us happier (e.g. psychologists) are not necessarily happier or better able to practice...

Why We Procrastinate

One view of procrastination is that it is a form of preserving self-worth. There are 3 deep inner fears that cause us to procrastinate...

Be A Conference Commando

First, decide if the ROI from relationships created there exceed the costs. If not, don’t go! Help the Organizer. Or Better, Be...

Follow Up or Fail

After a meeting, do a prompt followup. Put some emotions into it (Why was it nice to meet him?) Do it within 12-24 hours. Expressions of...

Share Your Passions

Networking events are not that good. Use shared interests: Race Religion Gender Business Personal Hobbies Focus on the quality of the...

Never Eat Alone

Invisibility is far worse than failure. Keep your social calendar full. Always remain visible and active among your network. Example of...

Managing The Gatekeeper: Artfully

It is hard to get hold of important people. They often have gatekeepers (e.g. secretaries). Never get on their bad side. And elevate...

Warming The Cold Call

You’ll never get over the fear and anxiety of a cold call. Just dive in! And have the mindset/attitude that you can get what you want...

Take Names

For your goals, list the people who can help achieve them. Do not list organizations! Make sure it is an actual person. Use LinkedIn...

Do Your Homework

Whom you meet, how you meet them, and what they think of you afterwards, should not be left to chance. For anyone you meet, ask: Who...

Prepare a Negotiation Broad Sheet

When the pressure is on, we fall to our highest level of preparation. It is key to prepare! Don’t prepare to the extent that you have a...

Find The Black Swan

Black swans are unknown unknowns. Finding Leverage in the Predictably Unpredictable A black swan is an event we never imagined. So we...

Bargain Hard

If you make an offer, then any response other than an outright rejection means there is room for negotiation. What Type Are You Three...

Guarantee Execution

The work is not done when you have an agreement. The implementation details are critical. “Yes” Is Nothing Without “How” Practice...

Create The Illusion of Control

Successful negotiation is getting your counterpart to do the work for you and suggesting the solution himself. Remove the hostility in...

Miscellaneous

An important lesson: There is always leverage. Some examples: Fear of deadlines Power of odd numbers Views on fairness Don’t Compromise...

That’s Right - not You’re Right

“I guess so” means things are not going well. “That’s right” means things are going well. Get to “That’s right”! They may not say the...

Beware “Yes”, Master “No”

Other negotiation books try to get the other side to say “Yes” to anything. Or get them to say “Yes” to an abstract principle...

Label Their Pains

Good negotiators label emotions. Tactical empathy: Understand the needs and feelings behind the other’s mindset. It is not about...

Be A Mirror

Your mindset should be that of discovery, and extracting as much information as possible. Which is why smart people can be poor at...

Never Split The Difference

All pages tagged as nstd are notes from the book Never Split The Difference. An overriding principle: People want to feel they are good...

Financial Markets

\(\newcommand{\Cov}{\mathrm{Cov}}\) The notes in this class are for Coursera’s Introduction to Financial Markets taught by Shiller. Let...

Putting It All Into Practice

How do we put all this into practice? It is daunting. At the first level, focus on two principles: Learning to look and making safety....

Yeah, But …

This chapter has several common scenarios and advice on each one. Worth a read.

Move To Action

Once everyone has added meaning to the pool (after reaching safety, etc), there is still a need for action. What should we do with this...

Explore Others’ Path

Sometimes the problem is that the other person is resorting to silence/violence. What then? One option is to simply make it the other’s...

State My Path

Share Risky Meaning When it comes to touchy information, the worst is to alternate between blunt and silence (Fool’s Choice). The less...

Master My Stories

Claim One: Others don’t make you mad. You make you mad. Claim Two: Once you’re upset, there are only two routes: Act on them or be acted...

Make It Safe

If someone says something sarcastic or a side remark, that means they need safety. Do not ask “What is that supposed to mean?” It can...

Learn To Look

Most crucial conversations are about two things: Content and emotions. When we get deeply involved in one, we usually focus on only one...

Start With Heart

The problem is not that our behavior degenerates. It is that our motives do. In crucial conversations, our motive often changes to...

Mastering Crucial Conversations

The Fool’s Choice The Fool’s Choice: When you feel you have only two choices: Silently accept the problem Speak about the problem but...

Expressive Appreciation in Nonviolent Communication

The Intention Behind The Appreciation Positive judgments are still problematic judgments. Example: “It was kind of you to…” “You are a...

Liberating Ourselves and Counseling Others

Resolving Internal Conflicts Depression is indicative of a state of alienation from our own needs. Internal thoughts like “should”,...

The Protective Use of Force

When The Use of Force is Unavoidable Dialog is great but sometimes the opportunity for dialog may not exist, and force is necessary. The...

Conflict Resolution and Mediation

Human Connection Creating a connection between the people who are in conflict is the most important thing. The parties need to know from...

Expressing Anger Fully

Hurting people is one of the weakest ways to express our anger. The goal of nonviolence is not to stifle anger, but to express it in...

Connecting Compassionately With Ourselves

Evaluating Ourselves When We’ve Been Less Than Perfect We chastise ourselves in non-constructive ways when we screw up. Shame and guilt...

The Power of Empathy

Empathy That Heals Listening empathically to someone (no advice, etc) can really relieve the other person’s tension. Ending the...

\(z\) Tests and Confidence Intervals for a Difference Between Two Population Means

Motivation Suppose you have a population with known \(\mu\) and \(\sigma\). You then take a sample (perhaps not randomly) and discover...

Poisson Distribution Tests

For a Poission distribution with large \(n\), use \(Z=\frac{\bar{X}-\lambda}{\sqrt{\lambda/n}}\) (i.e. \(\lambda\) instead of \(S\)). It...

Some Comments on Selecting a Test Procedure

Things you should think about: What are the implications of your choice of \(\alpha\)? How much did intuition play a role in deciding...

p-Values

The p-value is the smallest significance level (i.e. \(\alpha\)) at which \(H_{0}\) would be rejected. So if \(p\le\alpha'\), you reject...

Tests Concerning a Population Proportion

Let \(X\) be the number of successes. If \(n<

Tests About a Population Mean

Steps to Carry Out The Experiment Identify the parameter of interest. Determine the null value and state the null hypothesis. State the...

Hypotheses and Test Procedures

The null hypothesis (\(H_{0}\)) vs the alternative hypothesis (\(H_{a}\)): The null hypothesis is assumed to be true (default). The...

A Confidence Interval For The Median

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) If \(\Sample\) be...

Confidence Intervals For The Variance and Standard Deviation of a Normal Distribution

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) Let \(\Sample\) be...

Intervals for Non-Normal Distributions

The one-sample t-distribution confidence interval is robust for small or even moderate departures from normality, unless \(n\) is very...

A Prediction Interval for a Single Future Value For a Normal Distribution

What if you have \(n\) observations in a normal distribution and want to predict \(X_{n+1}\)? The prediction interval is \(\bar{x}\pm...

Intervals Based on a Normal Population Distribution: The T-Distribution

Say you take a sample where \(n\) is not large. Then the CLT doesn’t apply. We must then know/assume a distribution. Suppose we know it...

The T-Distribution: The T-Distribution

Let \(\Sample\) be independent and identically distributed from \(N(\mu,\sigma^{2})\). Define the following random variable:...

Large Sample Confidence Intervals for a Population Mean and Proportion

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) For any...

Basic Properties of Confidence Intervals

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) Assume you have a...

Estimating the Mean of a Symmetric Distribution

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) A good estimate...

Use Power To Educate

Some people just want to win, and their measure of success is how much you lose. If your goal becomes victory, realize you’re stuck in a...

Build Them a Golden Bridge

Obstacles to Agreement The other side may stall: Lack of interest, vague statements, delays, breaking agreements, a flat No! There are...

Reframe

When the other side doesn’t budge, resist the temptation to counter with your position. “That’s interesting. Why do you want that?” “You...

Step To Their Side

Do not ignore the emotions while focusing on the problems. You need to defuse them, and you do it by surprise. If they stonewall, they...

Go To The Balcony

Three Natural Reactions We have 3 natural reactions: Striking back Giving in and yielding to pressure Cutting off the relationship Don’t...

Prepare, Prepare, Prepare

Before every meeting, prepare. After every meeting, assess and re-prepare for the next meeting. Do not try to wing it. Mapping Out The...

Getting Past No: Overview

Five Barriers To Cooperation Your Reaction: You either strike back or give in. Both are damaging. Their Emotion: Anger, hostility, fear,...

Methods of Point Estimation

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) \(\newcommand{\Sample}{X_{1},\dots,X_{n}}\) The Method...

Some General Concepts of Point Estimation

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) Notation: \(\hat{\mu}=\bar{X}\) means the point estimator of...

The Distribution of a Linear Combination

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) Let \(X_{1}\dots X_{n}\) have means \(\mu_{i}\) and variances...

The Distribution of the Sample Mean and Sum

Let \(X_{1}\dots X_{n}\) be a random sample from a distribution with mean \(\mu\) and standard deviation \(\sigma\). Then:...

Statistics and Their Distributions

When we take a sample and calculate its mean and standard deviation, this is treated as a random variable for the population...

Expected Values, Covariance and Correlation

\(\newcommand{\Cov}{\mathrm{Cov}}\) \(\newcommand{\Corr}{\mathrm{Corr}}\) Expected Value The expected value of a function \(h(X,Y)\) is...

Jointly Distributed Random Variables

Probability Given two random variables \(X,Y\), the joint pdf is given by \(p(x,y)=P(X=x,Y=y)\). Let \(A\) be an event. Then the joint...

Probability Plots

Sample Percentiles Calculating sample percentiles is challenging. What is the 23rd percentile of 10 points? One rule: Order the \(n\)...

Extreme Value Distribution

For Weibull, let \(Y=\ln(X)\). This has both scale and location parameters. Location is \(\theta_{1}=\ln(\beta)\) and scale is...

The Beta Distribution

The beta distribution The parameters are \(\alpha,\beta>0\), and \(A,B\) with \(B\ge A\). \begin{equation*}...

The Lognormal Distribution

If \(Y=\ln X\) is a normal distribution, then \(X\) is log-normal. \begin{equation*} f(x;\mu,\sigma)=\frac{1}{\sqrt{2\pi\sigma}...

The Weibull Distribution

Probability Density Function Let \(\alpha,\beta>0\) \begin{equation*}...

The Erlang Distribution

If the time between successive events is independent each with an exponential distribution with \(\lambda\), then the total time \(X\)...

The Chi-Squared Distribution

Chi-squared distribution Probability Density Function The parameter is \(\nu\) and it is a positive integer. It is the gamma...

The Exponential Distribution

Exponential distribution Probability Density Function Let \(\lambda>0\) \begin{equation*} f(x;\lambda)=\lambda e^{-\lambda x}...

The Gamma Distribution

The problem with the normal distribution is that it is symmetric. The Gamma distribution is useful for skewed distributions....

The Normal Distribution

Probability Distribution Function The parameters are \(-\infty<\mu<\infty\) and \(\sigma>0\). \begin{equation*}...

Pareto Distribution

The Pareto distribution is good for approximating income distributions or population sizes. The pdf is given by: \begin{equation*}...

Continuous Random Variables and Probability Distributions

Continuous distributions are given by a probability density function (pdf): \begin{equation*} P\left(a\le X\le...

Zipf Distribution

Suppose you have a library with \(M\) items and you want to sort them by popularity. The parameters are \(M\) and \(\alpha\). The domain...

Scarcity

People are motivated more by the thought of losing something than the thought of gaining something of the same value. Frame something in...

Receiving Empathically

Don’t Just Do Something. Stand There! Empathy is emptying our mind and listening with our whole being. The presence that empathy...

Requesting That Which Would Enrich Life

. Use positive language when making requests! Example of negative language: Asking someone not to do something. Instead, request what...

Taking Responsibility For Our Feelings

Hearing a Negative Message: Four Options What others say or do may be the stimulus of our feelings, but not the cause. When someone...

Identifying and Expressing Feelings

“I feel that…” When you use “that” after feel, you are likely not revealing your feelings. Adequately expressing feelings is...

Observing Without Evaluating

Separate the observation from the evaluation. If you say both in one go, people are more likely to interpret it as criticism and resist....

Communication That Blocks Compassion

Moralistic Judgments Moralistic judgments are “life-alienating” communications. The focus tends to be on analyzing wrongness then...

Giving From The Heart

The NVC Components: Observations: State the facts Feelings: State your feelings Needs: State your needs connected to your feelings Make...

Authority

Titles Study: A person is introduced to various groups as either a student, lecturer, professor, etc. After he leaves the room, people...

Poisson Distribution

\(X\) is of a Poisson distribution if its pmf is \(p(x;\lambda)=\frac{e^{-\lambda}\lambda^{x}}{x!}\) where \(x\) is 0, 1, 2, etc....

Negative Binomial Distribution

The experiment requires: The trials be independent The outcome is binary (success or failure). The probability of success or failure is...

Hypergeometric Distribution

The hypergeometric experiment requires: The population is finite, with \(N\) individuals. The outcome of each trial is binary (success...

Binomial Distribution

Bernoulli Distribution A Bernoulli random variable is one whose only possible values are 0 and 1. \(P(X=1)=p\) \(E[X]=p,V[X]=p(1-p)\)...

Discrete Random Variables

Random Variables A discrete random variable is one whose set of possible values is countable. Probability Distributions for Discrete...

Read From UIUC

Read hypothesis testing in Chapter 2 (ML rules). Reliability in Chapter 2

Probability

Sample Spaces and Events The sample space \(\mathcal{S}\) is a set. An event is a subset of the sample space. A simple event is an event...

Liking

A common tactic: A salesperson who has completed a sale with you will ask for a list of friends, and call them up and talk about how...

Measures of Location and Variability

Measures of Location When reporting a sample mean, use one extra significant digit. Sample mean: \(\bar{x}\) Population mean: \(\mu\)...

Pictorial and Tabular Methods in Descriptive Statistics

Pictorial and Tabular Methods in Descriptive Statistics Stem and Leaf Display Stem and leaf display Advantages: Useful for displaying...

Statistics: Overview

Populations, Samples and Processes A census means you poll every member of the population. Univariate vs bivariate or multivariate:...

Frequently Asked Questions

What If The Other Person is a Bully, Lying, or Trying to Derail While it does happen, most of our evaluations about the other person are...

Putting It All Together

Step One: Prepare By Walking Through The Three Conversations Stories What’s my story? (information, past experiences, rules?) What’s his...

Problem Solving: Take The Lead

Most people don’t have the conversation skills. You’ll talk about understanding and they’ll talk about who’s right. You’ll talk about...

Expression: Speak For Yourself With Clarity

Don’t just listen - you need to share your side of the story. Orators Need Not Apply Do not try to be eloquent or witty. Do not try to...

Learning: Listen From The Inside Out

People have a deep desire: To be heard To know that others care enough to listen Listening Transforms The Conversation Mother has...

Getting Started: Begin From The Third Story

A bad beginning can crater the conversation. But a good one helps you immensely. Why Our Typical Openings Don’t Help Don’t dive in with...

What’s Your Purpose: When to Raise It and When To Let Go

Pick your battles! You can’t have every difficult conversation you come across. Deciding whether to raise an issue or not torments us....

Ground Your Identity: Ask Yourself What’s At Stake

Difficult Conversations Threaten Our Identity Sometimes the anxiety is not due to facing others, but facing ourselves. The conversation...

Have Your Feelings Or They Will Have You

Don’t focus on just the objective facts. Feelings have to be part of the conversation. At the same time, having them explode is...

Abandon Blame: Map The Contribution

Someone screws up, which causes you to screw up. You can blame him/her explicitly (“You screwed up!”) or implicitly (“Let’s do better...

Social Proof

Social proof is also a convenient shortcut for decision making. Kids who are scared to play with dogs become willing to merely by...

Commitment and Consistency

We have a deep desire to be/appear consistent. This is why when people bet on a horse, they are more confident it will win after they’ve...

Reciprocation

We try to repay, in kind, what someone else has given us - even we didn’t want it or take it! We feel obligated. Society provides a very...

Influence: Weapons of Influence

A group of people are waiting in line to use a photocopying machine. Someone says “May I use the machine because I am in a rush?” to...

Don’t Assume They Meant It

Intentions strongly influence our judgments. Watch your sentences and notice how often you are attributing intentions to the...

Stop Arguing About Who’s Right

At the heart of the What Happened conversation is a disagreement. Argument is the natural outcome of disagreement. But it is...

The Three Conversations

You need to understand what people are thinking and feeling, but not saying. Every difficult conversation is really a mix of...

Difficult Conversations

What makes a conversation difficult? Usually it is the fear of consequences. If we avoid the conversation, we feel taken advantage of,...

Start Your Own Support Group

You can start a support group yourself. Rule: The group has no “leaders”. All the members own it. Meeting Format (Suggestion) Run a...

A Little Structure Goes a Long Way

The principles in the book can be applied informally, but success is much higher if you formalize it. (My idea): To an extent, perhaps...

Step Nine: Fake It Till You Make It

Making a commitment is like making a resolution. If you don’t stick to it, it’s useless. Don’t fear the mistakes you’ll make along...

Step Eight: Commit To Improvement

Benefits of making a commitment: Liberating to admit your problems By committing publicly, you are more likely to follow through. Public...

Step Seven: Diagnose Your Weakness

Common problems: The struggler: Craves attention. Seeks turmoil and impossible situations. The conflict avoider: Downplays...

Step Six: Learn to Fight

Learn to spar with your team: Sparring is where they can grill you - hold you accountable, but not in a way that causes injury. It is...

Step Five: Create Your Personal Success Wheel

Take a week off in December to reassess everything. Use the Personal Success Wheel or make your own. The elements in the wheel are not...

Step Four: Broaden Your Goal Setting Strategy

Goal setting should be done be a team! Don’t insist on setting all your goals yourself. Let the team help you. His opinion: Goals may be...

Step Three: Practicing The Art of The Long Slow Dinner

Once identified, the lifeline needs to be eased into the process. The benefit of a long, slow dinner is that the clock stops. No rush to...

Step Two: Find Your Lifeline Relationships

Sources of Lifelines Your confidant need not be someone close to you - sometimes those close to you are very poor at it. We have close...

Step One: Activate Your Vision

His view: People spend too much time meticulously recycling vs living up to their talents and abilities. You get only one life. What...

Random Advice

Advice from his mentor: “What do you really want? Define your greatness. Then be convinced of it and start acting like it. Someone will...

4th Mindset: Accountability

Accountability is the 4th mindset. We all make efforts to change (e.g. corporate workshops, trainings, etc), but most efforts don’t have...

3rd Mindset: Candor

Realize that opening yourself to get feedback from others is risk free! They will have their perceptions of you regardless of your...

2nd Mindset: Vulnerability

When introducing yourself, don’t just list accomplishments. Tell a story about your dreams, how you’re getting there, and what...

1st Mindset: Generosity

What do I have to offer others? There are two types of generosity currency: Universal and personal. Universal currency is very...

Who’s Got Your Back

Everyone needs confidants for their professional work. People who care about your success and will not let you fail. Most people have...

Liberals vs Conservatives

Haidt claims that genes account for whether you are left/right a lot more than upbringing does. A single gene doesn’t predict much. But...

The Definition of Morality

For Western/modern society, the author favors rule utilitarianism (best rules that will produce the greatest good) as opposed to act...

Religion and Charity

Is God a Force of Good or Evil? Religious people generally give more in charity, but usually to their own kind or through their own...

Religion and the New Atheists

You cannot understand religion by looking at the individual. You must look at the collective. The Lone Believer Critics of religion...

Hives

The hive switch: The ability to temporarily transcend self-interest and lose ourselves in something bigger. It is essentially a...

Group Selection

Group Selection: If a trait benefits the group against other groups, but not the individual against other individuals in the same group,...

Punishment for Improving Cooperation

Reciprocal altruism theory explains why altruism/fairness behavior develops among pairs (tit for tat) but does not explain it...

Hierarchy vs Egalitarianism

Republicans appeal to all 5 moral tastes than Democrats, who appeal to only 1 or 2. This is why the former tend to have an edge...

Moral Foundations

Notable was Haidt’s criticism of amateur evolutionary theorists: They pick a trait and see if they can find a story that explains it. A...

Bentham and Kant: Bias Towards Reason as a Root of Morality

Moral monism is the reduction of morality to a single principle (e.g. don’t do harm). Haidt argues this is unhealthy for society. Is...

The Ethic of Divinity

Psychologists have a tendency to study the mind independent of culture. Anthropologists tend to study the culture and not the mind....

WEIRD People

Most research in psychology is conducted on WEIRD people. WEIRD stands for Western, Educated, Industrialized, Rich and Democratic. But...

The Rationalist Delusion

So do good reasoning skills lead to more moral behavior (the atheist’s dream)? A study found that moral philosophers behave just like...

Self-Esteem, Cheating, Voting and Confirmation Bias

Self-Esteem Is self-esteem about how we perceive ourselves, or about how we perceive other’s perceptions about ourselves? Levy Study:...

The Search For Truth?

There has existed for a long time a dilemma: Is it better to be just and honest in a world that will never recognize you as such, vs...

When Does an Elephant Listen to Reason?

Primarily by engaging with others. On can change via introspection, but others are more likely to give us non-confirmatory evidence....

Deontologists vs Utilitarianists

Utilitarianism (save the most lives) vs Deontologism (cannot impinge on individual rights - even to save many lives). Both claim their...

Infants’ Sense of Morality

Infants do not appear to be born with a blank slate. They have certain expectations on the physical laws, as well as the social laws. By...

Psychopaths

1% of males are psychopaths. Fewer females are. Most are nonviolent. But virtually half of crimes like serial rape and killing,...

Cleanliness and Morality

The sense of smell impacts moral judgments. Asking participants to fill out a survey on moral scenarios in the presence of fart smell...

Implicit Association Test

Affective Priming: Flash words like sunshine or cancer to the screen. You need to judge whether the word is positive or negative. If you...

Brains Evaluate Instantly and Constantly

Our brains evaluate everything instantly in terms of potential threat or benefit, and adjusts behavior to get more of the good and less...

Thalia’s Hypnosis Study

Hypnotized one set of students and made them dislike the word “take”. Hypnotized another set and made them dislike “often”. Gave them 6...

Does Reason Exist to Serve The Passions? Or Vice Versa?

The rationalist delusion: The worship of reason and the distrust of passions. It is a delusion because once you declare it to be an...

Negotiations - The Coursera Treatment 2: Seidel

Should I Negotiate? Consider the time spent in preparing and executing the negotiation, and the expected gain. Is the time spent worth...

Sociocentrism vs Individualism Part 2

To tackle Turiel’s concern that the “harmless” stories could be interpreted as harmful, Haidt decided to do a similar story, but added a...

Sociocentrism vs Individualism

Most societies have a need to “resolve” the tension between individuals and the society. Most societies are sociocentric: The group has...

The Anthropologist View

Anthropologists had studied and documented that many unrelated cultures had: Witchcraft and sorcery themes - with a great deal of...

Morality vs Social Conventions

To gauge a child’s developmental level, it is important that the method of gauging doesn’t rely on the child’s verbal abilities - this...

How Do Kids Learn About Morality? Role-playing

How do children learn right from wrong? There used to be 2 theories: Nature: Nativist (be it through God or evolution) Nurture:...

The Righteous Mind

Introduction Intuitions come first, strategic reasoning comes second. Moral intuitions arise automatically - long before moral reason....

Mutation Via References

val x = ref 42 val y = ref 42 (* Although the number is the same, x and y do NOT point to the same thing! *) val z = x (* z is now a...

First Class Functions and Functional Programming

Functions can take other functions as arguments. Consider: fun compose (f, n, x) = if n = 0 then x else f(compose(f, n-1, x)) This calls...

Tail Recursion

A tail call is when the callee’s result is merely returned without being used (i.e. it is not multiplied or added to anything, etc). In...

Exceptions

exception MyException exception AnException of int*int raise MyException e1 handle ex => e2 e1 handle ex(x,y) => e2 (* More generally *)...

Nested Patterns

We can nest patterns as deep as we like. Anywhere we put a variable in our pattern, we can put another pattern. exception BadTriple fun...

Polymorphic Types and Equality Types

The type ''a represents an equality type: It means anything that can be compared with the equality operator. Not everything can be...

Functions and Type Inference

If you use patterns to access records or function arguments, you usually do not need to specify their types. They will be inferred from...

Functions, Pattern Matching And Val Bindings

The pattern {f1=x1, ..., fn=xn} will match against a record (assuming all the types match) {f1=v1,...,fn=vn}. Note that since all tuples...

Case Expressions

Example (newtype is defined in a previous post). fun f (x : newtype) = case x of Pizza => 3 | Str s => 8 | TwoInts(i1, i2) => i1 + i2 To...

Datatype Bindings

Example: datatype newtype = TwoInts of int*int | Str of string | Pizza newtype is a new type that is added to the environment. TwoInts,...

Type Synonyms

type aname = t aname becomes an alias for type t. Useful for giving meaningful names: type date = int*int*int Think of it like typedef in C++.

Records

Example: val x = {k1=3, k2=false} Ordering of keys does not matter. You can nest records. The type is: {k1:int, k2:bool}. You use #k1 to...

Immutability

Most of Standard ML has immutability. Behind the scenes, references may be in use for optimization purposes, but the language guarantees...

Options

Consider this motivating example: I want to write a function that takes a list of integers, and returns its sum. What should it return...

Let Expressions

Syntax let b1 b2 ... bn in e end The keywords are let, in, end. bi are bindings. e is an expression. Note that often bi are each on...

Tuples and Lists

Tuples Syntax (e1, e2, ..., en) Note that the length of a tuple is known in advance. Type Checking ei will have type ti (the types need...

Functions

Defining Functions Look at the following example to declare a function: fun pow(x:int, y:int) = if y = 0 then 1 else x * pow(x, y-1) If...

Standard ML - Basics

Comments Comments begin with (* and end with *). You can nest comments. Statement Ends In the REPL, each statement must end in a...

Ten Questions People Ask About Getting To Yes

Much of the material with the tag gty comes from Getting To Yes. Does Positional Bargaining Ever Make Sense Principled negotiation is...

What If They Use Dirty Tactics?

Much of the material with the tag gty comes from Getting To Yes. Examples: Deception Throwing Off Balance Nibbling (asking for stuff...

What If They Won’t Play?

Much of the material with the tag gty comes from Getting To Yes. They may stick to their position. They may attack you instead of...

What If They Are More Powerful? Protecting Yourself

Much of the material with the tag gty comes from Getting To Yes. If you are trying to make a deal that is very important to you, it is...

Insist On Using Objective Criteria

Much of the material with the tag gty comes from Getting To Yes. Deciding On The Basis of Will is Costly Examples of negotiating on the...

Invent Options For Mutual Gain

Much of the material with the tag gty comes from Getting To Yes. Diagnosis There are typically 4 reasons that prevent the invention...

Focus on Interests, Not Positions

Much of the material with the tag gty comes from Getting To Yes. The basic problem in a negotiation is not in conflicting positions, but...

Separate The People From The Problem

Much of the material with the tag gty comes from Getting To Yes. Do not ignore the human factor, with all its emotions. Do not just...

Don’t Bargain Over Positions

Much of the material with the tag gty comes from Getting To Yes. A wise agreement is one that: Meets the legitimate interests of each...

Introduction

Much of the material with the tag gty comes from Getting To Yes. Negotiation is easier if both sides know how to perform it.

Negotiations (Getting To Yes)

Much of the material with the tag gty comes from Getting To Yes.

Story Writing Checklist

Is there something wrong in the third act? Then it is wrong in the first act. Are you writing because you have something to say, or...

Handling Critique

People’s critiques will be very subjective and very related to themselves. They may hate a character because it reminds them of someone...

Show Them Once So They Know

In Jurassic Park, a character diverts a dinosaur’s attention by throwing a flare away from him. The dinosaur chases the flare while they...

Superior Position

Superior position is when the audience knows something the characters do not. It is a useful tool for suspense, but can serve other...

Dialogue

With dialogue, it is important to set up the subtext. If you have established that two people hate each other, and then you have them in...

Subplots or Supporting Plots?

Do not use subplots to make the world more complex. Use them only to support the main plot. You are a slave to the story. You do not...

God From the Machine

Deus Ex Machina is horrible. Do not use it to solve problems. However, feel free to use it to create problems. No one minds it, and it...

Climax

The climax should bring masculine and feminine elements together. It shows how a character changed (or didn’t).

Genre

Genre is visible (e.g. western, horror, etc). Do not think in terms of genre. Focus on the story, and then choose an appropriate genre....

Show, Don’t Tell: Teaching vs Preaching

A storyteller teaches, not preaches. If you talk about what you want to say, you are preaching. If you show, you are teaching. The...

The Masculine and the Feminine

Consider this quote: “The King died and then the Queen died” is a story. “The King died and then the Queen died of grief” is a plot. -...

Tell the Truth

Truth is not about the facts. In a horror movie, a girl going down a scary basement is not the truth. Real scared women will not do...

Character Development

Ritual Pain Think of rites of passage. In many cultures, one has to undergo severe pain to become a man (not for women). Gang...

The Use of Clones

A clone in a story is a tool for showing, not telling. They are characters that represent what could, should, or might happen to the...

The Armature

People tell stories to teach something. It is likely the origin of stories - a way to teach something beyond simply using boring facts....

The Recipe for All Narratives

Less is more. Don’t go for a complex plot. Simplicity rules. There are seven steps in all narratives: Once upon a time And every day...

Negotiations - The Coursera Treatment

The Pie The first principle in negotiation: Figure out what the pie you are fighting over is. It may not be obvious, and the parties may...

Common Tactics Others Use

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. Lies about the bottom line and alternatives: Never...

Bargaining With the Devil

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. The more ethical you are, the higher the cost...

Closing and Giving Commitment

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. Scarcity Effect: People will value (or overvalue) a...

Opening and Making Concessions

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. If your opponent is competitive, you may need to...

Exchanging Information

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. 3 aspects to it: Rapport development Discovering...

Preparing Your Strategy

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. There are 4 steps to negotiations: Preparation...

Leverage

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. Leverage gives you power to reach an agreement on...

The Other Party’s Interests

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. It is imperative to ask yourself how achieving your...

Relationships

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. Reciprocity is the key to sustaining trust...

Authoritative Standards and Norms

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. There exist several norms and standards. Examples:...

Your Goals and Expectations

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. Research shows: The more specific your vision of...

Your Bargaining Style

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. There are typically 4 steps in negotiation:...

Bargaining For Advantage - Introduction

Much of the materials with the tag bfa comes from the Bargaining for Advantage book. When negotiating, it is vital to be yourself: If...

Burrows-Wheeler Transform

The method: Given a string of, say, length 8, form all 8 rotations of it, and then sort them lexicographically. Then form the 8 letter...

LZW Compression

The idea: First assign a number to all the letters of the alphabet. Say A is 41, B is 42, etc. Now let’s say we’re compressing the...

Huffman Encoding

The problem with run length encoding was that our chunk size (e.g. 4 bits) is fixed. This is nonoptimal. With Huffman encoding, we can...

Run Length Encoding

We have a large string (e.g. text file). Usually, ASCII is not the optimal space allocation for the file. There are various schemes for...

Substring Matching

We have a string of length \(N\), and wish to find an \(M\) character string in it. Brute Force Keep moving through the string till the...

Tries

An R-way trie is a tree where each node has \(R\) children. It’s best described by an example: Each node consists only of two...

Symbol Tables

A symbol table is an associative array. It’s a good idea to make the keys orderable for performance reasons (it also opens up more...

Bloom Filters

Bloom filters are an application of hashing. It is a data structure that allows us to check if an object has already been seen (without...

Hash Functions

We often want to store an object for quick retrieval, or see if a given object has been observed before in \(O(1)\) time. Let \(U\) be...

Suffix Arrays

A suffix array is an array formed by taking a string, and storing pointers to all the suffixes in the array. As an example, if the...

Radix Sorts

Least Significant Digit Suppose we have \(N\) strings of length \(W\). The idea behind the LSD sort is to first sort the last “digit”...

Counting Sort

Counting Sort Suppose we have \(N\) elements, but we know the elements are drawn from a fixed, finite list (called the alphabet in this...

Max Flows and Min Cuts

Mincut Problem An s-t cut is a cut with \(s\) in one set and \(t\) in the other. Call the sets \(A\) and \(B\). Given a digraph, with...

Shortest Paths Summary

There are many “kinds” of shortest paths. Algorithm Constraint Typical Worst Case Topological Sort No directed cycles \(N+M\) \(N+M\)...

Negative Cycles

A negative cycle is a directed cycle where the sum of the edge weights is negative. A shortest paths tree exists if and only if there...

Shortest Paths

Given a digraph, we may wish to find the shortest distance between two nodes, or between a node and all other nodes, etc. Each edge has...

Minimum Spanning Trees

Given a connected graph \(G\), with positive edge weights, the spanning tree is a subgraph \(T\) that is both a tree (connected and...

Finding the Strongly Connected Components of a Digraph

Applications When looking at code/library dependencies, one may want to see which code pieces form strongly connected components, and...

Topological Sort

Topological Sort A topological sort is a traversal of a digraph with ordering constraints. Let each node have some value/weight. It is a...

Minimum Cut of a Graph

A cut of a graph is a partitioning of the nodes into two nonempty sets. A minimum cut is a cut that minimizes the number of edges...

Karatsuba Multiplication

In grade school we learn an algorithm for multiplying two \(N\) digit integers. Let our basic operation to be the multiplication or...

Rectangle Intersection

Given \(N\) rectangles, find all the intersections. This algorithm is very similar to the 1-D line intersection search. The difference...

1-D Interval Intersection

Suppose we have \(N\) 1-D intervals of the form \((a,b)\) where \(a

2-D Range Search, Points in a Box Search and K-D Trees

This is like the 1-D range search, but where the keys can now have two coordinates. It’s finding the number of points in a rectangle...

1-D Range Search and Line Intersection Search

Sample problems we want to solve: What are all the keys between two keys? (Relevant to databases) How many keys exist between two keys?...

Red Black Trees

We introduced 2-3 trees with highly desirable properties. Here we’ll convert them into binary trees while maintaining all the...

Asymptotic Expansions

A decreasing sequence \(g_{k}(N)\) is called an asymptotic scale if \(g_{k+1}(N)=o(g_{k}(N))\). \(f(N)\sim...

The Average Number of Leaves in a Binary Tree of \(N\) Internal Nodes

Let’s use generating functions to count the average number of leaves in a binary tree with \(N\) internal nodes. Definitions Let \(P\)...

The Average Number of 1’s in a Binary String of Length \(N\)

Let’s use generating functions to count the average number of 1’s in a binary string of length \(N\). Definitions Let \(P\) be the set...

Counting With Generating Functions

Generating functions can be used for counting. Consider the problem of finding the number of trees with internal nodes. Let \(T\) be the...

2-3 Trees

A 2-node is like a regular node in a binary search tree: It has one key and two children. A 3-node has 2 keys and 3 children. The middle...

Exponential Generating Functions

To form a generating function, we multiplied by \(z^{N}\) and summed. This is not the only way to form a generating function. Another...

Solving Recurrence Relations With Ordinary Generating Functions

Technique The basic technique is to multiply the equation with \(z^{N}\), sum over all \(N\), recast in terms of the generating function...

Ordinary Generating Functions

Definition An ordinary generating function of a sequence \(\left\{a_{k}\right\}\) is: \begin{equation*} A(z) = \sum_{k\ge 0}a_{k}z^{k}...

Number of Binary Trees of Size \(n\)

Problem How many bits are needed to represent a binary tree with \(n\) nodes? A lower bound is given by the fact that \(m\) bits can...

Binary Search Trees

A binary search tree is a fairly useful structure for storing ordered data. The invariant for a binary search tree is straightforward:...

Heap Sort

One way to sort a list is to use the heap data structure. Given an array of \(N\) unsorted elements, build a max heap in place. Start...

Binary Heaps & Priority Queues

At times we want a structure similar to a queue or stack, but instead of LIFO or FIFO, we want it to pop the maximum element each time....

K-th Largest Element

Sometimes we wish to find the k-th largest element in a list. Brute Force A brute force way to do this would be to sort the list and...

Quick Sort

A quick sort works recursively: Shuffle the list. This protects against a carefully crafted input that will make the algorithm...

Convex Hull Problem

Say you have \(N\) points on a Euclidean plane. You want to find the polygon with the smallest area that can be formed connecting a...

Sorting Complexity Analysis

Any comparison based sorting algorithm must use at least \(\lg(N!)\sim N\lg N\) comparisons for the worst case. This is absent any...

Finding the Closest Pairs in a Plane

Suppose we have \(N\) points in a plane, and we wish to find the closest pair. The brute force algorithm takes \(\Theta(N^{2})\). We can...

Counting Inversions

Why would we want to count the number of inversions? One application may be to see how close two different people’s rankings of the same...

Dealing With Recurrence Relations

Useful Identities \begin{equation*} \sum_{k=m}^{n}\dbinom{k}{m}=\dbinom{n+1}{m+1} \end{equation*} The mnemonic for this is: Suppose you...

Merge Sort

A merge sort works recursively: Split the list into two roughly equal halves. Sort each half using mergesort. Merge the two...

Shuffling Caveats

When using a random number generator for shuffling, be wary of simple issues. Using cards as an example: If the seed is 32 bits, you’ll...

Shell Sort

A shell sort works somewhat recursively. It first sorts every \(k\) elements (i.e. the sublist formed by elements 0, \(k\), \(2k\),...

Insertion Sort

An insertion sort starts from the first element in the list, and then for each element will check with the previous one to see if it is...

Inversions & Partial Sortedness

An inversion in a list of elements is a pair of elements where the 2nd element is smaller than the first (i.e. the 2nd element would be...

Selection Sort

A selection sort starts out by traversing the whole list, finding the minimal element, and swapping it with the first element. It then...

Loop Invariants

A loop invariant is a statement that holds true just before and after each iteration. It may be violated within the iteration, but the...

Graphs Using NetworkX

NetworkX is a Python library for handling graphs. In [1]: %matplotlib inline In [14]: import networkx as nx import pylab as plt In [3]:...

Breadth First Search And Finding the Distance Between Two Nodes

We wish to find the distance between two nodes \(a\) and \(b\). Let’s generalize this further and find the distance from \(a\) to all...

Depth First Search

The depth first search algorithm is a way to traverse all the nodes in a graph. The algorithm is trivial: Start at a given node. Mark it...

Queues

A queue is a data structure for holding objects. It is a FIFO structure. It supports two operations: enqueue and dequeue dequeue returns...

Graphs

An undirected graph is defined by \((V, E)\) where \(V\) is a set of nodes and \(E\) is a set of edges (each edge is an unordered set of...

Stacks

A stack is a data structure for holding objects. It is a LIFO structure. It supports two operations: pop and push. pop returns (and...

2-Sum and 3-Sum

2-Sum Problem Statement Given a set of \(N\) integers, find how many pairs sum to 0. Brute Force Sum all pairs and count whichever sum...

Percolation: An Application of Union Find

Consider an \(N\times N\) square grid, where all the grids are black. Now let each square in the grid be white with probability \(p\)....

Union-Find Algorithm

Dynamic Connectivity & Disjoint Sets Given \(N\) nodes, some connected amongst themselves, does a path exist between any two...

Asymptotic Notation

An asymptotically positive function \(f(n)\) is one that is always positive for sufficiently large \(n\). A similar definition holds for...

Probability Review

Linearity of expectation: \(E(aX+bY+c)=aE(x)+bE(Y)+c\). This holds even when \(X\) and \(Y\) are dependent. Exploit this! Independent...

Useful Inequalities

\begin{equation*} \sum_{k=2}^{n}\frac{1}{k}\le\ln n \end{equation*} To see this, look at the curve \(1/x\), and integrate it from 1 to...