Number of Submatrices of a Matrix

November 6, 2013

So this is the derivation of number of submatrices of a m x n matrix.

Any thoughts on this are welcomed! 🙂


Scraggy in Sage

March 23, 2013

Are you a Scraggy fan? Here’s something interesting for you!

I was plotting Cardioids in Sage the other day when my friend Pratyay asked me to plot Scraggy if I could. I accepted the challenge and started working on it. And… till now I have just completed face of one of the cutest Pokémon ever, Scraggy.

Here is the Sage code and the “Scraggy” it produces:

x = var('x')
y = var('y')
p1 = implicit_plot(x^2/2+(y-1)^2/1.5- 1,(x,-3,3),(y,0.2, 5), color="yellow")
p2 = ellipse((0,-4.5),10,5)
p2 = implicit_plot(x^2/20+(y+2.6)^2/10- 1,(x,-1.25,1.25),(y,0, 2), color="yellow")
p3 =  ellipse((1.1,1),0.3,0.5, color="black")
p4 = ellipse((-1.1,1),0.3,0.5,color="black")
p5 = ellipse((1.1,0.9),0.09,0.2,color="black", fill="black")
p6 = ellipse((-1.1,0.9),0.09,0.2,color="black",fill="black")
p7 = ellipse((1.1,0.9),0.045,0.1, color="grey", fill="grey")
p8 = ellipse((-1.1,0.9),0.045,0.1, color="grey",fill="grey")
p9 = implicit_plot(x^2+(y-0.5)^2-0.3,(x,-1.25,1.25),(y,0.55, 1.5), color="black")
p10 = line([(0,0.6), (0,1.05)], color="black")
p11 = line([(0.4,0.555), (0.4,0.875)], color="black")
p12 = line([(-0.4,0.555), (-0.40,0.875)], color="black")
p13 = ellipse((0.2,1.3),0.005,0.015, color="black",fill="black")
p14 = ellipse((-0.2,1.3),0.005,0.015, color="black",fill="black")
p15 = line([(0.2,2.22), (0.3,2.45)], color="red")
p16 = line([(0.3,2.45), (0.45,2.35)], color="red")
p17 = line([(0.28,2.2), (0.45,2.35)], color="red")
plot(p1+p2+p3+p4+p5+p6+p7+p8+p9+p10+p11+p12+p13+p14+p15+p16+p17, axes=false)

And here is what it produces:

Scraggy - From math!

Scraggy – From math!


Scraggy – the Graph

Cramer’s Rule for Homogenous Equations

February 18, 2013

So here is the explanation.

Thoughts on this are welcomed.

Zeno’s Arrow Paradox and Roots of Polynomials

April 5, 2012

Let me begin with explaining the both things separately:

Zeno’s Arrow Paradox :

If everything when it occupies an equal space is at rest, and if that which is in locomotion is always occupying such a space at any moment, the flying arrow is therefore motionless.

What I used to think about roots of quadratic equations when I first learnt them :

If α and βare the two roots (‘zeroes’ as they say) of an quadratic equation, then due to the fact that they are the roots of the equations, they are indistinguishable. i.e. The quadratic equation should treat both equations equally. In the neighbourhood of β, the quadratic equation (or for that matter, any polynomial equation) should behave similarly as it behaves in the neighbourhood of α, and vice versa. This probably will ‘sinusoidalize’ polynomials.

Similarly, consider what I used to think. If we think about just the given polynomial (say, quadratic) and its roots, all the roots satisfy the equation of the polynomial. Hence, I expected the graph of the polynomial to take same shape after its every root (or ‘zero’) as it takes after becoming zero at one root. And hence every polynomial should be periodic, and by induction, should have infinite roots. Well, now it starts sounding dumb 😉  (Read : Fundamental Theorem of Algebra). Obviously, I didn’t know about derivatives and slopes of graphs back then. But this idea was based upon the assumption of existence of lengthless points.The two things may seem totally unrelated to each other, but they are related. The Zeno’s paradox states that if the arrow is stationary at every same durationless instant, it should be stationary for the whole time duration and hence the motion doesn’t exist. Though this directly conflicts with our day-to-day experience, simply example doesn’t prove something. The very idea of Zeno’s Paradox relies upon the assumption that time period is made up of infinite durationless instants.

But then, why does motion exist? “Duh, because of its potential energy and inertia!”, one might say. But that still doesn’t resolve the paradox, because we have assumed durationless time instants. If they exist, then potential energy and inertia still doesn’t come into the picture, because they need time to affect the arrow. Hence, the proposed resolution of the paradox states that there are no such durationless time instants. Hence the motion of the arrow is quantized in space and time.

Now what was wrong in my thinking? Yes, I didn’t consider the rate of change of the equation (Slope) differs around each point. Still, slopes won’t affect the nature of graph if only lengthless points existed. Hence, I say here, with courage (Umm, not really. This whole thing is written by ripping off the calculus), that no points exist in plane. Instead, there are δ-neighbourhoods which satisfy certain properties (and those are, essentially points). But now that these points are infinitesimal distance apart from each other, slope can affect them, and hence all roots of polynomials are not similar in nature. This is also assumed in the formulation of definite and double integrals (calculus rip off, told ya!). There we assume δi xi (definite integral) and Ai (xi, yi) (double integral) as the summation terms. The Delta and Area terms in the respective derivations are nothing but the δ neighbourhoods.

And now, with this realization, I am way too happy. ^_^
Any suggestions and criticisms are welcomed. 🙂

Pokémon Confession

March 4, 2012

So the news is out. Pokémon Black 2 and White 2 are coming. And yeah, I still haven’t written a status or a single word about it. Why? Yes, because, I am feeling extremely guilty about my behavior about Pokémon. And here’s the confession :
I still haven’t completed my Pokémon Black (English) and White (Japanese). Is it the same me who went ‘YAYYYY!’ when the news of Generation V began to float around? Is it the same me who was thrilled when the silhouette of Zorua and Zoroark appeared in the Sunday show one and a half years ago? Is it the same me who used to write countdown statuses everyday starting from 10 days before the Japanese release date of Generation V games? Well, it’s hard to answer, but I tried to analyse what happened.
I downloaded (ahem!) Pokémon White in Japanese as soon as it surfaced on the internet. Naturally, I struggled (not the only thing which you get when you run out of moves. 😛 ) to play it as it was in Japanese. But yes, I tried my best and played till the 7th badge. After that, I didn’t know what to do and I was stuck at some point. Well yeah, there was the option to refer to online walkthroughs, but if I remember correctly, my semester exam of 12th began and eventually I forgot about it. After that, came the release of Black and White in English in March ’11. At that time, my boards were on and so I didn’t play it. After I had done with all that CET crap, I downloaded Pokémon Black in May ’11. But the game is just supposed to be translation of Japanese versions, and at least in the earlier part of games, the storylines of Black and White do not differ much. Also, even though I played White in Japanese, I had basic idea of what’s going on. The point being, I was too bored to play that game again till the 7th badge on the slow speed of DS (yeah yeah, go on, kill me. 😐 ).
Now clearly, I am at fault. I should have completed Black in spite of that. And completing not for sake of completion, but since the game is awesome and I find it fun to play. And yes, note here, I’m not like most of you, I still want to play the game. I don’t think it is childish to play and watch Pokémon when you become 18 years old. Or maybe I’d like to rephrase as if it makes me childish, then so be it!
And here, I apologize the Generation V. For not remembering the names of most of the Pokémon (or at some points, not even knowing that a certain Pokémon exists). For not being updated with the anime. For saying Generation V was the worst generation ever. 😐
But I promise, I will complete Pokémon Black as soon as the mid-sems get over. Also Marathon-ing the Isshu episodes so that I’ll be updated with the anime.
Once again, sorry.
And now, “YAYYY!” @ announcement of Black 2 and White 2. I am looking forward towards Generation VI with the same excitement, same joy (and same gleamy eyes as they show in the anime! 😀 )!

… Jack of None!

January 30, 2012

On one fine evening, my friend Anmol had asked me what am I good at. I thought for a while and replied ‘nothing’. She thought I was being modest or ~. But it bugged me since then. And more I thought, more I realised that I am really good at nothing.

1. I am a socially awkward penguin. I can’t talk and get mixed into new people. I can’t speak out loudly in public what I am feeling. I can’t take initiative to do something in public. So communication skills – ZERO.

2. I can’t sing songs.

3. I can’t play any musical instrument.

4. I cant play any sport or game. I am probably the worst player in te Gulley cricket which we play. Well, there is not even a computer game which I can play excellently.

5. I am bad at English. My vocabulary is poor. I can’t even speak English fluently. If you use some English word which is slightly out of the normal usage, there is high probability that I won’t know its meaning. I am also bad at grammar.

6. Okay, that was about human languages, what about computers’? No, here too, I am bad programmer. I can’t learn any new programming language on my own. And I am also not thay good in the one which I know, C++.

7. Not like I am good at the rest of computer stuff. I am.. what they say.. n00b.

8. I can’t help people in awkward situations. Or do what I am supposed to do as a friend or a family member.

9. My likings and dislikings are mismatched with the group I find myself in. In most of the groups, I find myself unknown about the whole movie and TV world. In some, I am unaware of the latest songs. While in some groups, I am just too shy to say anything.

10. And yeah, maths. I remember my friend, Petey, said, “Do you really understand all these things, Tan?”, when I posted some weird Wikipedia link on #pfz. I answered something at that time, but it is a tough question indeed. Do I really understand all the stuff which I read? I must say, I am okay with the maths stuff which they teach for exams. But what about the rest of the stuff which I read? Yeah, like all that advanced calculus and ~. Am I really understanding that stuff or I am deceiving myself all the time? Even I don’t know the answer. Maybe I am like crazy cricket fans in India. They can’t even play cricket as good as to get selected in the school team, neither they don’t understand the technical details. But they still watch every cricket match religiously. Yeah, I must be like that!

Yeah, so these were the things which I could point out. I am very sure I can say, “yeah, that too!” When you will point out a new thing, because I am good at nothing. Maybe I am good for nothing too!

But hey! I have one special thing which all of you lack, ALL OF YOU! CONSCIOUSNESS! You all are NPCs. :>

We used Brick Break, and it’s super effective!

November 9, 2011

The story begins with my reading of my fellow g33k friend NiSh’s blog about his successful installation of CyanoGen Mod 7, a mod of Android, which is superior in looks as well as performance. So, on 7th November, I first read that post. I liked that mod on the first impression, and decided to install it on my phone. Earlier, I decided, I would do this after my semester exam, in the vacation, or at least in the so called Preparatory Leave.

DAY 1 : Night

But later, I asked my another fellow g33k friend Swaraj whether that mod is good. And he said, it’s so much beyond good, it’s awesome.

.:22:49:04:. <tan> does it work okay-ishly?
.:22:49:17:. <Dexter> o.o
.:22:49:23:. <Dexter> >okay-ishly
.:22:49:29:. <Dexter> UMAD
.:22:49:31:. <Dexter> it is
.:22:49:32:. <Dexter> like
.:22:49:33:. <Dexter> coal

So, I asked him, whether he will help me in installing the mod (as he is pro in such things), and he readily accepted it. But both of us didn’t know, that this is the start of the Doom!

At about 10:45 / 11 PM, we began, after backing up data from Titanium Backup (suggested by NiSh, which proved to be a lot useful in the end). First after downloading the all requirements, I flashed the clockworkmod. I backed up data using the internal tool of CWM (as suggested by Swaraj) and later wiped memory, internal cache, dalvik cache. Continuing, I flashed the so called “” and later applied the patch named “”. We hoped everything is fine, and we rebooted the phone, anticipating it to start with CM (the shortform we subsequently used for CyanogenMod, because of it’s too frequent use).

It started. Showed it’s usual screen saying ‘Samsung Galaxy Ace S5830’ with a blue triangle in top left corner. Ignored it, as it was a mod, and some things were bound to change. After that, it showed the logo of CM, a blue android on a skateboard, which has an animated arrow circling around it. The arrow was circling for more than one minute and I was getting worried. I told Swaraj, that it’s still not booting, and he assured that it takes some time for the first boot. Subsequently, it finally got passed to that screen. The home screen of CM appeared. I typed that on mIRC window and we both yay’d. Before I could do anything, the phone rebooted itself. I asked Swaraj about it, and he told that it sometimes happens. Then, it happened again, and again and AGAIN! We tried all those steps again, and again same thin. We started to worry, and it was already 11:45, so we both were feeling very sleepy.

Then, I asked him, whether we can revert back to original (aka vanilla in Civilization 4’s terminology) Android. We tried recovering the backup taken from CWM, with negative reult. He said, there was a way, and shoved me a slightly modified ROM of Gingerbread. I started downloading it at aroud 11:50 and at about 12:15 it was finished downloading.  Again I put it in mSD card, flashed it using CWM (our abbreviation of ClockWorkMod, again for the same reason). Again we crossed fingers, for it to work. It was already 12:20 AM of 8/11, and we were desperate to see it working. It got installed, and the above mentioned screen of ‘Samsung Galaxy Ace S5830’ was static for more than 2/3 minutes. I again started worrying and so did he. We again flashed the same ROM and again we got the same results.We decided, that the problem was serious, and it can’t be resolved in minutes. I requested him whether he can do a little research about the problem, and we decided to meet at 7:30 AM on the same day. Meanwhile, I was supposed to download the so-called stocks of Gingerbread (meaning original, as they are distributed). We both said goodbye, hoping that the next day comes with a hope to solve the issue. We both had (well, at least me) had disturbed sleep, becuase of the mess we did.Day 2 : Morning

On the next day, I woke up, at 7 of clock, before the decided time. I did a bit of googling about the problem and prepared links to shove to him when he wakes up.

I also saw that Swaraj tweeted NiSh about the problem and he suggested some solutions, on which we were going to work.

Finaly he woke up, and we knew we were up to serious business. So we tried flashing stocks via Odin, as suggested by NiSh. We tried that, and now the problem was different, that it used to reboot on its own after Samsung screen, and was trapped into a bootloop.
Then he shoved me another ROM, and unluckily the download speed was so low, that ETA was 1hour at 7:55 AM. Swaraj had to go to practicals at 9 AM and I had to go at 9:30. Meanwhile, we tried again with CM and stock, but no luck. I was almost sure that we had bricked my phone, but he was assuring me that there would be some way out.

Finally at 8:45 he had to go and again, I requested him to look for solutions after he is back, because I was to remain in college at least till 3 PM. In 9 to 9:30 again I did some googling and found a link, which I left for him on #pfz and went to college. I had to switch back to my old phone, which didn’t have phone numbers of my new classmates.

For the entire day, I was missing Ace badly, and as soon as I was done with maths class test, I rushed towards home. I hoped Swaraj would be there, waiting for me with some kind of solution.

Day 2 : Afternoon

After reaching home at 3:40, I turned on the screen of pc and poked Dexter, only to see that he wasn’t there. Then I started experimenting with the phone. The SIM card was in my old phone and the Ace was fully charged, so I did not have to worry about phone as well as battery. I again tried installing CM, and it worked. IT WORKED! I was very happy and tweeted NiSh about it. He also congratulated me and suggested me some themes and ~. Then, I decided to put my SIM card in Ace, as it was apparently fine. I put the SIM, and again Bootloop. After trying rebooting a couple of times, I removed SIM, and it worked. It didn’t take much time for me to realise that the problem was with my SIM card and CM. I tweeted NiSh about this, and he gave me a link about it. I tried the solutions suggested there, but no luck. I also tried flashing other ROMs, again with no luck. I was worried as I was trying things on my own helplessly, as Swaraj wasn’t around there.

At 5:30/ 5:45, Swaraj showed up on IRC. We quickly got back to work. We decided that both stock and CM were not working, so after a short discussion, we decided to install VillainMod, again a custom android mod, which seemed to be the only solution. The download was of 100~ MB and took some time, till then Swaraj found some tutorials about installing it. The existing thing on the phone was (luckily) not-working-stock. We flashed VM using Odin, and crossed the fingers. To our greatest happiness, it worked, with and without SIM card.

Then, he asked me whether I still want to install CM. Now I was sure that I could now unbrick phone at any time, I gave an affirmative reply. We again flashed CM on phone and again it went to bootloop. Though this wasn’t very unexpected, we felt bad and decided to switch back to VM. I flashed VM again using Odin and again it was stuck in bootloop. We were disappointed, as VM was expected to be reliable. Smartly, Swaraj told me to flash stock and again install VM over it. Slightly wondering whether it will make any difference, I did so. And finally it worked.

After near about 20 hours, we unbricked my phone successfully. Here, we includes NiSh also, because he helped us a lot from time to time from twitter by giving links and ~.

After that, I recovered everything by using Titanium backup, and now apparently, my phone is working as it used to be (i.e. finely), well till this moment.

SO THIS IS HOW WE USED BRICK BREAK AND IT WAS SUPER EFFECTIVE!! (I am sure, very few people will get this.. ;D)

Also, if you find solution to CM’s bootloop, then do inform us, because I badly want to have it on my phone.