Thursday, June 11, 2009

Avast and Chrome hangs

I’ve run out of NOD32 license so I’ve downloaded Avast Home/Professional version. It is friendly, fast and seems to know a lot. So I’ve installed it and I was totally happy.

After a while Chrome started crashing randomly. I couldn’t even kill chrome process, not even with Process Explorer. Restarts helped, but just for a while.

I found forums about the same symptoms with Firefox, and a few with Internet Explorer. I’ve already uninstalled Avast and I’m moving back to NOD32. Safe, fast and simply works. I will never use free antivirus software again.

Wednesday, June 10, 2009

Pi

Pi I have been always excited about basic mathematical calculations implemented on computers. One of them is calculating PI. I’ve tried out an example algorithm from Roman E. Meader: Computer Science with Mathematica. You can see the results in the image on the left side of the text. We choose random points in a unit square and check how often it lies inside a unit circle as well.

  1. Choose random points
  2. Count the points in the circle (x^2+y^2 <=1)
  3. Compare this number to the total number of points (circle_points/number_of_points)
  4. You should get about PI/4 as a result

Why don’t you get PI as a result? Because you have just a quarter of a circle.
Why can we calculate PI this way? Because the area of a circle is PI*r^2. If r=1, the area of the square is PI.

See the image for Mathematica details.