Archive for June, 2010

To Continue…

Last night I finished my P vs. NP coverage, which took me far too long to finish off – exams and Computing coursework got in the way, but finally, I am free of them both! I had a nightmare of a day last Friday – 4 hours 45 minutes of exams on one day. The exams went okay overall – the Physics was as expected, but OCR seemed to have finally gotten the timing right after three attempts, Mechanics 2 wasn’t too bad but had some particularly nasty questions in it, and Statistics 2 had a few dodgy questions as well. Even so, I think they went all right, but the revision for them was tricky. On top of the pain of actually doing the revision, I had to balance between three separate subjects, all for the same day. I decided to place most emphasis on Physics revision, because that is the one which ‘counts the most’ so to speak – Mechanics and Statistics are part of Maths overall, and I already have an A* in Single Maths as far as I know – I needed around 53/100 each on Further Pure 3 and Mechanics 2 to get an A in Further Maths. My aim is A*, but I won’t be hugely disappointed if I don’t get that. Physics, on the other hand, is far from settled, as the final module of both years carries more weight than the January Module, and so can decide the grade itself. In addition to that, there was a lot more to learn for Physics than for Mechanics and Statistics put together. This module seemed to want you to know huge amounts, but maybe that was because the topics were quite separate, for example Medical, Nuclear, Cosmology were all in this module. Furthermore, I had done a lot of Mechanics and Statistics revision during college, as we always finished the Maths syllabi very early, leaving loads of revision time.

Next stop is university, reading Computer Science. That should be great, I can’t wait for it. Before that though, is summer, which promises to be special. I’ll be going to the British Grand Prix and V Festival, and both are going to be amazing.

In terms of the blog, I want to update it more frequently. I’ll probably do a general post every few days, and a more technical, maths, computing or F1 article every so often.

Until next time, have a good one!

P.S. If you want to learn more about P vs. NP, there are loads of great resources on the internet. I only glossed over it, and there are other factors like memory space as well as time. A good but expensive book is Algorithmics: The Spirit of Computing by David Harel and Yishai Feldman, if you wish to learn more, specifically from the algorithmic viewpoint. A highly recommended book on general Computer Science is The (New) Turing Omnibus, which I own and am currently reading.

2 Comments

P vs. NP – Why should you care? Part 3

Ok, so we have now established what P and NP are, and how they are interdependent. What hasn’t yet been covered though, is why you should care. It might seem tricky to answer – why should a non-geek care? In fact it isn’t hard to answer at all. The safety of your money depends on P vs. NP.  The cost of computer-driven devices may also depend on P vs. NP. It’s even arguable that some people’s jobs even depend on P not equalling NP.

In terms of money safety, I am speaking of the encryption method called Public Key Cryptography. This is the method that online shops use so that you can transfer payment details without people being able to eavesdrop on you, and gain access to your money. Within a lot, if not all of the Public Key Encryption algorithms, a huge number is generated and used as part of a private key, which only you and your computer knows. They crux of this is that the private key often consists of large prime factors, and as it stands there is no prime factorisation method for current, non-quantum computers which is in P-time, so if you have a large enough number,  it is practically impossible to find the factors and hence your private key. If P was to equal NP, then prime factorisation would be in P-time, hence rendering Public Key Encryption weak, and making your payment transactions insecure.

A fascinating result of P equalling NP would be that the Travelling Salesperson Problem would be in P-time. This problem deals with route-finding, and at present, it has no P-time solution, making it practically unusable for routes which include a lot of stopping points. The obvious applications of this would be logistics, as being able to quickly plan a tour of 500 stops based on fuel used and distance, among other factors, could save a lot of money compared to current methods, as well as reducing environmental impact through cutting back on wasted mileage. Surprisingly though, this problem, if solved in P-time would make the production of microchips a lot more efficient. This would be due to the routing of the wires between components – there are many components in single microchips, and wiring them up is likely to involve a lot of wastage, which is passed on to the customer through extra cost. By applying Travelling Salesperson to the designs of the chip, the wiring could be much more efficient, saving in production costs and hence saving the consumer money. As microchips are used in a huge amount of products now, from computers to air-fresheners, this will allow the consumer to save a lot of money on various products.

This brings me to my final point, which is a more worrying one. Should P equal NP, then a lot of jobs done by humans as computers could not do them efficiently might disappear. Business is ruthless, and the unfortunate reality is that if a computer can do it, the human is no longer needed. Jobs which might be affected by these developments would be route-planning, some clerical work, among many different fields where this would hit. For this reason, a lot of people working in these fields will probably be praying for P not to equal NP, if they know about it at all.

That brings me to the end of this computing journey, and although a lot of words have been written, I have only covered one small part of Computer Science as a whole. Hopefully you will have seen from this that P vs. NP has real world consequences, and solving it is a very big deal – there is a $1 million reward for the person who submits a correct solution to it, from the Clay Mathematics Institute as part of the Millennium Prize Problem list. Personally, I don’t believe P equals NP. I think that by now, a problem in NP-Complete would have been found that is actually a P-time algorithm, and we would have been done with it. As it stands, there are over 3000 NP-Complete problems, and none have yet been found to be in P-time. As for the actual result? Well, we’ll have to wait and see. Let’s just hope we don’t end up with another Fermat’s Last Theorem.

4 Comments

P vs. NP -Why should you care? Part 2

Those two examples are physically quite separated (maybe you like to drink your skinny latte with hazelnut and cream whilst sorting the records?).  Consider this – for each extra item you want on your coffee, how much longer does it take than without that item? Would you think it a roughly constant increase in time for each added bit? Lets assume that to be the case. Say someone decides to have a black coffee – this will take a set amount of time, and for each item you add (chocolate sprinkles, warmed milk etc.), the time taken to make the drink will increase by a constant amount – this is a linear relation, which comes from the fact that if you were to plot the data from the coffee making on a graph, it would be a straight line and therefore linear.

An exponential graph

Graph courtesy of Peter Acklam

This is not the case, however, for sorting the records should you choose the most basic method of taking a record, and comparing it to every other record. For each new record you add, the number of comparisons to sort these records will increase in an almost exponential manner (this name also is from the graph of the number of comparisons against the number of records – an example of this type of graph can be seen to the right) and if we assume that each comparison takes a constant amount of time, we can then deduce that adding extra records causes an exponential increase in time.

So, we have the coffee, which takes a linear amount of time for each extra ingredient, and we have sorting records, which takes an exponential amount of time for each extra record. How can this possibly apply to computing? Well, it just so happens that algorithms work in very similar ways. Some increase in linear amounts for each extra item you feed into them, and some follow an exponential time patterns. All algorithms can be put into groups of how they react to more inputs being given, such as linear-time, polynomial-time (which increase by a constant power for each extra input), exponential-time and even worse, such as x to the power of x, x being the number of inputs. The closer to linear-time or faster, the better, as the algorithm can be said to be more efficient. Computer scientists are constantly taking inefficient algorithms and trying to find ways of making them better.

So now we have our classes of algorithms, and we have a problem. We want sort some records, using our incredibly basic but functional method of comparing each record to every other record, and we need to do a lot of records, say 20 million. Now this is going to take a long time, no matter how fast our computer is (at this point I should inform you that the speed of the computer has no bearing on the classification of the algorithm, as all current computers can be reduced to ‘Turing Machines’, which I will talk about in future blog posts, and they all follow the same method of processing, that is taking a piece of data, dealing with it, then moving on, so they are fundamentally the same), so I want to use the most efficient method available. This is where P and NP come in.

P is the Polynomial class, in which all algorithms which are Polynomial-time or better are grouped, and Non-Polynomial-time which those which are exponential, or worse, are placed. P class problems are actually a sub-class of NP class, as illustrated in the image to the left – this may seem a little strange, but P problems are just NP problems made to be much more efficient. A given algorithm is worked on until it has reached its maximum efficiency, and at this point, it is classified into one of the groups. You will notice in this diagram ‘NP-Complete’. This is a NP subset which has two key properties. If we are given a solution to a problem which is in NP-Complete class, then it can be verified (i.e. checked to see that the solution is correct) in Polynomial time, and also, another, bizarre property arises. Any problem in the whole NP class can be converted into an NP-Complete problem by transforming the inputs in Polynomial time. This is a little hard to grasp, and describing it in detail is beyond the scope of this blog post, but in effect, you can emulate an NP problem using an NP-Complete problem by altering the inputs.

Here is the clincher. If any problem in the NP-Complete class is to be proven to be solvable in P, then all NP problems are solvable in P, hence P equals NP. The reason for this is by virtue of the fact of emulation – if the algorithm emulating the NP problem is P, then the NP problem must be solvable in P-time. Until then, P is not equal to NP

I can hear the cries of ‘So what?’, so in the next post, you will see exactly why this is such a big issue.

No Comments