dimitris kalamaras

math, social network analysis, web dev, free software…

Day: August 2, 2008

Prime numbers’ generator

This is a Prime Numbers’ Generator from Integers up to 2,000,000,000, written in Turbo Pascal.
This program generates the prime numbers up to a given arithmetic limit, using 4 (four) different known methods. They are all based in modulo algebra. The methods are:

  1. This uses the mathematical definition of a prime number to generate them. A prime is only divided by 1 and himself. Disadvantage: The method is very slow.
  2. In this method, each number N is modulo divided only with the half of the numbers below it (N/2). Thus, the search is becoming faster than the first method.
  3. In the third method, a number, let N, is modulo divided only with the numbers up to sqrt{N}. As a result of that, the generation process is 10 times faster than the previous methods.
  4. The fourth method is the best of all. It is based on the 3rd method, only it bypass the sqrt{x} praxis, by modulo dividing each number N with the first, the second and the third prime number and then, if there is a residue, it modulo divides N with j, where j is an integer from j*j cdots N with step 2. The above trick has the eye-blink effect: the method generates primes (within a reasonable range) before you blink your eyes….:-)

Read More

Qt (Μέρος Ι): Convertor

Το Q Toolkit (Qt) είναι μία εργαλειοθήκη για δημιουργία εφαρμογών με γραφικό περιβάλλον (GUI), αντίστοιχη της GTK του Gnome. Ξεκίνησε να αναπτύσσεται το 1991 από τους Haavard Nord and Eirik Chambe-Eng και έγινε η βάση πάνω στην οποία στηρίχτηκε ολόκληρο το γραφικό περιβάλλον KDE. Ουσιαστικά, οι εκδόσεις του KDE ακολουθούν πάντα τις αναβαθμίσεις της Qt. H Qt αναπτύσσεται πλέον από τη Νορβηγική Trolltech, και υπάρχουν ανοικτού κώδικα εκδόσεις της για Unix, Mac OS, Windows και embedded συστήματα.

Λίγη ιστορία

Μέχρι την έκδοση 1.45, η άδεια χρήσης της Qt (FreeQt) δεν ήταν συμβατή με τις άδειες χρήσης ανοικτού κώδικα του OSI (www.opensource.org) αλλά και τον ορισμό του ελεύθερου λογισμικού (www.fsf.org), πράγμα που έκανε πολλούς developers να ανησυχούν για την εξέλιξη του KDE. Η άδεια άλλαξε με την Qt2 που είχε άδεια Q Public License, την οποία όμως το FSF θεώρησε και πάλι ασύμβατη με την GPL. Το αποτέλεσμα ήταν η ανάπτυξη ανταγωνιστικών προσπαθειών, όπως της εργαλειοθήκης Harmony και του Gnome. Το Harmony ήταν μια άδοξη προσπάθεια αναδημιουργίας της Qt με άδεια GPL ενώ, πιο φιλόδοξα, το Gnome έθεσε ως στόχο την αντικατάσταση του KDE στα desktops μας (από εκεί πηγάζει η αντιπαράθεση KDE εναντίον Gnome, που όμως έχει πλέον ατονήσει).

Read More

Sombrero!

The first blog post is usually some general introduction about the writer. I don’t like those posts so I start by testing my MathML installation.

To test it, let me try to write the “sombrero” function:

z={sin(sqrt(x^2 + y^2))} / sqrt (x^2 + y^2)

which is automagically constructed by Ron Fredericks‘ WP Math Publisher plugin using this line of code:

[pmath size=12]z=sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))[ /pmath]

Powered by WordPress & Theme by Anders Norén