Monday, December 17, 2007

Exam Time and Emma

Exam time is usually the most imaginative time for me. It is when I am completely burdened with ToDos, that I tend to loose my concentration and wander into reveries. I imagine things that I would do after the exams, things that should be done in general, future planning or simply a plot for a blockbuster movie.
It was Monday night and I had to submit a project by Tuesday midnight. I was unable to make the simulations run and the report was not even half complete. I decided to stay in the lab for the night hoping to finish things till dawn have a sweet morning sleep. At approximately 2am, I ventured into the story of how Emma tried to take over the internet.

Of course, Emma was not a girl that I was fantasizing about; instead she was an artificially intelligent program, written by a graduate student in midwest, which employed human like memory structure consisting of nodes containing concepts linked to each other in virtual hyper space. I spent approximately two hours working on the story and amount of creativity I had generated is enough to make two movies. On the downside, I had to stay in the lab for the next 23 hours and went home next day at 1am. Unfortunately, I still have my last exam tomorrow which means I will be telling you the story some other (exam) day.

Sunday, March 25, 2007

Approximate Square Root

Unlike most of my friends who simply dove into the JEE preparation after announcement of their tenth results, I spent my summers reading Asimov and playing with numbers. In fact more than half the time of my class XI was spent just playing with Mathematics, rather than solving problems of the correspondence courses and joining coaching classes. I remember the thrill and excitement that came from exploring the woods of numbers and the freedom to choose my own direction. In fact my interest in mathematics could largely be attributed to that period alone.

I discovered this formula way back in the starting of class XI. The formula is startlingly simple and gives good results in most cases. Furthermore, I barely knew enough calculus at that time to actually prove it and I am always amazed at how useful it has been.

Given a number x, choose any a such that a^2 is the closest to x (and you remember the 'a and a^2' pair; that usually happens with integers). The approximate square root of x is simply (x+a^2)/2a. One could alternatively express it as a+(x-a^2)/2a if that sounds easier. The proof is a simple class XI exercise in calculus.

Around that time I read another approximate formula for square root in Mathematics Today. Comparing the two, I found that their formula was much less accurate and had a smaller domain of applicability. I remember that I was very encouraged by this fact and even wrote to them, though they did not publish my work.

Thursday, February 22, 2007

Visualizing Complex Signals

Since I have been in third year, I have been dealing with complex signals. Now real signals are always easy to visualize but the same is not the case with complex signals. Since a large portion of my work involves getting a feeling of what is going on, trying to see the signals from an engineer's eye is always considered a better approach than simply doing algebraic juggling.

The most logical method that comes to mind is expanding of the real axis into an entire plane facing the time axis. A complex exponential like exp(jwt) will then appear to be a spiraling staircase. An extremely useful matlab program which takes in a complex signal and outputs a 3D complex plot is given below:

function complexplot(x,t,connect)
% This function plots complex sequences in 3D line format
% x is the given complex sequence (1D)
% t is the optional time axis. By default t = 1:length(x)
% put connect = 1 if you want to connect the plot with the axis

%% Input validation
if (nargin <>
connect = 0;
end
if (nargin <2)
t = 1:length(x);
end

%% plotting 3D
x1 = real(x);
y1 = imag(x);
axisline = zeros(size(t));
plot3(axisline,t,axisline,'k');
hold on
plot3(x1,t,y1);

%% Connect lines
if(connect ==1)
for k = 1:length(t)
plot3([x1(k) 0],[t(k) t(k)],[y1(k) 0],'r')
end
end

view([90 0])
hold off