Saturday, July 24, 2010

Linked list knitting

Bit of an odd project to talk about today (also, if you know me on facebook you may have seen this already.
The idea is to implement a system of knitting using linked lists. There have been quite a few recent experiments into knitting with unusual media, whether it's carrier bags, wire, human hair, or even fibre-optic cable -- you can knit with just about anything which can be made into threads. You could think of this as a really extreme version of this -- a linked list is essentially a thread of data, so why not knit with this? (Or you could see it as just a terrible pun being taken too far, which is probably more accurate.)
So here I've designed a system of knitting using these lists, and implemented it in C.

So, linked list is a data structure in which each data point contains the address for the next piece of data, so to read it all you start at one point and move along the chain following the addresses. I'll actually be using doubly-linked lists -- for these each data point contains two references, which means the chain can self-intersect.

To come up with a system of knitting using these lists, we need to be able to form loops, and to pass loops through each other. This can be done as follows:


This is really all you need to start knitting -- forming a loop corresponds to casting on, we know how to knit into a stitch, and we can cast off by simply threading the 'yarn' through the stitch without forming a loop.
It would also be possible to give analogues for many other knitting concepts -- you can purl by reversing the orientation when you knit, you could Kfb by passing two loops through the stitch, Make by simply forming a new loop in between stitches, K2tog by passing the new loop through two previous stitches, and so on.

So I thought it would be fun to actually implement this, and you can see the results here:
llknitting.c
tensionsquare.c
ribbedcuff.c
linkedlist.h
The first file contains the details of the implementation, the second is a set of instructions for knitting a small stocking stitch swatch, and the the third gives a 2*1 ribbed cuff knit in the round -- hopefully you will be able to see how these correspond to a real knitting pattern. (The final file is the header) If you're using linux you can compile these with the commands:
gcc tensionsq.c llknitting.c
Or:
gcc ribbedcuff.c llknitting.c
I'm not too sure what the equivalent command would be in Windows.
The output from each program gives the positions of the start of each stitch in the array, which isn't terribly illuminating, but hopefully convinces you that it's actually doing something. (I decided not to worry too much about outputting data since it's really the program which is the interesting part.)

So there you go -- that's how to knit with linked lists. If, for some reason, you wanted to do that. So, linked list crochet?

Happy knitting, and/or data structuring!
Hugh.

Friday, July 16, 2010

Aromantic comedy

Hey folks!
Lots of finished stuff still to post, but am excited about a project I'm planning just now, so I want to talk about that.

So, 'aromantic' is a term used in asexual circles to describe people who find they are not attracted towards romantic relationships of any kind. The theory goes that while a person can be not attracted towards any sexual relationship (asexual), they are often attracted to romantic, non-sexual relationships of various kinds, so 'aromantic' is a sub-classification of people who also aren't interested in this.

And benzene. Benzene is an organic molecule made up of six carbon atoms forming a ring, each attached to a hydrogen atom. An early proposed structure for this molecule had alternating single and double bonds between the carbon atoms:


This has the right number of bonds, so it would make sense, but X-ray diffraction observations show that all of the bond lengths were identical, which rules out this possibility.
In fact, rather than forming pairwise bonds between atoms, the valence electrons form a more complicated orbital between all the atoms, forming a de-localised electron ring, denoted by:


So, it's a pretty awesome molecule. And organic molecules which include a benzene ring, such as phenol and TNT, are referred to as 'aromatic'... you can probably see where this is going.

So naturally I want to combine the two things. The plan is to make a hat design based on the symbol for a benzene ring, but with the central ring replaced by a heart shape. There will probably be six smaller hearts around the edge, where the hydrogen atoms would be, too.
Practically, this will be a more elaborate version of the radial heart-hat I made a while back, although it will take some fiddly modifying to make it work out.

It's going to be *awesome*.
Hugh :o)

Monday, July 12, 2010

Juliana Hearts



Hey folks, I thought I'd posted this a while back, but seem to have forgotten to mention it here.

Last year, a friend from my knitting group, Juliana, died following a long wait for a heart transplant. We wanted to do something to remember her, and came up with this plan -- to knit a collection of little stuffed hearts and give them away as gifts to people. There are really two reasons for this:
First, I'm certain that Juliana wouldn't want people to be sad because of her, regardless of the circumstances. I think it's really a fitting tribute to her to give these gifts away, (hopefully) to bring some happiness to as many people as possible.
Second, we hope that by doing this we can raise awareness of organ donation. I really hadn't thought about organ donation until Juliana became ill, I'd always just put it off. So I really want to encourage people to think about it, to make a definite decision. I'd also encourage people (donors or not) to read the stories on the Legacy of Life website, they do a great job of showing the positive side of organ donation.

So, that's the project.
I've made quite a few of these hearts now, and they're mostly pictured here. I've also written up the pattern for the hearts, which is available as a free Ravelry download, in case anyone would like to make some for themselves.

If I can give you a heart, let me know! As I say, the aim is to give them as widely as possible, so this is really open to everyone. You don't have to be an organ donor, and you don't have to be not-an-organ-donor either, it's all about spreading the happiness.
I also have a bunch of the books from Legacy of Life, which have some really amazing stories and I would totally recommend, so if I can give you one of those let me know too.
And of course, do think about whether you would want to be an organ donor. Then tell people! Preferably your next of kin!

*Also*, how amazing is it that organ transplants are possible? Go Science!

Hugh.

Friday, July 9, 2010

Geoemtric Knitting II ... somewhat belatedly

Hi folks, I've just realised how long it's been since I've posted anything here, and I have a whole bunch of stuff waiting!

A few weeks (well, months) ago, I gave a talk in our PG Colloquium series on the subject of geometry and knitting. The idea was to show off a few mathematical knitting projects I've been playing with, and use them to illustrate some maths.
I'll write about the projects individually later, but in the meantime you can read the slides here:
Slides (pdf)

A couple of the projects used computer programs to calculate the patterns, based on inputted parameters. These programs are written in Ruby, and if you'd like to give them a try they can be found here:
Universal cover scarf
Cellular automata shawl
Hopefully their operation should be pretty clear, and is explained in more detail in the slides. If anyone's interested in knitting from these I'd be delighted to give some tips!

Also, thanks again to my Glamorous Assistant Pamela!

Also also, the Juliana hearts project is still ongoing, and open to all, so if I can send you one let me know. (Hmm, have I really not posted about that here before? More on that to follow then.)

Happy knitting, and more posts soon,
Hugh.

Monday, March 29, 2010

Hyperbolic crochet book


Hey folks, I just got sent a link to this book. I only know what I've read from the description there, but it seems pretty cool. The aim is to explain mathematical and geometrical concepts through crochet, to give a new hands-on perspective on what are usually quite abstract ideas. So yeah, I'm very happy to see crochet being used as a way to promote maths and make it more accessible to a wider audience!
I also think it's awesome that it's reviewed by Dr. Hinke Osinga :o)

Happy knitting, and/or reading!
Hugh.

Wednesday, March 24, 2010

Ada Lovelace Day!


Hey folks, it's Ada Lovelace Day again! (Their website seems to be down at the moment, Google has a cached version).
Ada Lovelace Day is a day to celebrate and promote the achievements of women in science and technology, by writing a blog post about a woman working in a scientific or techie field you find inspirational.

So, I'd like to talk about Kate Ho. Kate is originally a computer scientist, and is currently a PhD student working in the sociology of computer systems, in between starting up companies and enterprises.

Specifically, Kate studies "requirements engineering", the process of figuring out what an organisation really *wants* from their computer systems, and how to build the system to provide this. This matches Kate's vision for computer science pretty well -- not just technology for technology's sake, but technology fitted to people's needs, making a real difference to how they get things done.

Kate's other main passion is entrepreneuring. She is constantly looking for new business opportunities, and while I've known her has usually been involved in at least 3 start-ups at any given moment. Now that her thesis is submitted, she has had the chance to move into entrepreneuring full-time and has started Interface3, a company specialising in developing multi-touch surface systems.
Again, her aim in this is to find new applications for technology, to find new ways in which it can improve people's lives, and to make them a reality. I think this is what she is really passionate about -- trying to work out ways in which technology can change the world.

She does lots of other awesome stuff too -- she set up Edinburgh University's Hoppers group, and helps organise Edinburgh's Girl Geek dinners, not to mention running Scottish Women's Rugby. She also knits!

So, Kate -- social entrepreneur, innovator, geek, knitter!

Happy Ada Lovelace day, everyone!
Hugh.

Monday, March 15, 2010

More on Cellular Automata

Hi again!
So, ages ago I talked about the possibility of using cellular automata to generate lace patterns. A key step in this is to interpret the cellular automaton as a collection of rules for interactions between chains of digits, travelling left or right, or remaining stationary.
On closer inspection it turns out this is rather more complicated than I'd expected. The problem is that these interpretations can be influenced by neighbouring digits, so:
001
-1-

looks like it should to be a left-travelling chain, but if the neighbouring digits are:
0010
0110

then we need to see this as a chain bifurcating into left-travelling and stationary chains. Worse, if it was
00110
01100

we would probably want to see this as two left-travelling chains running alongside each other.
Because of these problems, I think it is impossible to interpret general cellular automata as chains in this way -- what's needed is a non-local approach. What can be done is to come up with a procedure to read through the pattern and divide each of the `1' digits into chains travelling left, right, or remaining stationary (and some `orphan' digits left by themselves). This is then fairly straightforward to convert into a lace pattern.
I feel this is cheating a bit, it's not really in the spirit of cellular automata and there are a lot of arbitrary decisions to be made. There are further complexities I haven't dealt with -- how do you deal with chains bifurcating? Or colliding? So far my chains are just left hanging.

Still, it generates some very nice patterns with some interesting features. Mostly though I'm just enjoying the idea of computer-generated lace, there's something magical about putting in a set of logical rules and generating a pattern.
So, applying this to rule 30, generating the pattern starting from a single `1', I get something like this:


(not sure how that'll turn out, but it's just to give an impression)

So, this turns out to be rather more complicated than I'd expected, and very much less canonical than I'd hoped. It does produce viable patterns though, and makes me rather keen to try to elaborate this method.

Pictures of the finished shawl soon!
Hugh.