Sunday, 15 September 2013

A playlist of short intro to LaTeX videos using the cloud based writeLaTeX.com

I've just finished screencasting, editing and uploading 21 videos to a playlist on +YouTube.

Quite frankly I'm exhausted (I started this morning), it's been a long day and I'll be happy to not have to drag another 'Ken Burns' effect boundary box around for quite a while...

Anyway, the videos are for a new course I'm teaching our +Cardiff University first year undergraduates. LaTeX has never actually been on the curriculum before and I'm throwing it in at the end of a long term (where students will mostly be learning Python and +Sage Mathematical Software System).

There are a bunch of really really great LaTeX tutorials all over the web but I thought I'd put together really short videos (the longest is around the 4 minute mark but all the others are less than 2 minutes) that just show syntax. By watching these videos no one will be a LaTeX expert (that's where the other tutorials come in).

The other particularity of these videos is that I've done them entirely using +writeLaTeX (https://www.writelatex.com/) which is a great cloud based LaTeX environment. If you don't know about writeLaTeX take a look at this great video by +John Hammersley (1 of the guys behind +writeLaTeX):


The great advantage of writeLaTeX is that I can include 2 links in the description of every video I've put together:

1. A link that creates a blank document so that anyone watching my video can right then and there try out the code.
2. A 'read only' link to the actual document I used during the video. Once this document is being viewed anyone can choose to make a copy of it so that they can play with the actual finished article.

For example: here's the video showing how to include inline mathematics:


1. Here's the link to a blank document.
2. Here's the link to the code created in the video. On the top right of that document you should see this link (which allows you to create your own copy that you can edit):


I'm hoping this will all be quite helpful to my students and in particular encourage the use of LaTeX by removing certain difficulties that some have with the installation process.

I'm also making these videos public in case they might be helpful to others (a large chunk of the videos I've put together for the programming aspects of this course are 'Unlisted' as I don't think they'd interest anyone).

Anyway the whole playlist can be found here.

There are a couple of other cloud based LaTeX environments out there (sorry for mentioning them here +John Hammersley!) including the 1 that is a part of the ridiculously awesome https://cloud.sagemath.com/. At the moment though, the user friendliness and amazing response to users (on G+ +writeLaTeX are extremely helpful) makes this an ideal tool for learning LaTeX.

Saturday, 14 September 2013

For no reason whatsoever: animated gifs of random matrices

Here are some animated gifs of random matrices done in Sage:




Here's a smaller 10 by 10 matrix (the above are 500 by 500) which probably needs to come with a health warning:



The code to do this using Sage is pretty easy (it makes use of the plot method on matrices):


import os

size = 500
nbrofmatrices = 100

for i in range(nbrofmatrices):
    print "Ploting matrix: %i of %s" % (i + 1, nbrofmatrices)
    A = random_matrix(RR,size)
    p = A.plot(cmap='hsv')
    p.save('./plots/%.3d.png' % i)

print "Converting plots to gif"
os.system("convert -loop 0 ./plots/*png %sanimatedmatricesofsize%s.gif" % (nbrofmatrices, size))

Each of the three above gifs were made using different colour maps: (ie changing the cmap option).

This creates 100 random 500 by 500 matrices and uses imagemagik (that's a link to a blog post I wrote about creating these) to create an animated gif.


Monday, 9 September 2013

Handling data files in a Sage notebook (and some linear regression in Sage)

One of my most viewed videos on +YouTube is the following (briefly demonstrating how to import csv files in to +python):



I'm in the middle of preparing various teaching materials for an upcoming class on coding for mathematicians. I'm teaching this class in a flipped classroom (if you don't know what that is circle +Robert Talbert on G+ who posts a lot of great stuff about it) and as a result I've been screen casting a lot recently. Some of these clips are solely intended for my students (as I don't believe they'd be of interest to anyone else 'to do this exercise try and think about what your base case would be for the recursion to terminate'). I'm just starting to screen cast for the +Sage Mathematical Software System part of the course and needed to put together a little something as to how to import data in to a Sage notebook. As the above video seemed quite helpful to people I thought I'd put together another one that might be helpful.



The data file used can be found here.

Here are the lines of code used in the notebook:

import csv

f = open(DATA + 'reg', 'r')  # Open the data file using the special DATA variable
data = csv.reader(f)
data = [row for row in data]  # Read data using csv library
f.close()

data = [[row[2], row[1]] for row in data[1:]]  # Only use data that is of interest, remove unwanted columns and 1st row

a, b = var('a, b')  # Declare symbolic variables
model(t) = a * t + b  # Define model

fit = find_fit(data, model, solution_dict=True)  # Find fit of model to data

model.subs(fit)  # View the model

p = plot(model.subs(fit), 5, 11, color='red')  # Plot fit
p += list_plot(data)  # Plot data
p

Examples of computer assisted mathematics needed.

This blog post is a very slight expansion of this G+ post where I've asked people for example of computer assisted mathematics. I'm posting here in the hope of maximum exposure.

I'm in the middle of preparing a new course that will be teaching +Python and +Sage Mathematical Software System to our first year undegraduates at Cardiff university. As such I'd appreciate as many great example as I can get so please do let me know of anything :)

I use the term mathematics in a loose sense to include 'things' that are not necessarily proofs:

- identifying conjectures;
- visualisations;
- etc

I'm familiar with the 'well known' results that can be found on this +Wikipedia page: http://goo.gl/EjyKel

I can also recommend the book 'A=B' by  Petkovsek, Wilf and Zeilberger which you can download here: http://www.math.upenn.edu/~wilf/AeqB.

The search for prime numbers is also a pretty cool thing that I can talk about.

Even some example of things that have an obvious need of computers would be great to hear about. For example I'm quite familiar with discrete event simulation techniques that I'll be mentioning to the students. Here's a video I put together a while back showing how to use a computer to simulate a queue:


Thursday, 5 September 2013

Creating a slideshow video with YouTube in 4 + 1 ridiculously easy steps.

I've been taking photos on my way to work quite regularly of the construction of a new building by Cardiff University: http://goo.gl/k9qYN. I've been posting them on G+ which has been nice as you can click through and see all the photos and click through to see the progression of the building: http://goo.gl/CnFGd1.

However, now that I've stopped taking the pictures (the building is open) I thought I'd try and put together a video slideshow. 

My immediate thought was to see if the YouTube video editor would allow me to do this: it does and it's really easy!

1. Click on 'Upload' on YouTube which brings up the screen below. From there click on 'Photo slideshow':

2. Either upload photos (I guess) or go straight to your G+ albums. You can see in the screenshot that my 'Cardiff University Maindy Park Construction' is right there:


3. The photos come up right there and you can change the order if need be:


4. You can then mess with some settings and include some music:


5. That's pretty much it but you can click on 'Advanced editor' which brings up the usual video editor that you can use to add annotations and stuff to the video.


Here's the video I put together:



I really like how all these tools talk to each other. As the photos I take go straight to my G+ account anyway through instant backup I might well do a couple more of these which I could always make 'unlisted' if I don't think they're of public interest so that it's easy to share with friends and family.

Tuesday, 20 August 2013

A very brief and shallow analysis of the funniest jokes.

The Edinburgh Fringe Festival takes place every year and according to Wikipedia "is the world's largest arts festival, with the 2012 event spanning 25 days totalling over 2,695 shows from 47 countries in 279 venues". Every year at the festival there is a competition for the funniest one line joke. The winner for 2013 was this joke by Rob Auton:
"I hear a rumour that Cadbury is bringing out an oriental chocolate bar. Could be a Chinese Wispa"
You can see all the top 10s over the past year here:
I've spent an hour or so this evening grabbing all the jokes and doing some very basic analysis of them in Python. The full github repo with all the code (and the data set) can be found here.

Shorter jokes are better

The mean length of the jokes are 88 characters and 17 words. Taking a look at the distribution of the word counts we see that quite a large proportion of the jokes have between 10 and 15 words in them even though there are some jokes that are twice as long.



This does not necessarily imply anything but if we take a look at the rank of a joke against the number of words we see (a very slight) trend towards an affirmation of the fact that shorter jokes rank better:


Joking often does not necessarily help

There are certain comedians who has more than 1 joke in the list of top tens (this does not necessarily imply that they were joking at multiple festivals as some comedians had multiple jokes ni the top 10 of a given year). If we look at the mean and minimum (best) rank per number of jokes:





we see that a part from the 1 comedian who has four jokes there does not necessarily seem to be an advantage of joking often...

The words don't seem too important

One final bit of preanalysis done is to look at the words in each joke. Before removing the common words (I use the nltk python library which has a set of common words) the distribution is given below:


Once we remove the common words we get:



A part from the word 'FAT' which appears in 3 jokes I can't say I recognise any words that I'd normally associate with jokes so I don't suppose there's any particular words worth honing in to.

Conclusion

I can't say that I've found anything too amazing here but if anything the python file in the github repo contains the data from the past 5 years so if I (or anyone else) had time I'd take a closer look at some things...

On a technical note, pretty much everything above was done in pure matplotlib and the nltk library is very easy to use. This is all in the github repo...

Tuesday, 13 August 2013

Social Constructivism in Big Classes

+Theron Hitchman (who is a great guy to follow on G+ and one of the go to guys as far as I am concerned when it comes to Inquiry Based Learning (IBL)) recently posted on G+ wondering how he was going to manage with a course of his having 68 students enrolled.

I am still understanding IBL but it is one of many teaching methodologies that use a constructivist model (here's a post by +Dana Ernst about an article that claims that these approaches aren't that great). I have spoken about constructivism before when reviewing a great education book. The basic concept of constructivism is that students need/should learn through a personal 'construction of the concepts'. IBL does this by giving students the reigns to the direction and also the discovery of the content of a course (I am sure +Dana Ernst, +Theron Hitchman  and others could either forgive me or correct my brief summary).

This is often done (although not exclusively, take a look at +Bret Benesh's post) done through the use of student presentations and generally needs a non-lecture based approach: which is difficult with a large number of students!.

Theron's post on G+ got a lot of comments with people offering advice and +Bret Benesh wrote a nice blog post suggesting a peer learning approach.

I thought I would throw in my two cents as I have recently designed a new course that made use of peer learning.

The course is a statistical programming course on our MSc programme here at +Cardiff University.

You can see all the resources for the course here.

To deal with large teaching numbers in that class (this was the first year of running and it had 27 students but I certainly believe that my approach is scalable and I designed it thinking that I'd have 40+ students at times). I used a peer learning approach based on flipped classrooms, problems and with a hint of IBL thrown in.
  • First of all it took a lot of preparation. I flipped the class completely putting together a full set of notes as well as a full set of videos (you can see them on the site).
  • I made groups of 3/4 out of all the students.
  • For every topic, I put together a set of problems that all the groups where told they had to complete. I called these 'challenges' (it seemed a bit snappier) and you can see them on the course website.
  • Every class (this course was taught in 8 sessions over a 4 week period) started with the me asking who would like to present a solution to the challenge.
The students were aware that their final mark for the course would take in to account participation in these presentations but I made it clear that the corresponding contribution would be mainly based on the fact that they tried and not necessarily how good a job they did. In essence I did not really care whether or not they managed to do the challenges, I just wanted them to work on it!

By the beginning of the 5th session, students were happy to present and needed no gentle nudging from me. In fact some of the students who presented started off by saying "I didn't manage to do this but this is what I tried". Seeing that students got that it was ok to not succeed at something was really great to see. Whenever that happened the students would start discussing amongst themselves how to do a particular problem: and would teach each other!

Throughout all of this, I would sit at the back of the room and vary rarely say anything at all. At times I would perhaps nudge a bit with a "does anyone know a different way to do that?".

One of my favourite memories of the course was towards the end when at the beginning of one session I did not prompt the students to start the class. All of them were just chatting amongst themselves (not about the course) and I was sat at the back observing. After a while one of the students turned around and looked at me questionably. I just smiled. She got up, told everyone that they should get started and the class started teaching itself. That day I didn't actually say anything.

I think this happened to work well because the challenges were designed in such a way so that students were lead through the curriculum but given the nature of the course I also made sure that they had plenty of resources with which they could practice things further.

I encouraged the students to find other resources then the ones I put together and also encouraged them to share their solutions with each other after each session (I believe they used a dropbox folder but I emphasised that I would stay out of the way).

The whole course culminated with one of the assessments being a presentation where the students (still in their group) had to teach me something that was not in the resources made available to them. I wrote about this here and one of the things a group put together was this cool gif of the Mandlebrot set:


I'm currently going through a teaching certification process and have blogged about it many times. You can see my various portfolios [here](http://www.vincent-knight.com/home/teaching/pcutl) but if I am to take only one sentence from everything I've done so far it would be this pretty cool definition of teaching:

"To create learning opportunities."

I believe that teaching in a constructivist framework does exactly that and I really hope that large classrooms do not dissuade educators from using it :)

Anyway, what I hoped would be a perhaps helpful post for +Theron Hitchman ended up just being another page or two of me rambling on...