Computer Programming Knowledge

I came across the image above in the Slack channel of the University of Hertfordshire Centre for Astrophysics Research. It summarises some of the fundamental knowledge in computer science that was assumed necessary at some point in time: Binar, CPU execution and algorithms.

They refer to 7 algorithms, but actually rather than actual algorithms they are classes:

  1. Sort
  2. Search
  3. Hashing
  4. Dynamic Programming
  5. Binary Exponentiation
  6. String Matching and Parsing
  7. Primality Testing

I like the periodic table shown at the bottom of the graphic. Showing some old friends such as Fortran, C, Basic and Cobol. Some other that are probably not used all that much, and others that have definitely been rising: Javascript, Java, C++, Lisp. It is great to se Python, number 35, listed as Multi-Paradigm!


File Encoding with the Command Line – Determining and Converting

With the changes that Python 3 has brought to bear in terms of dealing with character encodings, I have written before some tips that I use on my day to day work. It is sometimes useful to determine the character encoding of a files at a much earlier stage. The command line is a perfect tool to help us with these issues. 

The basic syntax you need is the following one:

$ file -I filename

Furthermore, you can even use the command line to convert the encoding of a file into another one. The syntax is as follows:

$ iconv -f encoding_source -t encoding_target filename

For instance if you needed to convert an ISO88592 file called input.txt into UTF8 you can use the following line:

$ iconv -f iso-8859-1 -t utf-8 < input.txt > output.txt

If you want to check a list of know coded characters that you can handle with this command simply type:

$ iconv --list

Et voilà!


Backslashes v Forward Slashes – Windows, Linux and Mac

“Why do I have to use backslashes (\) in Windows, but forward slashes (/) in everything else?” This is a question that I have been asked by a number of people over the years and I have been meaning to write something about it for a long time now. 

It seems that Windows is really the odd one out as Linux, OS X and even Android uses forward slashes. It seems that the cause of this annoying (at times) difference is due to accidental events. 

In the 1970s, Unix first introduced the forward slash to separate entries in a directory path. So far so good. In the meantime, the initial version of MS DOS did not even support the use of directories… and we are talking early 80s here! At the time, IBM has the main contributor to Microsofr utilities and they used the forward slash as a flag or switch character (In Unix we use a hyphen for this). You can still see a vestigial tail in some commands… Think dir /w for example. 

 The next version of MS DOs started support for directories and to keep compatibility, IBM expected to continue usage of / as a flag and as such the alternative for directory path separation, Windows started using \. Once you start using this in your own environment, who cares what other people use in their operating systems!! Right? In that way, in Windows the use of the different slashes tells you if you are running  an option (/) or a directory path (\). 

And the rest, as they say, is history!

10-10 Celebrate Ada Lovelace day!

It’s Ada Lovelace day, celebrating the work of women in mathematics, science, technology and engineering. To join the celebration +Plus Magazine revisits a collection of interviews with female mathematicians produced earlier this year. The interviews accompany the Women of Mathematics photo exhibition, which celebrates female mathematicians from institutions throughout Europe. It was launched in Berlin in the summer of 2016 and is now touring European institutions.

To watch the interviews with the women or read the transcripts, and to see the portraits that featured in the exhibition, click on the links below. For more content by or about female mathematicians click here.

The Winton Gallery opens at the Science Museum

During the recent Christmas and New Year break I had the opportunity to visit the Science Museum (yes, again…). This time to see the newly opened Winton Gallery that housed the Mathematics exhibit in the museum. Not only is the exhibit about a subject matter close to my heart, but also the gallery was designed by Zaha Hadid Architects. I must admit, that the first I heard of this was in a recent visit to the IMAX at the Science Museum to see Rogue One… Anyway, I took some pictures that you can see in the photo gallery here, and I am also re-posting an entry that appeared in the London Mathematical Society newsletter Number 465 for January 2017.

Mathematics: The Winton Gallery opens at the Science Museum, London

On 8 December 2016 the Science Museum opened a pioneering new gallery that explores how mathematicians, their tools and ideas have helped shape the modern world over the last 400 years. Mathematics: The Winton Gallery places mathematics at the heart of all our lives, bringing  the subject to life through remarkable stories, artefacts and design.

More than 100 treasures from the Science Museum’s world-class science, technology, engineering and mathematics collections help tell powerful stories about how mathematical practice has shaped and been shaped by some of our most fundamental human concerns – including money, trade, travel, war, life and death.

From a beautiful 17th-century Islamic astrolabe that used ancient mathematical techniques to map the night sky to an early example of the famous Enigma machine, designed to resist even the most advanced mathematical techniques for codebreaking, each historical object has an important story to tell about how mathematics has shaped our world. Archive photography and lm helps capture these stories and digital exhibits alongside key objects introduce the wide range of people who made, used or were affected by each mathematical device.

Dramatically positioned at the centre of the gallery is the Handley Page ‘Gugnunc’ aircraft, built in 1929 for a competition to construct a safe aircraft. Ground-breaking aerodynamic research influenced the wing design of this experimental aircraft, helping transform public opinion about the safety of ying and securing the future of the aviation industry. This aeroplane highlights perfectly the central theme of the gallery about how mathematical practice is driven by, and in uences, real-world concerns and activities.

Mathematics also defines Zaha Hadid Architects’ design for the gallery. Inspired by the Handley Page aircraft, the gallery is laid out using principles of mathematics and physics. These principles also inform the three-dimensional curved surfaces representing the patterns of air ow that would have streamed around this aircraft.

Patrik Schumacher, Partner at Zaha Hadid Architects, recently noted that mathematics was part of Zaha Hadid’s life from a young age and was always the foundation of her architecture, describing the new mathematics gallery as ‘an important part of Zaha’s legacy in London’. Gallery curator David Rooney, who was respon- sible for the Science Museum’s recent award- winning Codebreaker: Alan Turing’s Life and Legacy exhibition, explained that the gallery tells ‘a rich cultural story of human endeavor that has helped transform the world’.

The mathematics gallery was made possible through an unprecedented donation from long-standing supporters of science, David and Claudia Harding. Additional support was also provided by Principal Sponsor Samsung, Major Sponsor MathWorks and a number of individual donors.

A lavishly illustrated new book, Mathematics: How It Shaped Our World, written by David Rooney and published by Scala Arts & Heritage Publishers, accompanies the new display. It expands the stories covered in the gallery and contains an absorbing series of newly commissioned essays by prominent historians and mathematicians including June Barrow-Green, Jim Bennett, Patricia Fara, Dame Celia Hoyles and Helen Wilson, with an afterword from Dame Zaha Hadid with Patrick Schumacher.

Raspberry Pi

I am very pleased to have finally received the Raspberry Pi 3 that I ordered the other day. I also got a Sense Hat – an add-on board for Raspberry Pi, made especially for the Astro Pi mission

The Sense HAT has an 8×8 RGB LED matrix, a five-button joystick and includes the following sensors:

  • Gyroscope
  • Accelerometer
  • Magnetometer
  • Temperature
  • Barometric pressure
  • Humidity

There is even a  Python library providing easy access to everything on the board. I can’t wait to start using it with some of the APIs available at Bluemix for example. Any ideas are more than welcome.


Bluemix – a set of tools/tutorials for app development

IBM’s Bluemix provides access to a large set of API’s such as Watson services like AlchemyAPI, Natural Language Classifier, Visual Recognition, Personality Insights and more. I have recently started playing with it a bit more. You can set up a free account (free for 30 days) and see what you think.

Check it out:

 Here is what IBM has to say about it:

Bluemix is the latest cloud offering from IBM. It enables organizations and developers to quickly and easily create, deploy, and manage applications on the cloud. Bluemix is an implementation of IBM’s Open Cloud Architecture based on Cloud Foundry, an open source Platform as a Service (PaaS). Bluemix delivers enterprise-level services that can easily integrate with your cloud applications without you needing to know how to install or configure them.Bluemix

I will be happy to hear what you build and how you use bluemix. Keep in touch.

How much should we fear the rise of artificial intelligence?

  1. When the arena is something as pure as a board game, where the rules are entirely known and always exactly the same, the results are remarkable. When the arena is something as messy, unrepeatable and ill-defined as actuality, the business of adaptation and translation is a great deal more difficult.

Tom Chatfield

From the opinion article of Tom Chatfiled in The Guardian.

Astronaut Bowman

Quantum algorithms for topological and geometric analysis of data

Story Source:

The above post is reprinted from materials provided by Massachusetts Institute of Technology. The original item was written by David L. Chandler. Note: Materials may be edited for content and length.

Quantum Data Algos

From gene mapping to space exploration, humanity continues to generate ever-larger sets of data — far more information than people can actually process, manage, or understand.

Machine learning systems can help researchers deal with this ever-growing flood of information. Some of the most powerful of these analytical tools are based on a strange branch of geometry called topology, which deals with properties that stay the same even when something is bent and stretched every which way.

Such topological systems are especially useful for analyzing the connections in complex networks, such as the internal wiring of the brain, the U.S. power grid, or the global interconnections of the Internet. But even with the most powerful modern supercomputers, such problems remain daunting and impractical to solve. Now, a new approach that would use quantum computers to streamline these problems has been developed by researchers at MIT, the University of Waterloo, and the University of Southern California.

The team describes their theoretical proposal this week in the journal Nature Communications. Seth Lloyd, the paper’s lead author and the Nam P. Suh Professor of Mechanical Engineering, explains that algebraic topology is key to the new method. This approach, he says, helps to reduce the impact of the inevitable distortions that arise every time someone collects data about the real world.

In a topological description, basic features of the data (How many holes does it have? How are the different parts connected?) are considered the same no matter how much they are stretched, compressed, or distorted. Lloyd explains that it is often these fundamental topological attributes “that are important in trying to reconstruct the underlying patterns in the real world that the data are supposed to represent.”

It doesn’t matter what kind of dataset is being analyzed, he says. The topological approach to looking for connections and holes “works whether it’s an actual physical hole, or the data represents a logical argument and there’s a hole in the argument. This will find both kinds of holes.”

Using conventional computers, that approach is too demanding for all but the simplest situations. Topological analysis “represents a crucial way of getting at the significant features of the data, but it’s computationally very expensive,” Lloyd says. “This is where quantum mechanics kicks in.” The new quantum-based approach, he says, could exponentially speed up such calculations.

Lloyd offers an example to illustrate that potential speedup: If you have a dataset with 300 points, a conventional approach to analyzing all the topological features in that system would require “a computer the size of the universe,” he says. That is, it would take 2300 (two to the 300th power) processing units — approximately the number of all the particles in the universe. In other words, the problem is simply not solvable in that way.

“That’s where our algorithm kicks in,” he says. Solving the same problem with the new system, using a quantum computer, would require just 300 quantum bits — and a device this size may be achieved in the next few years, according to Lloyd.

“Our algorithm shows that you don’t need a big quantum computer to kick some serious topological butt,” he says.

There are many important kinds of huge datasets where the quantum-topological approach could be useful, Lloyd says, for example understanding interconnections in the brain. “By applying topological analysis to datasets gleaned by electroencephalography or functional MRI, you can reveal the complex connectivity and topology of the sequences of firing neurons that underlie our thought processes,” he says.

The same approach could be used for analyzing many other kinds of information. “You could apply it to the world’s economy, or to social networks, or almost any system that involves long-range transport of goods or information,” Lloyd says. But the limits of classical computation have prevented such approaches from being applied before.

While this work is theoretical, “experimentalists have already contacted us about trying prototypes,” he says. “You could find the topology of simple structures on a very simple quantum computer. People are trying proof-of-concept experiments.”

The team also included Silvano Garnerone of the University of Waterloo in Ontario, Canada, and Paolo Zanardi of the Center for Quantum Information Science and Technology at the University of Southern California.