nhaliday + cheatsheet   93

python - Short Description of the Scoping Rules? - Stack Overflow
Actually, a concise rule for Python Scope resolution, from Learning Python, 3rd. Ed.. (These rules are specific to variable names, not attributes. If you reference it without a period, these rules apply)

LEGB Rule.

L, Local — Names assigned in any way within a function (def or lambda)), and not declared global in that function.

E, Enclosing-function locals — Name in the local scope of any and all statically enclosing functions (def or lambda), from inner to outer.

G, Global (module) — Names assigned at the top-level of a module file, or by executing a global statement in a def within the file.

B, Built-in (Python) — Names preassigned in the built-in names module : open,range,SyntaxError,...

As a caveat to Global access - reading a global variable can happen without explicit declaration, but writing to it without declaring global(var_name) will instead create a new local instance.

--

Essentially, the only thing in Python that introduces a new scope is a function definition. Classes are a bit of a special case in that anything defined directly in the body is placed in the class's namespace, but they are not directly accessible from within the methods (or nested classes) they contain.
q-n-a  stackex  programming  intricacy  gotchas  python  pls  objektbuch  cheatsheet 
november 2017 by nhaliday
man page - Wikipedia
NAME
The name of the command or function, followed by a one-line description of what it does.
SYNOPSIS
In the case of a command, a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its definition.
DESCRIPTION
A textual description of the functioning of the command or function.
EXAMPLES
Some examples of common usage.
SEE ALSO
A list of related commands or functions.
explanation  programming  engineering  documentation  howto  terminal  unix  wiki  reference  cheatsheet  trivia  info-foraging 
september 2017 by nhaliday
Introduction to Scaling Laws
https://betadecay.wordpress.com/2009/10/02/the-physics-of-scaling-laws-and-dimensional-analysis/
http://galileo.phys.virginia.edu/classes/304/scaling.pdf

Galileo’s Discovery of Scaling Laws: https://www.mtholyoke.edu/~mpeterso/classes/galileo/scaling8.pdf
Days 1 and 2 of Two New Sciences

An example of such an insight is “the surface of a small solid is comparatively greater than that of a large one” because the surface goes like the square of a linear dimension, but the volume goes like the cube.5 Thus as one scales down macroscopic objects, forces on their surfaces like viscous drag become relatively more important, and bulk forces like weight become relatively less important. Galileo uses this idea on the First Day in the context of resistance in free fall, as an explanation for why similar objects of different size do not fall exactly together, but the smaller one lags behind.
nibble  org:junk  exposition  lecture-notes  physics  mechanics  street-fighting  problem-solving  scale  magnitude  estimate  fermi  mental-math  calculation  nitty-gritty  multi  scitariat  org:bleg  lens  tutorial  guide  ground-up  tricki  skeleton  list  cheatsheet  identity  levers  hi-order-bits  yoga  metabuch  pdf  article  essay  history  early-modern  europe  the-great-west-whale  science  the-trenches  discovery  fluid  architecture  oceans  giants  tidbits 
august 2017 by nhaliday
Relationships among probability distributions - Wikipedia
- One distribution is a special case of another with a broader parameter space
- Transforms (function of a random variable);
- Combinations (function of several variables);
- Approximation (limit) relationships;
- Compound relationships (useful for Bayesian inference);
- Duality;
- Conjugate priors.
stats  probability  characterization  list  levers  wiki  reference  objektbuch  calculation  distribution  nibble  cheatsheet  closure  composition-decomposition  properties 
february 2017 by nhaliday
Doomsday rule - Wikipedia, the free encyclopedia
It takes advantage of each year having a certain day of the week, called the doomsday, upon which certain easy-to-remember dates fall; for example, 4/4, 6/6, 8/8, 10/10, 12/12, and the last day of February all occur on the same day of the week in any year. Applying the Doomsday algorithm involves three steps:
1. Determination of the anchor day for the century.
2. Calculation of the doomsday for the year from the anchor day.
3. Selection of the closest date out of those that always fall on the doomsday, e.g., 4/4 and 6/6, and count of the number of days (modulo 7) between that date and the date in question to arrive at the day of the week.

This technique applies to both the Gregorian calendar A.D. and the Julian calendar, although their doomsdays are usually different days of the week.

Easter date: https://en.wikipedia.org/wiki/Computus
https://www.tondering.dk/claus/cal/easter.php
*When is Easter? (Short answer)*
Easter Sunday is the first Sunday after the first full moon on or after the vernal equinox.

*When is Easter? (Long answer)*
The calculation of Easter is complicated because it is linked to (an inaccurate version of) the Hebrew calendar.

...

It was therefore decided to make Easter Sunday the first Sunday after the first full moon after vernal equinox. Or more precisely: Easter Sunday is the first Sunday after the “official” full moon on or after the “official” vernal equinox.

The official vernal equinox is always 21 March.

The official full moon may differ from the real full moon by one or two days.

...

The full moon that precedes Easter is called the Paschal full moon. Two concepts play an important role when calculating the Paschal full moon: The Golden Number and the Epact. They are described in the following sections.

...

*What is the Golden Number?*
Each year is associated with a Golden Number.

Considering that the relationship between the moon’s phases and the days of the year repeats itself every 19 years (as described in the section about astronomy), it is natural to associate a number between 1 and 19 with each year. This number is the so-called Golden Number. It is calculated thus:

GoldenNumber=(year mod 19) + 1

[link:
However, 19 tropical years is 234.997 synodic months, which is very close to an integer. So every 19 years the phases of the moon fall on the same dates (if it were not for the skewness introduced by leap years). 19 years is called a Metonic cycle (after Meton, an astronomer from Athens in the 5th century BC).

So, to summarise: There are three important numbers to note:

A tropical year is 365.24219 days.
A synodic month is 29.53059 days.
19 tropical years is close to an integral number of synodic months.]

In years which have the same Golden Number, the new moon will fall on (approximately) the same date. The Golden Number is sufficient to calculate the Paschal full moon in the Julian calendar.

...

Under the Gregorian calendar, things became much more complicated. One of the changes made in the Gregorian calendar reform was a modification of the way Easter was calculated. There were two reasons for this. First, the 19 year cycle of the phases of moon (the Metonic cycle) was known not to be perfect. Secondly, the Metonic cycle fitted the Gregorian calendar year worse than it fitted the Julian calendar year.

It was therefore decided to base Easter calculations on the so-called Epact.

*What is the Epact?*
Each year is associated with an Epact.

The Epact is a measure of the age of the moon (i.e. the number of days that have passed since an “official” new moon) on a particular date.

...

In the Julian calendar, the Epact is the age of the moon on 22 March.

In the Gregorian calendar, the Epact is the age of the moon at the start of the year.

The Epact is linked to the Golden Number in the following manner:

Under the Julian calendar, 19 years were assumed to be exactly an integral number of synodic months, and the following relationship exists between the Golden Number and the Epact:

Epact=(11 × (GoldenNumber – 1)) mod 30

...

In the Gregorian calendar reform, some modifications were made to the simple relationship between the Golden Number and the Epact.

In the Gregorian calendar the Epact should be calculated thus: [long algorithm]

...

Suppose you know the Easter date of the current year, can you easily find the Easter date in the next year? No, but you can make a qualified guess.

If Easter Sunday in the current year falls on day X and the next year is not a leap year, Easter Sunday of next year will fall on one of the following days: X–15, X–8, X+13 (rare), or X+20.

...

If you combine this knowledge with the fact that Easter Sunday never falls before 22 March and never falls after 25 April, you can narrow the possibilities down to two or three dates.
tricks  street-fighting  concept  wiki  reference  cheatsheet  trivia  nitty-gritty  objektbuch  time  calculation  mental-math  multi  religion  christianity  events  howto  cycles 
august 2016 by nhaliday
Coefficient of relationship - Wikipedia, the free encyclopedia
relatedness by consanguinity

Average percent DNA shared between relatives – 23andMe Customer Care: https://customercare.23andme.com/hc/en-us/articles/212170668-Average-percent-DNA-shared-between-relatives
summary of relatedness by consanguinity
shouldn't it be 2^-4 ~ 6% for first cousins?
wiki  sapiens  reference  genetics  evolution  concept  cheatsheet  kinship  metrics  intersection-connectedness  multi  brands  biotech  data  graphs  trees  magnitude  identity  estimate  measurement  inference 
july 2016 by nhaliday
« earlier      
per page:    204080120160

bundles : initmeta

related tags

aaronson  abstraction  accretion  accuracy  acm  additive  advice  africa  akrasia  AMT  analogy  analysis  anglo  anonymity  app  applicability-prereqs  approximation  architecture  arrows  article  asia  assembly  atoms  bayesian  benchmarks  best-practices  biases  big-picture  binomial  bio  biotech  blog  books  bootstraps  bounded-cognition  brands  c(pp)  caching  calculation  career  characterization  chart  cheatsheet  checklists  chemistry  christianity  closure  cocktail  cocoa  cog-psych  commentary  comparison  complexity  composition-decomposition  computer-vision  concentration-of-measure  concept  confluence  convexity-curvature  cost-benefit  crosstab  curvature  cycles  data  data-science  database  dataviz  dbs  debugging  decision-making  deep-learning  dennett  desktop  detail-architecture  devtools  differential  direction  discipline  discovery  distributed  distribution  documentation  draft  duality  dynamic  early-modern  econometrics  editors  electromag  embodied  encyclopedic  engineering  error  essay  estimate  europe  evan-miller  events  evolution  examples  exocortex  explanation  explore-exploit  exposition  fermi  fluid  focus  foreign-lang  fourier  french  functional  gelman  generalization  genetics  geography  giants  gif  git  github  gotchas  grad-school  gradient-descent  graphs  gravity  ground-up  gtd  guide  habit  hardness  heuristic  hg  hi-order-bits  history  hmm  hn  homo-hetero  howto  hypocrisy  hypothesis-testing  identity  idk  IEEE  illusion  inference  info-dynamics  info-foraging  infographic  inhibition  init  integral  internet  intersection-connectedness  interview-prep  intricacy  ios  iron-age  iteration-recursion  jargon  jobs  kinship  knowledge  language  latex  latin-america  learning  lecture-notes  lens  let-me-see  levers  lexical  libraries  linear-algebra  linear-models  linearity  linguistics  links  list  lower-bounds  machine-learning  magnitude  maps  math  math.CA  math.CO  math.CV  math.GN  measurement  mechanics  mediterranean  MENA  mental-math  meta:prediction  metabuch  methodology  metric-space  metrics  minimum-viable  mit  mobile  model-class  models  moments  money-for-time  mostly-modern  multi  multiplicative  near-far  networking  neurons  news  nibble  nitty-gritty  notation  notetaking  novelty  numerics  objektbuch  ocaml-sml  oceans  ocw  oly  oly-programming  opsec  optimization  org:anglo  org:bleg  org:edu  org:junk  org:mag  org:med  os  oss  osx  overflow  p:whenever  parsimony  paste  pdf  performance  phd  physics  pic  plots  pls  pragmatic  pre-2013  prioritizing  privacy  probability  problem-solving  procrastination  productivity  programming  progression  proofs  properties  protocol  psychology  publishing  python  q-n-a  qra  quality  quantitative-qualitative  quantum  quixotic  r-lang  rat-pack  rationality  reason  recommendations  recruiting  reduction  reference  regression  relativity  religion  repo  retention  rigor  s:*  s:***  sapiens  scale  scaling-tech  scholar-pack  science  scitariat  search  security  self-control  separation  short-circuit  skeleton  social  social-psych  software  space  spanish  speaking  spock  stackex  stamina  stanford  stats  stereotypes  stirling  stream  street-fighting  strings  studying  summary  symmetry  syntax  synthesis  system-design  systems  tcs  tcstariat  tech  techtariat  terminal  the-classics  the-great-west-whale  the-monster  the-trenches  theory-of-mind  theory-practice  thermo  thinking  threat-modeling  tidbits  time  time-preference  time-use  tools  top-n  topology  tradecraft  tradeoffs  transitions  trees  tribalism  tricki  tricks  trivia  tutorial  unit  unix  us-them  vague  vcs  video  visual-understanding  visualization  visuo  web  weird  wiki  wire-guided  within-without  workflow  working-stiff  world  writing  yak-shaving  yoga  zooming  👳  🔬  🖥  🤖  🦉 

Copy this bookmark:



description:


tags: