<jupyter_start><jupyter_text>[Oregon Curriculum Network](http://4dsolutions.net/ocn/)[School of Tomorrow (Home)](School_of_Tomorrow.ipynb) Calculator of TomorrowGet more practice in the [Calculator Sandbox](Sandbox_Example.ipynb), then start making your own Jupyter Notebooks! COLOR CODINGMost of what you'll want to know you will find in the School of Yesterday. Caveat:  if you data mine in the recent past only, you might miss out on number bases (a big part of New Math).Some elements within the Lower48 in North America, for example, perpetrated a base-10-only restrictum that many professionals chose to ignore. Number bases, as a concept, need some focus and attention.   Research Project:  Vocab* [Angle vs. Frequency](http://grunch.net/synergetics/terms.html)* [XKCD Color Names](https://xkcd.com/color/rgb/)![What is Color?](https://imgs.xkcd.com/comics/color_models.png)This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License.This means you're free to copy and share these comics (but not to sell them). More details. We begin our investigation of numbers expressed in different bases, with the hexademicals.  Binary digital devices use 0-F to symbolize the 16 permutations of four bits of 1 or 0.  1100, 1010, 0011... are examples of such permutations.Two hexadecimal numbers side by side represent strings of eight bits, such as 0100 1001. Such bit combinations are used to encode not only numbers, but other symbolic content such as alphabets.  Emoji have their unique bitwise signatures, in the various Unicode encodings.<jupyter_code>base10 = int('FF', 16) # in base 16 but give us decimal output (the default format)
base10
hex(base10)  # string output, with 0x prefix meaning hexadecimal
eval(hex(base10))
%matplotlib inline
import matplotlib.pyplot as plt

def make_squares(all_axes, the_color):
    """Side Effect City"""
    all_axes = all_axes.ravel()
    [axi.xaxis.set_visible(False) for axi in all_axes]
    [axi.yaxis.set_visible(False) for axi in all_axes]
    [axi.set_facecolor(the_color) for axi in all_axes]

f, axarr = plt.subplots(4,4, figsize=(4,4), facecolor=(.18, .31, .31))
make_squares(axarr, 'xkcd:salmon' ) #ff796c
plt.show();
f, axarr = plt.subplots(4,4, figsize=(4,4), facecolor=(.18, .31, .31))
make_squares(axarr, 'xkcd:burnt sienna' ) #b04e0f
plt.show();
from IPython.display import YouTubeVideo
YouTubeVideo("UIKGV2cTgqA")<jupyter_output><empty_output><jupyter_text>[About <NAME> on Wikipedia](https://en.wikipedia.org/wiki/Tom_Lehrer) Research Project:  Fastest Multiplication Methods[Mathematicians Discover the Perfect Way to Multiply](https://www.quantamagazine.org/mathematicians-discover-the-perfect-way-to-multiply-20190411/) by <NAME>, Senior Writer, April 11, 2019<jupyter_code>YouTubeVideo("FKGRc867j10")<jupyter_output><empty_output><jupyter_text>TIME TO GET PLOTTINGA plot is what we also call a graph.  However Graph Theory has a meaning for graph worth giving the spotlight, so why waste two words for "plotting"?Now "plot" has other meanings as well, such as: * a grave in the cemetery* the driving storyline* a secret plan[note use of Markdown]We use splots to graphically show relationships between co-variables such as x and y, as in:y = rule depending on x somehow Sometimes, in data mining the "textbooks of yesterday", you will see the notation: "f(x)" = "some expression involving x" where "f(x)" is read as "function of x".  A formal mathematical definition of "function" includes the feature that it's deterministic in the following sense:  Given all the same inputs (a point in n-d space perhaps), you always get precisely the same output, no exceptions.  f(2) gives 4 when f(x) = x + 2. Caveat:  You're not allowed to change the base or basis, as that might indeed change the answer.  The base is considered part of the environment, nor are we permitted to change the meaning of ```__add__``` mid-stream, to make it mean "modulo N" as we might in cryptography.For more plotting, see [isotope decay](isotope_decay.ipynb).<jupyter_code>def func(x):  # to be vectorized later
    return x + 2

x = the_input  = 6
y = the_output = func(x)
print(f"func({x}) returns {y}")
x = the_input  = int('FF',16)
y = the_output = eval(hex(func(x)))
print(f"func({x}) returns {y}")<jupyter_output>func(255) returns 257<jupyter_text>Examples of a mathematical not-function (which we might still call a function in Python), are: ```python>>> datetime.datetime.now()    full date/time>>> datetime.date.today()      date only, BIOS>>> time.clock()               CPU clock as float```<jupyter_code>import datetime, time
print(
datetime.datetime.now(),
datetime.date.today(),
time.clock(),
sep = "\n")<jupyter_output>2019-06-30 18:43:28.969660
2019-06-30
5.004325<jupyter_text>PLOTTING WITH COLORSThe code cell below is all about trying out different arguments in the sixteen cells (assuming 4 by 4 as the default -- you're free to change the code of course).  Lets experiment with marker sizes and shapes, and different vectorized, linear functions.A vectorized function is one trained to automatically apply to every element in any ndarray fed to it.<jupyter_code>import numpy as np
vf = np.vectorize(func)

domain1 = np.arange(0,1,0.1)
domain2 = np.linspace(-1,1,10)

fig, axarr = plt.subplots(4,4, figsize=(4,4), facecolor=(.18, .31, .31))
make_squares(axarr, 'xkcd:burnt sienna' ) #b04e0f

#=== ROW 0 ==========
plt.sca(axarr[0,0])
plt.scatter([0],[0])

plt.sca(axarr[0,1])
plt.scatter([0,1,10],[0,1,10])

plt.sca(axarr[0,2])
plt.scatter(domain1,domain1**2)

plt.sca(axarr[0,3])
plt.scatter(domain2,domain2**2)

#=== ROW 1 ==========
plt.sca(axarr[1,0])
plt.scatter([0],[0], s=500, marker="^")

plt.sca(axarr[1,1])
plt.scatter([0],[0], s=1000, marker="2")

plt.sca(axarr[1,2])
plt.scatter([0],[0], s=1000, marker="s")

plt.sca(axarr[1,3])
plt.scatter([0],[0], s=1000, marker="p")

#=== ROW 2 ==========
plt.sca(axarr[2,0])
plt.scatter([0],[0], s=500, marker="P")

plt.sca(axarr[2,1])
plt.scatter([0],[0], s=1000, marker="+")

plt.sca(axarr[2,2])
plt.scatter([0],[0], s=1000, marker="D")

plt.sca(axarr[2,3])
plt.scatter([0],[0], s=1000, marker="d")

#=== ROW 3 ===========
plt.sca(axarr[3,0])
plt.scatter(np.array([0.1, 0.2]), np.array([0.5, 0.2]))

plt.sca(axarr[3,1])
plt.scatter(domain1, vf(domain1)) # vf defined up top

plt.sca(axarr[3,2])
plt.scatter(domain1, np.vectorize(lambda x: -x)(domain1));

plt.sca(axarr[3,3])
plt.scatter(domain1, np.vectorize(lambda x: 0)(domain1));<jupyter_output><empty_output><jupyter_text>The numpy package arrives with many vectorized functions, such as ```np.sqrt``` but what if you want to roll your own lambda?  ```np.vectorize``` will outfit any callable with what it takes to apply to whole arrays, or to indexed subarrays thereof.Whence comes this meaning of "vectorize"?  Is this the linear algebra concept?  Yes and no.  Computer science comes with its own concerns about workflow.  What operations must wait for other operations, to proceed?  Vectorizable operations are those that might be done "in parallel" (without waiting for other operations to complete). HISTORY:  VECTOR PROCESSORS * [Vector Processor in Wikipedia](https://en.wikipedia.org/wiki/Vector_processor)* [Life and Work of Seymour Cray](https://youtu.be/htWqxABAoRE)* [Cray Tells His Story](https://youtu.be/8Z9VStbhplQ)* [Stream Processing (related)](https://en.wikipedia.org/wiki/Stream_processing)Vector processors take this concept one step further. Instead of pipelining just the instructions, they also pipeline the data itself. The processor is fed instructions that say not just to add A to B, but to add all of the numbers "from here to here" to all of the numbers "from there to there". Instead of constantly having to decode instructions and then fetch the data needed to complete them, the processor reads a single instruction from memory, and it is simply implied in the definition of the instruction itself that the instruction will operate again on another item of data, at an address one increment larger than the last. This allows for significant savings in decoding time.   COLORMAPSYou have entered the realm of the graphic artist, even if instead of brushes, you must spell out commands.  The genii in the bottle (matplotlib) will do the rest.Explore [colormaps](https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html) at the documentation site.<jupyter_code># instead of tab20, try: hsv, jet, your choice of others
cs = iter(plt.cm.tab20(np.linspace(0, 1, 16))) # snip a canned strip into "paint samples"
fig, axarr = plt.subplots(4,4, figsize=(4,4), facecolor='black')
make_squares(axarr, 'xkcd:burnt sienna' ) # we'll be replacing the burnt siennna, but go ahead
all_axes = axarr.ravel()
[axi.set_facecolor(next(cs)) for axi in all_axes];  # applying snipped paint samples<jupyter_output><empty_output><jupyter_text>Research Project:  Looking BackSince we're on the topic of arithmetic (one of the "three Rs") in more than one base, lets take a more zoomed out view, while we celebrate Euler in particular.  Why not?<jupyter_code>YouTubeVideo("OmJ-4B-mS-Y")
YouTubeVideo("JAr512hLsEU")
YouTubeVideo("d-o3eB9sfls")<jupyter_output><empty_output><jupyter_text>In the School of Yesterday, 2nd and 3rd powering were inevitably associated with squares and cubes respectively. As you learned in [Martian Math](https://github.com/4dsolutions/MartianMath/blob/master/mm1.ipynb), we have a choice to introduce a different paradigm.  Below are models of 3rd and 2nd powering respectively, or of any $A * B * C$ or $A * B$.See ["Dimension" in Synergetics](https://goo.gl/zoVYF1) (Google Slides)    ASYLUM CITYThe Oregon Curriculum Network was headquartered in what many of us informally called the Asylum District.  That's because Oregon's first state mental hospital was nearby and staffed by one Dr. Hawthorne, for which <NAME> is named.The meaning of asylum includes "sanctuary" as in the science fiction movie [Logan's Run](https://mybizmo.blogspot.com/2016/09/logans-run-movie-review.html).<jupyter_code>YouTubeVideo("nHDaRPQ8aiM")       # https://youtu.be/nHDaRPQ8aiM<jupyter_output><empty_output><jupyter_text>What might not be clear from the above video is [*Descartes' Secret Notebook*](https://books.google.com/books?id=1QOfp07QS-0C) suggests that V + F == E + 2, attributed to Euler, was actually known to Descartes.  But he was afraid to publish.  Instead, he encrypted his notebooks.  Leibniz found these notebooks, the story goes, and decrypted what he was permitted to see.  But then his notes were lost...  A twisted tale.<jupyter_code>YouTubeVideo("FOU5j-Qtsxs") # https://youtu.be/FOU5j-Qtsxs<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11656499296105115, 'fraction_numerical': 0.03031440638198029, 'mean_word_length': 5.350417163289631, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 47, 'https://': 15, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '384605', 'license': 'MIT', 'n_tokens_mistral': 3725, 'n_tokens_neox': 3426, 'n_words': 1228, 'path': 'arithmetic_of_tomorrow.ipynb', 'repo_name': '4dsolutions/School_of_Tomorrow', 'size': '10680'}