# Frenetic Array

## A canvas for logic and imagination.

I was always curious as to what my heart rate would be during an exam, so I decided to test it. Armed with my Apple Watch and a two-hour Differential Equations (DiffEq) final, I tested it.

Here are the results (click to enlarge).

There were four major milestones to bring out.

• Start Exam Well, I start the exam.
• Through Exam I don't generally do entire problems at once, but find a good stopping point, move on, and come back to double check everything.
• Finish Exam I finished all the problems.
• First Review I generally review twice, and this is where I finished the first review.
• Leave Exam I Finished the second review and I'm going back to bed.

The interesting parts were the spikes, and those were generally problems I was either stumped on, or had hoped they would not be on the exam.

The graph was produced via matplotlib. You can find the source code below.

#!/usr/local/bin/python3
#
# plot.py
# Desktop
#
# Created by Illya Starikov on 05/16/17.
#

import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime

import csv

def import_from_csv(filename):
with open(filename, "rt") as csvfile:

date_times = []
values = []

for date_and_time_string, value in csv_parsor:
datetime_object = datetime.strptime(date_and_time_string, '%Y-%m-%d %H:%M:%S')

date_times += [datetime_object]
values += [value]

return (date_times, values)

def main():
# Get the data and the subplots
x, y = import_from_csv('data.csv')
fig, ax = plt.subplots()

# Make the figure wide and draw it
fig.set_size_inches((12, 5))
ax.plot_date(x, y, color='r', marker='x', markersize=6)

# Custom labels, since I have milestones
labels = ["Start Exam", "", "10:15", "", "Through Exam", "10:45", "11:00", "Finish Exam", "", "11:30", "First Review", "Leave Exam", "12:00", "12:15"]

locs = [
mdates.date2num(datetime(2017, 5, 10, 10, 00)),
mdates.date2num(datetime(2017, 5, 10, 10, 00)),
mdates.date2num(datetime(2017, 5, 10, 10, 15)),
mdates.date2num(datetime(2017, 5, 10, 10, 30)),
mdates.date2num(datetime(2017, 5, 10, 10, 30)),
mdates.date2num(datetime(2017, 5, 10, 10, 45)),
mdates.date2num(datetime(2017, 5, 10, 11, 00)),
mdates.date2num(datetime(2017, 5, 10, 11, 13)),
mdates.date2num(datetime(2017, 5, 10, 11, 15)),
mdates.date2num(datetime(2017, 5, 10, 11, 30)),
mdates.date2num(datetime(2017, 5, 10, 11, 35)),
mdates.date2num(datetime(2017, 5, 10, 11, 45)),
mdates.date2num(datetime(2017, 5, 10, 11, 48)),
mdates.date2num(datetime(2017, 5, 10, 12, 00)),
]

# Assign the data, change fonts to Bebas Neue, make titles and labels
ax.set_xticklabels(labels, fontname="Bebas Neue")
ax.set_yticklabels([int(i) for i in ax.get_yticks()], fontname="Bebas Neue")
ax.set_xticks(locs)

ax.set_title("Heart Rate vs. DiffEq Exam", fontsize=22, fontname="Bebas Neue")
ax.set_ylabel("Heart Rate (BPM)", fontsize=14, fontname="Bebas Neue")
ax.set_xlabel("Time", fontsize=14, fontname="Bebas Neue")

# Make nicer x axis
plt.gcf().autofmt_xdate()

# Export that shit
ax.grid()
plt.draw()
plt.savefig("figure.png", format='png', dpi=280)

if __name__ == "__main__":
main()


I recently gave a lecture over C++11 and C++14 to an introductory programming course. This briefly covers auto, lambda expressions, constexprs, and the default and deleted keywords. My lecture notes can be found here (alternatively, under projects).

Since reading about its faults in The Not So Short Introduction to LaTeX (highly recommended read), I have avidly stayed away form eqnarray. However, I feel as if the book didn’t covey the ideas as well as it should; also, it suggestion was IEEEeqnarray, apposed to the classically recommended align. This article on TeX User Groups conveys ideas more eloquently and provides better alternatives.

The most frustrating thing about compiling LaTeX in a terminal is the wall of text that gets written to stdout. An easy solution would be piping to dev/null; except then you wouldn’t be able to get error messages (even if only pipe stdout to dev/null and keep stderr). So, I made a solution that handles the compiling by piping error messages to less. The syntax of latexerr FILENAME will compile the files. Passing --clean will delete temporary LaTeX files.

#!/bin/bash
# USAGE: ./script FILE --clean --glossary

extensions_to_delete=(gz fls fdb_latexmk blg bbl log aux out nav toc snm glg glo xdy)

compile_and_open() {
argument="$1" auxname="${argument%.tex}.aux"
errors=$(pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$argument" | grep ".*:[0-9]*:.*")

if [[ -n $errors ]]; then echo "$1 Errors Detected"
echo "$errors" | less else open_file$1
echo "$1 Compile Successful" fi } open_file() { filename=echo "$1" | cut -d'.' -f1
open "$filename.pdf" echo "$filename Opened"
}

# http://tex.stackexchange.com/questions/6845/compile-latex-with-bibtex-and-glossaries
glossary() {
compile $1 makeglossaries$1
compile $1 compile$1
}

clean() {
for file in $(dirname$1)/*; do
filename=$(basename "$file")
extension="${filename##*.}" filename="${filename%.*}"

for bad_extensions in "${extensions_to_delete[@]}" ; do if [[$bad_extensions = $extension ]]; then rm$file
echo "$file Deleted" fi done done } main() { compile_and_open$1

if [ "$3" = "--glossary" ]; then glossary$1
fi

if [ "$2" = "--clean" ]; then clean$1
fi

}

main "\$@"


Updated version(s) will be posted here.

For a particular class, I had to write a paper titled "Something that would considered morally impermissible in 22nd century". Immediately, I thought of self driving cars. Although it's wasn't a particular well written paper, it does make a good case for self driving cars.

As of the time of this writing, there are currently approximately 30,000 deaths due to cars in the United States. To put said number is perspective, one is more likely to be in a fatal vehicular accident than be a victim of homicide, overdose from heroine, or be injured from an intentional fire. Even worse, those three statistics combined cause more deaths, per year, than a vehicle does. These deaths aren't at the fault of mechanical error, animal intervention, or even dangerous weather conditions: they are caused by humans. Approximately 94% of traffic accidents are primarily caused by humans. This begs the question, how much safer can an algorithmic, non-self aware autonomous vehicle be, compared to a human?

Because self driving cars are in their infancy (with Carnegie Mellon having the first record of self-driving technology dating back to 1984), it would seem to be almost unfair to compare such a computer to a human driver; or so it would seem. Although humans had a century head start, car projects have already proven to be sufficiently better drivers. Google’s well known self-driving car project (and their PR department) can attest to such a claim:

"We just got rear-ended again yesterday while stopped at a stoplight in Mountain View. That's two incidents just in the last week where a driver rear-ended us while we were completely stopped at a light! So that brings the tally to 13 minor fender-benders in more than 1.8 million miles of autonomous and manual driving — and still, not once was the self-driving car the cause of the accident." Jacquelyn Miller, Google Spokeswoman

Google is not the only company who is interested; Tesla’s autopilot software is expected to be fully autonomous (and commercially available) come 2017. Along with Google and Tesla, BMW, Mercedes Benz, and Ford have made public claims to be working on self driving car capabilities. There is no dispute; self driving cars will be radically safer in comparison to human drivers, and they will be available soon. Assuming the standard S-curve technological adoption, price to significantly drop, and luddite-esque apposition, the adoption should be mainstream within fifty years at most. Now, what about a hundred years?

Within a hundred years, self driving cars should be illegal; this is not a moral dilemma, this is a "saving over 3000 lives a day" solution. Every time a person gets in a car and chooses to drive and causes an accident, that person chose to cause the accidents. It would come to no surprise that people from the 22nd century that would look at the 21st century driving as "barbaric". When strictly looking at the statistics and the logical arguments, driving in the 22nd century would not only be morally impermissible, it would be illegal.