Drawing through Iterated Fractal Function

Leafy Mathematics
Leafy Mathematics

Have a look at the image on the right. What do you think it is?

Ok, you got it: it’s a fern. What’s the big deal about that? The big deal is that it has been generated mathematically. Generated mathematically? Yes, mimicking what happens in nature.

It also happens to be a ‘fractal’: each part of it is similar to the whole – no matter how much you zoom in.

I read about this on Wikipedia: I decided to give it a try so I built a spreadsheet. Download it here.

Start with x=0, y=0. In each iteration n, choose t randomly from {1, 2, 3, 4} such that it has value 1 with a probability of 0.01, values 2 & 3 with probability of 0.07 each, and value 4 with a probability of 0.85. Now (xn, yn) is

(0, 0.16 yn) if t=1

(0.2 xn – 0.26 yn, 0.23 xn + 0.22 yn + 1.6) if t=2

(-0.15 xn + 0.28 yn, 0.26 xn + 0.24 yn + 0.44) if t=3

(0.85 xn + 0.04 yn, -0.04 xn + 0.85 yn + 1.6) if t=4

So this is what I replicated in the spreadsheet. The first column A, contains random numbers generated using function RAND. The second column contains the calculation for ‘t’: if the value in column A is less than 0.85 – ‘t’ will be selected as 4. If not, and its less than 0.92, ‘t’ will be selected as 3 and so on. This will ensure the required probability distribution for the random values of ‘t’. In columns C & D, values of x and y are calculated respectively, using values in the previous row.

Move over to the second worksheet in the spreadsheet, called ‘Plot’. Can you see the fern similar to the one I showed above? Press F9 to refresh – this will cause the entire set of random numbers to be regenerated, the x & y values to be correspondingly recalculated and the graph redrawn. Even so, the fern shape will be retained. Mathematics is beautiful, isn’t it? The ‘fern’ we just generated is called Barnsley’s fern.

Share

Safe Browsing Guide – II

Continued from Safe Browsing Guide – I

You might get some ‘warnings’ while opening secure pages, like below:

Warnings

The first one means that the certificate could have been signed by anyone, including by someone you do not trust. If all I need is encryption: for example if I am sending email, and not sending any corporate presentations, or password, or credit card numbers – I should be fine. Many websites use such certificates – but if it’s a bank website using it – I would not login. To give you an idea of the relative security impact of many of the warnings discussed during this guide: this particular warning has a severity of 40 out of 100. It means even on seeing this warning, I am 60% likely to use the website.

The second one means that the certificate has expired. In this case, I would check what is the expiry date (by clicking on the lock) and if it expired a couple of days back I would allow it. In addition, if its sensitive information, I would not use the site until the issue is fixed. This one has a severity of 30.

The last one says that the website names do not match between the certificate and the actual website you are visiting. This could be a case of phishing, and could be serious. What I do in such a case is I find out what name the certificate is issued to (clicking on the lock icon) and check it against the actual website in the URL. If the website visited is server.icicibank.com and the certificate is for icicibank.com – I continue to use the site. If the two are very different, I don’t use the site. Severity is 80.

Mozilla issues one message for each of the issues as noted above while Internet Explorer (shown above) issues just one message with error icons:

Warnings

This corresponds to the second warning from Internet Explorer.

Warnings

This one corresponds to the first warning from Internet Explorer, same actions apply.

Another warning that you might see is this one:

Warnings

Correspondingly for Mozilla:

Warnings

This warning means that there is some content on the page which is not encrypted: this could be images or something else. Severity is 50: on GMail it may mean that the emails have such content so it’s ok to continue to do your stuff. However, if on one of the emails you are sending a password – you may want to be careful.

Lastly I would encourage visitors to read this advise on safe browsing from a security expert. This essay from 2004 is still good.

Disclaimer: This is just a guide and is not meant to replace professional advise. No measures can guarantee 100% security. There are a lot of threat vectors outside the scope of this tutorial: such as key loggers on your computer. In addition, the severities explained for warnings are just guides and have no scientific basis.

Share

Safe Browsing Guide – I

When you browse over the Internet, or Chat, or send/receive email – you are not doing that in private. It is important to understand exactly what is private, and what steps you need to follow to maintain the privacy.

When accessing any website such as Yahoo.com, you get connected to the web site’s server which provides you the information you seek – search results, or email. This connection is not direct: you are connected through a series of nodes. Each node can view/alter the information that is flowing through it.

A protocol – ‘https’ provides privacy to your interaction by adding a ‘Secure Socket Layer‘ on top of the normal HTTP protocol. Enough of jargon, back to English!

So when you use this particular protocol you are secure subject to some caveats. Use of this protocol can be confirmed through the ‘https’ at the beginning of the URL, and through the ‘lock’ icon at the bottom right: Lock.

A lot of online websites support HTTPS for logging in. You have to select ‘secure’ at the login screen where you enter username/password. This means that your password is protected during the communication. However, these sites move back to normal mode after the login: your data (for example the email content) is not protected. Gmail supports secure connection even after login but you have to enable it in the settings – this makes sense and you should do it. However, even after doing this it does not mean that all your content is ‘protected’ – more on this later.

Please understand that if its emails in question: just your using a secure connection is not enough. The recipient should also use it for the information to remain inaccessible at the nodes.

Proceed to the next part of the guide.

Disclaimer: This is just a guide and is not meant to replace professional advise. No measures can guarantee 100% security. There are a lot of threat vectors outside the scope of this tutorial: such as key loggers on your computer. In addition, the severities explained for warnings are just guides and have no scientific basis.

Share

The festival of Lohri

Lohri is a major North Indian festival, which to us non-farmers means the start of the decline of the winter season.

The first Lohri after marriage or after a newborn baby is cause of celebration: this includes family and friends in the evening, lighting a bonfire, eating rewri, peanuts, popcorn etc and singing Lohri ‘carols’. One of the carols is about a person called ‘Dulla’ who, in a Robin Hood fashion looted the landowners (zamindars) and distributed the loot among the poor.

Below a photograph of our very own bonfire (from yesterday evening), the first one I lit in my life:

Bonfire
Bonfire

Once we setup the pile of wood ready to light, the children playing around ‘damaged’ it. There after they tried to build it back with no luck, so we had to do it all over again. 🙂

Share

GIF vs JPEG

There must have been times when you would have wondered what the difference is in pictures of type “GIF” (having file extension .gif) and those of type “JPEG” (having file extension .jpg). At other times you might have wondered which type to use for a picture you are uploading. Well, today I am going to solve the problem for you.

GIF stands for Graphics Interchange Format, and is more suited for computer generated graphics and images. This is because it can hold a maximum of 256 colors. If the picture you are saving as GIF has more colours, they will be “approximated”. Leaving aside this limitation, GIF is a wonderful format. You can mark some of the pixels as “transparent” which means that those pixels do not have a colour of their own, and will take up the background colour when the picture is displayed. This makes them merge easily with any background. In addition, you can create animations as well using GIF format.

On the other hand, JPEG, standing for “Joint Photographics Experts Group” can store true 24 bit color, and is used more often for real life photographs. This is because real life photographs normally have more than 256 distinct colors. However, these support neither animations, nor transparent pixels.

The compression used by GIF is mostly lossless, while that used by JPEG is lossy – which means that a JPG image will loose some quality each time you save it, where as a GIF will not.

Share

Indian Photographers I: Lala Deen Dayal

I have started this series, called Indian Photographers to throw some light on the works of great Indian photographers.

Deen Dayal was born in Sardhana, Uttar Pradesh. In 1868, Deen Dayal founded his studio Lala Deen Dayal & Sons, and was subsequently commissioned to photograph various temples and palaces of India. He established studios in Secunderabad, Bombay, and Indore in the 1870s. He covered the tour of the Prince and Princess of Wales in 1875, and travelled with Sir Lepel Griffin through Bundelkhand in 1880s.

Some of his old photographs that I like:

Interior of Bashir Bagh Palace, Hyderabad
Interior of Bashir Bagh Palace, Hyderabad
Kashmiri Gate, Delhi
Kashmiri Gate, Delhi
Entrance to the Charminar, Hyderabad
Entrance to the Charminar, Hyderabad
Share