Jump to content

Dave

Administrators
  • Posts

    5127
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Dave

  1. Nice collection of eBooks there I may have to steal a few to add to my collection.
  2. The reason it runs so slowly is because of this: long high = fib(n-1); long low = fib(n-2); This is highly inefficient. Consider what happens when you work out fib(3). fib(3) | +-----------------+ | | high = fib(2) low = fib(1) | | return 1 return 1 This is obviously the simplest case involving a lot of recursion. It's slightly different to yours, but the same kind of idea. (I assumed F1 = 1, F2 = 1 but same difference tbh). It involves 2 recurses of fib(). Now consider what happens when you work out fib(4). The left hand "branch" will be the one drawn above, and the right hand one will simply return 1. Fine so far. However, this is where things start to get interesting. Try drawing the execution diagram for fib(5). Then draw it for fib(6). You should notice that the number of executions of fib() for larger n becomes really very big, very quickly. I believe that the number of executions of fib for fib(n) is something like 2n-1 or something to that degree. It's certainly an exponential relation, that's for sure. So for n = 300, you can imagine it might take a long time to work out! I'll look at the other code in a bit. I think it's just a nice way of limiting the number of executions for a particular branch. I'd personally say that the Fibonacci numbers don't lend themselves terribly well to a recursive algorithm (as do many things of this fashion), but it's good practice.
  3. Well, yes. But preg_replace is stupidly fast, especially for something as simple as that regexp.
  4. Well, store the un-parsed version in the db, and then parse it every time you want it displayed. That's the simplest way.
  5. Crap, sorry - the PHP should read: $article_text = preg_replace('/\[\[(.*?)\]\]/', '<a href="'.$site_url.'"index.php?title=\\1">Linkage</a>', $article_text); It might be doing the regexp replace, but it wasn't assigning it to $article_text
  6. I'd say that, in this instance, regex is definately the way to go. No whiles or anything, and can be done with a one-liner: preg_replace('/\[\[(.*?)\]\]/', '<a href="'.$site_url.'"index.php?title=\\1">Linkage</a>', $article_text); Something in that order anyway. There's an excellent tutorial on regexps here.
  7. Dave

    Eff

    I agree that everyone should be given the right to free speech, so I agree with the EFF on that front. Otherwise, I'm not entirely sure what they do so I'll leave it at that
  8. You made me cry
  9. Thanks, Pangloss I know a couple of people in London that work around there, but thankfully all is okay with them and their families. I have to admit that I've been rather engrossed with the BBC News coverage, but after 8 straight hours I'm ready to take a break Anyone requiring a very good example of the British attitude towards this should listen to Ken Livingstone's speech. Britian has been through this before; we've had 30 years of IRA bombings and other assorted illegality to deal with. Whilst Al-Qaeda think that they've brought London to its knees, the exact opposite has happened. The British are a very proud nation, and events like this unite us like no other. I couldn't help but feel rather proud as the first bits of news came in, reporting how calm and restrained the public had been. I also have to say that the emergency services have done an amazing job. They won't get away with this, though. We'll simply re-double our efforts to find the bastards.
  10. diagxy is only used for commutative diagrams really. I'm in the middle of working on a "safe" implementation of pstricks. However, I have so much on my plate at the moment that I don't really have the time to do it right at this very moment.
  11. Luckily I have a scanner, so images shouldn't be too bad
  12. All the latest broadcasts here are saying something in the region of 40, at the moment.
  13. http://news.bbc.co.uk/1/hi/england/london/4659093.stm Doesn't look good, at all.
  14. Mmm... brownie weeds *drool*
  15. If there is clear, solid evidence that Iran is developing nuclear warheads and, furthermore, intends to use them against neighbouring (or other) countries, then I'd be completely in favour of getting rid of the damn things. The evidence needs to be presented to the public, classified or not, and the government needs to be truthful about what actions are taking. However, after the farce of Iraq, I'm not sure I can trust the government on anything anymore.
  16. As far as I'm aware, he'd only become "public" since this election campaign began. Since the CIA analysts are extremely busy with things like Iraq and Afghanistan at the moment, I daresay that he slipped their attention somewhat. Another key to the entire thing is that I doubt there are many informants in Iraq. Since it's pretty much impossible to get an external agent into their government, the best you can hope for is some kind of informant. I'm pretty willing to bet that, because of the religious fanaticism and brainwashing from birth, there's not too many of these about.
  17. Personally I think the decision to send Miller to jail was wrong. The job of the press is to report impartially on the government's actions, not to supply politicians (liberal or otherwise) with ammunition to gun others down. Other than this, to me the entire thing seems a farce. I'm trying very hard not to let my arguments on here be affected by things such as my complete hatred for the Bush administration and everything it stands for, so I shan't post any more on it. I just guess we'll have to see what else happens
  18. I was considering an introduction to the calculus of variations, since that's quite an interesting problem. I'll try to cover the slightly more advanced things like volumes of rotation and all that.
  19. Now I have images of going out into the back garden, pulling and eating weeds from the patio. Hmm, I'm not entirely sure those are supposed to be eaten
  20. Fair enough. I just don't like the way this is going. I do see the reasons behind persuading Iran not to start a nuclear programme, but this is the latest in a series of rather bizarre events that makes me wonder what's going on here. Out of curiosity; who originally brought this issue up? I would doubt that the White House would deliberately publish a press release basically admitting they'd made a monumental oversight.
  21. There's a syllabus of sorts on the first post. I basically go up to things like the Chain Rule, but I can extend it if there's sufficient demand.
  22. I can see this going Philosophical quite quickly Will move it if necessary (edit: not meant as a threat, just as a warning so you know where the thread is)
  23. Hopefully we can drum up enough interest. I'm certainly keen to continue, but only if there's more than, say, 5 people following it. That seems a sensible number, for now.
  24. Quite. Glad my opinion is shared by others. I really, really hope that this isn't going to happen, but I have a gut feeling that it's stupidly likely. They've really been spinning everything recently, especially Iran's nuclear program and the hypothetical weapons of mass-destructionisation that don't exist - except, of course, in Bush's head.
  25. Political correctness is reaching completely new levels of utter stupidity. That is all I have to say on the issue, really.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.