Skip to content

Instantly share code, notes, and snippets.

@ICBacon
Forked from tonyfast/firstnb.ipynb
Last active August 29, 2015 14:25
Show Gist options
  • Save ICBacon/9325153c88d850adffd0 to your computer and use it in GitHub Desktop.
Save ICBacon/9325153c88d850adffd0 to your computer and use it in GitHub Desktop.
Accessing Old Gists

Accessing Old Gists

Example gist SHA 0c37e47f24531557decd

  1. List the commits from the gist

    https://gist.github.com/ICBacon/0c37e47f24531557decd/commits

  2. Open the console

  3. Parse the request

    // Deserialize API request into the console
    eval('var data = ' + document.getElementsByTagName('pre')[0].innerText )
    // Get the last Gist 
    gistUrl = data.slice(-1)[0]['url']
  4. Open the Github Gist

    // Replace the api location with the html uri location
    // Open that bad boy
    window.open(gistUrl.replace('https://api.github.com/gists/','https://gist.github.com/'))
  5. Open the Raw API

    ```javascript
    

    // Open that bad boy window.open(gistUrl)

    
    1. Parse the request again
    
    ```javascript
    // Deserialize API request into the console
    eval('var data = ' + document.getElementsByTagName('pre')[0].innerText )
    
    1. Copy homeboy into the clipboard
    copy(data['files']['MyFirstNotebook.ipynb']['content'])

References

Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Definition of a Field F in Mathematics (Field Axioms):\n",
"\n",
"* ### Closure of F under addition and multiplication (i.e. + and · are binary operations on F)\n",
"\n",
" $\\forall$ a, b $\\epsilon$ F,\n",
" $$a + b\\; \\epsilon\\; F$$\n",
" $$a · b\\; \\epsilon\\; F$$\n",
"\n",
"* ### Commutativity of addition and multiplication\n",
"\n",
" $\\forall$ a, b $\\epsilon$ F, the following equalities hold:\n",
" $$b + a = a + b$$\n",
" $$b · a = a · b$$\n",
"\n",
"* ### Associativity of addition and multiplication\n",
" \n",
" $\\forall$ a, b, and c $\\epsilon$ F, the following equalities hold:\n",
" $$a + (b + c) = (a + b) + c$$\n",
" $$a · (b · c) = (a · b) · c$$\n",
"\n",
"* ### Distributivity of multiplication over addition\n",
"\n",
" $\\forall$ a, b, and c $\\epsilon$ F, the following equality holds:\n",
" \n",
" $$a · (b + c) = (a · b) + (a · c)$$\n",
"\n",
"* ### Existence of additive and multiplicative identity elements\n",
"\n",
" $\\forall$ a $\\epsilon$ F, $\\exists$ 0 $\\epsilon$ F, called the additive identity element, s.t.\n",
" \n",
" $$a + 0 = a$$\n",
" \n",
" Likewise, $\\exists$ 1 $\\epsilon$ F, called the multiplicative identity element, s.t. $\\forall$ a $\\epsilon$ F,\n",
" \n",
" $$a · 1 = a$$\n",
"\n",
"* ### Existence of additive inverses and multiplicative inverses\n",
"\n",
" $\\forall$ a $\\epsilon$ F, $\\exists$ (−a) $\\epsilon$ F, s.t.\n",
" \n",
" $$a + (−a) = 0$$\n",
" \n",
" Similarly, $\\forall$ a $\\epsilon$ F, with a $\\neq$ 0, $\\exists$ $a^{−1}$ $\\epsilon$ F, s.t.\n",
" \n",
" $$a · a^{−1} = 1$$\n",
" \n",
" (The elements a + (−b) and a · $b^{−1}$ are also denoted a − b and $\\dfrac{a}{b}$, respectively.) In other words, subtraction and division operations exist.\n",
"\n",
"* ### Nontrivial Field\n",
"\n",
" To exclude the trivial ring, let's require the additive identity and the multiplicative identity to be distinct:\n",
" \n",
" $$0 \\neq 1$$\n",
"\n",
"* ### Summary\n",
"\n",
" A *field* is therefore an algebraic structure〈F, +, ·, −, −1, 0, 1〉; of type〈2, 2, 1, 1, 0, 0〉, consisting of two abelian groups:\n",
" \n",
" * F under +, −, and 0\n",
" * F ∖ {0} under ·, −1, and 1, where 0 $\\neq$ 1, along with · distributing over +"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example: Show that the set of all real numbers $\\mathbb{R}$ is a field"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Recall the set $\\mathbb{R}$ = {...,-3,-2,-1,0,1,2,3,...}\n",
"\n",
"Suppose $\\exists$ a, b, and c $\\epsilon$ $\\mathbb{R}$. To show that $\\mathbb{R}$ is a field by using the definition above, let's show that all of the field axioms hold true.\n",
"\n",
"#### Axiom 1 (Closure). $\\forall$ $a, b$ $\\epsilon$ $\\mathbb{R}$,\n",
"$$a + b\\; \\epsilon\\; \\mathbb{R}$$\n",
"$$a · b\\; \\epsilon\\; \\mathbb{R}$$\n",
"\n",
"#### Axiom 2 (Commutativity). $\\forall$ $a, b$ $\\epsilon$ $\\mathbb{R}$,\n",
"$$b + a = a + b$$\n",
"$$b · a = a · b$$\n",
"\n",
"#### Axiom 3 (Associativity). $\\forall$ $a,b,c$ $\\epsilon$ $\\mathbb{R}$,\n",
"$$a + (b + c) = (a + b) + c$$\n",
"$$a · (b · c) = (a · b) · c$$\n",
"\n",
"#### Axiom 4 (Distributivity). $\\forall$ $a,b,c$ $\\epsilon$ $\\mathbb{R}$,\n",
"$$a · (b + c) = (a · b) + (a · c)$$\n",
"\n",
"#### Axiom 5 (Identities). $\\forall$ $b$ $\\epsilon$ $\\mathbb{R}$, $\\exists$ $0,1$ $\\epsilon$ $\\mathbb{R}$, $s.t.$\n",
"$$\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad b + 0 = 0 + b = b\\qquad\\qquad(Additive\\, Identity)$$\n",
"$$\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad b · 1 = 1 · b = b\\qquad\\quad\\;\\,(Multiplicative\\, Identity)$$\n",
"\n",
"#### Axiom 6 (Inverses). $\\forall$ $a$ $\\epsilon$ $\\mathbb{R}$, $\\exists$ $b,c$ $\\epsilon$ $\\mathbb{R}$, $and\\,\\, c\\neq0$ $s.t.$\n",
"$$\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad a + b = b + a = 0\\qquad\\qquad (Additive\\, Inverse)$$\n",
"$$\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad\\qquad a · c = c · a = 1\\qquad\\quad\\;\\,(Multiplicative\\, Inverse)$$\n",
"\n",
"#### Axiom 7 (Non-Trivial Field). $$0 \\neq 1$$\n",
"\n",
"####Axioms (1-7) imply that $\\mathbb{R}$ is a field."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's take three real numbers a,b,c $\\epsilon$ $\\mathbb{R}$ to show this result. Suppose we take a,b,c to be:"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"a = 2\n",
"b = -4\n",
"c = 5"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-4"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"5"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-2"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + b"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-8"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a * b"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + (b + c)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(a + b) + c"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-40"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a * (b * c)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-40"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(a * b) * c"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-2"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b + a"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-8"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b * a"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + 0"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a * 1"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a + (-a)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1.0"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a * (a ** (-1))"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a * (b + c)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(a * b) + (a * c)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.8"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment