Tuesday, February 02, 2016

Using JS on Arduino (Part 1)

Using Javascript to control an arduino seems far fetched but there is this great library call Johnny Five which allows you to control an arduino (or many other boards see http://johnny-five.io/platform-support .

In this article we will go over how to set up using your Arduino with javascript.

The first step should be loading the Arduino application on your computer and running the blink app. This is the "Hello World" for Arduinos and should tell you if your micro controller is working.  See the picture to find where it is.
After running the blink sketch then install Node version 4.2.1 if you haven't already. You can find it here https://nodejs.org/en/blog/release/v4.2.1/ . Then install yeoman at by doing 
npm install -g yo and johnny-five generator by executing in a terminal 
npm install -g generator-johnny-five .  

Finally create the scaffolding to your project doing 
mkdir 
cd 
yo johnny-five
Then follow the generator and do node index.js
to test out if everything is working on the javascript side. A good resource for examples is the johnny-five website at http://johnny-five.io

Saturday, August 20, 2011

A simple introduction to topological quantum computation Part 1

Introduction and Big Pictures

Ever wonder about why knot theory is related to quantum theory? Ever wonder why your shoes tie the way they do but they still become undone? Ever wonder why you don't have a significant other? Well we will try to answer the first two questions but the third is beyond the scope of this post.  (The third is beyond the scope of the author at times....) Remember that computer science is based upon the idea of being effectively computable. That means that I can perform a set of steps (hereafter referred to an algorithm) in an reasonable amount of time. (The Church-Turing thesis). Quantum computers extend this and we will get into why they do in a little bit after preliminaries. The reason why you would want to study quantum computation is that certain algorithms have been proven to work much faster! We will get into how much faster and it really depends on the algorithm. The way that a quantum computer scales is much different than a classical one. The big picture of topological quantum computation is to do computation with topological states of matter. Now the question is what are those topological states. But first we need to know what topological states mean. Or even what topology is. Topology is similar to the study of geometry except for a few modifications. In geometry you study shapes. In topology you study things that are preserved under a continuous deformation. For example a topologist can't tell the difference between a coffee cup and a bagel! (pardon for the old joke).  

The reason is that they both have one hole or in other words they have the same genus.

Definition of a Knot

To first start off we must answer two questions. What are knots? The other is what are quantum computers? We can't answer both at the same time so lets start with the more visual question which is "What are knots? When people encounter knots they usually want to either undo the knot When you take out anything with a cord (such as headphones) and you didn't put the cord away correctly you encounter a knot. When you want to tie a boat to a pier to a boat you also have a knot(or even a knot to a pier but hey its up to isomorphism). A knot to a mathematician is a closed loop not an open one. What we think of knots  that we tie up with  are actually braids. There are many types of knots but the most common one is the unknot. The unknot is the same as a circle. Two examples of very common knots are below.   Exercises Can you unknot a closed loop with crossings? If you took your shoelace when it is knotted and melted both ends together to form a closed loop could you untie the shoelace?  (Try this in real life and see what happens)

Models of computation

Lets start on how quantum computers work. There are three models of computation that build upon each other. The deterministic model, the probabilistic model and finally the quantum model. The deterministic model can be understood through an elevator. Imagine there are a set of elevators. The elements of the elevators have buttons on each floor. One way to look at this is to create a matrix which describes where each elevator can go and a column vector describing where the elevators are currently. Therefore the state of the elevators can be described as a column matrix and the transitions of each elevators can be described as a n by n matrix. An example of this is to the the matrix below

.

The state of the elevators can be described by the matrix below 

 

 

Exercises. Create your own elevator system and see how it behaves. Extend the deterministic elevator system into a probabilistic model that follows these rules and attempt to compute the state of the system. After that replace the probababilities with complex numbers and see what happens. That is it for now! Good luck! :-)

 

Citations

 An Introduction to Quantum Computing. Noson S. Yanofskyphysics.quant-ph.

Yang--Baxterizations, Universal Quantum Gates and Hamiltonians. Yong Zhang (ITP, CAS), Louis H. Kauffman (Illinois, Chicago), Mo-Lin Ge (Nankai).Quant. Inf. Proc. 4 (2005) 159-197. physics.quant-ph (physics.hep-th physics.math-ph).

Posted via email from The blog of a salty schemer.

Friday, September 26, 2008

LeftParen


This seems to be an interesting new framework which uses some libraries from PLaneT.

According to the website

Features

Automatic creation of the basic directory structure of your project
A "Hello, World" with zero lines of code
Simple data persistance storage through the "record" abstraction
No databases or schemas
Session and cookie support
User accounts and authentication out-of-the-box
Easy form creation
Simple URL mappings (like Rails' routes)

Documentation is sort of lacking and I am currently figuring it out.
The website for the framework is at http://blog.leftparen.com/

Wednesday, January 23, 2008


Mashing up
Here is something that I did in yahoo pipes. It shows how that using a query from the user you can search multiple websites. It accomplishes this by sending a query to a few torrent search engines (mininova, isohunt, btjunkie, sumotorrent). This is accomplished by the URL builder module for each website. Then it fetches the RSS feed from all of those websites and puts them into a combined RSS feed (Fetch Feed Module) . The last two things that it does is it filters all of the unique RSS feeds and then sorts them by item.pubdate so that the latest torrents are found first in the pipe. 

Monday, December 10, 2007

Book of Poems Up On Lulu

My poetry book Dabru Emet is online at lulu. I used LaTeX to typeset the inside. Also, Emacs + AucTeX was my development environment It is available in digital and dead tree formats. From the text

The scheme

For when I found the holy lisp
So pure the curves that are parens
With a report merely one short text
Of beauty's simplicty

I knew that lisp was for me
But then there was a choice
Of thousand page lisp's
That is when I prayed for mercy

My goddess answered my call
With the flowers of recursion
And the lexical wildflower of scope
All around the syntax tree

I heard "Scheme shall show you the path
To beauty through simplicity
Not a thousand page tower of babel
But merely the essential fraction"

And I rejoiced and heeded her call
Found the purple tome of wizard's
The structure of the spells
And their interpretation

My eyes have been opened
To the spells of functions
And the beauty that lies
In the scheme that is

Blogged with Flock

Saturday, July 07, 2007

Register To Vote for R6RS and R5.97RS.

Currently there is a vote for the ratification of R6RS. To vote you have to register with the draft committee. This involves giving your information and a short paragraph on your interest in R6RS. Also the final draft of R6RS is out.

Saturday, May 26, 2007

Working Through SICP

Currently I am reading SICP. It is a great book as an introduction to computer science and programming with scheme. Right now I am about on the second chapter and have completed most of the exercises. It is really lots of fun doing the exercises and eventually getting the exercises done right.