CyberSpy

Rantings from a guy with way too much free time
The soundcloud player can not be loaded with disabled JavaScript.
The following title is embedded here:
https://soundcloud.com/user-338167339/bach

Julio Salvador Sagreras

2017-11-28 music guitar Rob Baruch
Études Someone once asked… How do you get to Carnegie Hall? Practice! Practice! Practice! Well, I think the Amtrak is a better way for me to get there at this point in my life! I’ve decided to spend time recording Sagreras etudes as I’m on a push to finish Book II and start Book III by March of 2018. Stay tuned for

Recursion Revisited

Recursion, from more than one point-of-view.

A common programming idiom in computer science is solving a problem by self-reference, also known as recursion. In this post, we look at two different implementations of the same problem.

Solve a recursive problem in two different programming language paradigms

Let’s look at the solution to a simple problem, compute $f(x)=e^{x}$.

We will illustrate two separate solutions - one in a procedural language (python), and the other in a functional language (elixir).

Let’s start off with the functional language. Were does recursion come into play?

We define the function $f(x)=e^x$ as the infinite sum, $\text{ }f(x) = \sum_{n=0}^\infty{\frac{x^n}{n!}}$

In our solution below, we define two separate recursive functions, exp/2 and fac/1. What’s interesting to note here is how each of these functions has two separate definitions. This is an aspect of programming in elixir that elegantly uses pattern-matching to return different results depending upon the input. Our two functions nicely dovetail into the base-case and recursive case of a recursive algorithm.

For example, looking at exp/2, the first function definition returns 1 for any value of x (as indicated by the _ preceding the variable) and returns 1. This is the mathematical equivalent of $x^0=1\text{ for any }x$.

The second definition of exp/2 is the recursive case. for any value of $n\gt0$. Moreover, we define exp(x, n) as $\frac{e^x}{n!}$ + exp(x, n-1).

Similarly for the definition of fac/1 we see two definitions; one for $n=0$ and another for all values of $n\gt0$.

Continue reading
The YouTube player can not be loaded with disabled JavaScript.
The following video is embedded here:
https://youtube.com/watch?v=5woVpVF0Bzs

Great Tonne!

2017-11-21 Video music guitar
This dude can rock the classical guitar with a ton of attitude (and four extra strings)! Check out Estas Tonne, a classical guitar player that inspires all of us would-be bad-ass guitar players, acoustic or classical. If you liked that, you’ll love this!
The YouTube player can not be loaded with disabled JavaScript.
The following video is embedded here:
https://youtube.com/watch?v=9Kr96p3TXvw

Lets Get Together

2017-11-21 Video music guitar
A favorite from Rev. Gary Davis! Here’s a video of me playing Let’s Get Together on guitar - made over three years ago. I thought I’d see what the video looks like here ony Cyberspy. I may have to make more recordings and put them on the blog when I’m not busy writing code. -- more to come!

Brew up some Elixir recursion

2017-11-17 programming
Recursion is recursion is recursion is recursion…. So how hard is it to go back to a programming language that you haven’t used for months that you only used for less than a year? Well, it took me a few more minutes than I anticipated, but in the end, I was succesful! Tonight, I thought I’d take the simple idea of creating Pascal’s Triangle. A simple construction that creates a table of binomial coefficients for the binomial $(x+y)^n = x^4+4x^3y+6x^2y^2+4xy^3+y^4$. Continue reading

Visualizing the News: Grab your PILlow

2017-11-12 python programming
A Picture’s Worth a Gazillion Bits newsapi This weekend, I tripped over a neat news REST-ful api called newsapi. Grab an API key and you’re off to the races. There are tons of live headlines - News API can provide headlines from 70 worldwide sources. There are basically two api endpoints: GET https://newsapi.org/v1/articles GET https://newsapi.org/v1/sources Register for an account and generate an api-key and let’s get started. Accessing the API with Python newsapi can easily be accessed using a browser since the REST-ful method used is a GET method. Continue reading

Making Heads or Tails out of Recursion and Combinatorial Math

2017-11-09 programming math python
GNU — GNU’s Not Unix I thought I’d take a look at two topics at once and make some fun by mashing them together. Today’s topic is recursion. In computer science (and in math, although we call the equation a recurrence relation) recursion is an often misunderstood concept causing lots of panic and anxiety. In reality - it’s pretty easy once you wrap you head around the idiom. What is recursion? Continue reading
Older posts Newer posts