<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Run Program Run</title>
	<atom:link href="http://buggeddebugger.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://buggeddebugger.wordpress.com</link>
	<description>In pursuit of the perfect code</description>
	<lastBuildDate>Tue, 21 Nov 2006 18:56:48 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='buggeddebugger.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9bede241480caae8dad8676c91c6feea?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Run Program Run</title>
		<link>http://buggeddebugger.wordpress.com</link>
	</image>
			<item>
		<title>No Updates</title>
		<link>http://buggeddebugger.wordpress.com/2006/11/22/no-updates/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/11/22/no-updates/#comments</comments>
		<pubDate>Tue, 21 Nov 2006 18:56:48 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://buggeddebugger.wordpress.com/2006/11/22/no-updates/</guid>
		<description><![CDATA[There haven&#8217;t been any posts for a long time &#8211; most of this semester. Even the last one is regarding the farcical SEO competition at Shaastra. I&#8217;ve noticed this blog still attracts hits (maybe a little more than before in recent times) and that&#8217;s surprising, considering it&#8217;s been months since I last posted! People are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=49&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There haven&#8217;t been any posts for a long time &#8211; most of this semester. Even the last one is regarding the farcical SEO competition at Shaastra. I&#8217;ve noticed this blog still attracts hits (maybe a little more than before in recent times) and that&#8217;s surprising, considering it&#8217;s been months since I last posted! People are actually searching for some of the stuff that I&#8217;ve posted before &#8211; guess there are others with similar interests <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The winter vacation is around the corner and I have a lot of stuff planned for it &#8211; programming or otherwise. The main objective is of course to learn Python (why am I so obsessed with learning this language??). But I&#8217;ve decided on that and maybe some of the inspiration for learning Python comes from <a href="http://mayavi.sourceforge.net/">this</a>. But seriously, couldn&#8217;t that just as well been written in C++? Or was it  the necessity of a GUI (Python comes along with Tkinter but I guess we&#8217;ll need to use something else like GTK for C++). Somehow I think I just want to learn something new from scratch rather than unlearn and learn a programming language that I&#8217;m used to, namely C++.</p>
<p>I&#8217;ve also figured out how to set up my website with the web space provided by the Insti and I hope that I can get to working on a website soon. I haven&#8217;t really been that net-active for a while but hey, what&#8217;re the hols for? And I just realised that the title of this post is the same as the last one on my other blog. And of course, I have been much busier than usual this year. Someone told me that if I had a blog, it&#8217;d be nice if I updated it as often as I could, because that&#8217;d give people a reason to visit it more often. I&#8217;m terrible at managing my time and I guess I&#8217;d rather finish my other stuff than post about them on my blog <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  I actually have a few posts that I&#8217;d begun working on ages ago that I finally never got around to posting. Anyway, all in good time&#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=49&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/11/22/no-updates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>
	</item>
		<item>
		<title>Shaastra 2006 Search Engine Optimisation</title>
		<link>http://buggeddebugger.wordpress.com/2006/08/21/shaastra-2006-search-engine-optimisation/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/08/21/shaastra-2006-search-engine-optimisation/#comments</comments>
		<pubDate>Mon, 21 Aug 2006 09:51:29 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Other Blogs]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/08/21/shaastra-2006-search-engine-optimisation/</guid>
		<description><![CDATA[
&#160;

I decided to take part in this year&#8217;s Shaastra&#8217;s Search Engine Optimisation event.
Check out my website entry for the event!
Shaastra 2006 is the annual technical festival of IIT Madras. There are loads of events to take part in, both for the hardcore tech enthusiast as well as for somene who’s just walked in to take [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=48&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="center"><a href="http://www.shaastra.org/"><img src="http://shaastraseo.files.wordpress.com/2006/08/shaastralogosmall.JPG" alt="Shaastra Logo" /></a></p>
<p class="entry">&nbsp;</p>
<p align="center"><a href="http://www.shaastra.org/"><img src="http://shaastraseo.files.wordpress.com/2006/08/shaastra2006small.jpg" alt="Shaastra2006" /></a></p>
<p align="center">I decided to take part in this year&#8217;s Shaastra&#8217;s Search Engine Optimisation event.</p>
<p align="center"><a href="http://sadraytracer.wordpress.com">Check out my website entry for the event!</a></p>
<p><a href="http://www.shaastra.org/">Shaastra 2006</a> is the annual technical festival of IIT Madras. There are loads of events to take part in, both for the hardcore tech enthusiast as well as for somene who’s just walked in to take a look. Check out the <a href="http://www.shaastra.org/">Shaastra website</a> for more info.</p>
<p><a href="http://en.wikipedia.org/wiki/Search_engine_optimization">Search Engine Optimisation</a> is all about building your website such that it features high among the search results in popular search engines like Google, Yahoo or Altavista when certain keywords are search for.</p>
<p>The search terms that we have to optimise the website for are Coecelanth, Durbatuluk, Equivocate, Shaastra and Zeppelin. I seem have got into the race quite late and there are so many blogs that are already showing up in the search results. Anyway, might as well give it a shot and see what happens.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/48/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/48/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=48&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/08/21/shaastra-2006-search-engine-optimisation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>

		<media:content url="http://shaastraseo.files.wordpress.com/2006/08/shaastralogosmall.JPG" medium="image">
			<media:title type="html">Shaastra Logo</media:title>
		</media:content>

		<media:content url="http://shaastraseo.files.wordpress.com/2006/08/shaastra2006small.jpg" medium="image">
			<media:title type="html">Shaastra2006</media:title>
		</media:content>
	</item>
		<item>
		<title>Stormy Seas Ahead</title>
		<link>http://buggeddebugger.wordpress.com/2006/08/08/stormy-seas-ahead/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/08/08/stormy-seas-ahead/#comments</comments>
		<pubDate>Tue, 08 Aug 2006 17:13:40 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Numerical methods]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/08/08/stormy-seas-ahead/</guid>
		<description><![CDATA[College has finally started after a long three months of vacation, and I really don&#8217;t know where this numerical methods programming is going to head, considering that progress was terrible during the hols. And now with even less free time, I&#8217;m not sure about what we&#8217;re going to do. But some advantages with being at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=41&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>College has finally started after a long three months of vacation, and I really don&#8217;t know where this numerical methods programming is going to head, considering that progress was terrible during the hols. And now with even less free time, I&#8217;m not sure about what we&#8217;re going to do. But some advantages with being at the hostel are that I can spend longer hours in front of the computer and my friend and I can work together. Another big advantage is that Linux works here (at home, I used the same CPU but a different monitor, and SuSE 10.0 refused to work because just that one change) and both my friend and I can work on the standard GCC compiler.</p>
<p>Okay, I just realised I have this major problem with Suse 10.0 which I figure a lot of others have too, looking at all the forums on the net. I am not able to install softwares from RPMs that are on the hard drive and keep getting the error &#8220;Installation sources not refreshed&#8221;. I found out that this was because the hard drive was a static source. I could install softwares from online repositories without any problems but that&#8217;s not always convenient. I tried out the suggestions to get rid of the problem but they were in vain. I&#8217;m seriously considering changing my distro, but I guess I&#8217;ll wait. I wanted to start working on Linux more, but then every time I decide to do that, some problem or the other crops up. If it&#8217;s only GCC that I may finally want to use, I guess I shouldn&#8217;t be in too much of a hurry to change, because that works fine.</p>
<p>Right now work on Laplace&#8217;s Equation is coming to a standstill. We haven&#8217;t even looked at it ever since college started. I don&#8217;t get it. It&#8217;s something so simple. Yet we procrastinate so much. I wonder what we&#8217;ll do once we get to the next stage. I just thought I&#8217;d write down some observations. Hopefully we&#8217;ll get back to it soon.</p>
<p>The supposedly more efficient method is taking more time, and I think this is because it has more calculations involved (as in float multiplications and divisions) to determine parameters for different mesh sizes. I also feel that converging from an approximate value to machine precision might take a lot more time than reaching that average value in the first place. But of course, this argument may be wrong as this method is a well known one. And supposedly it&#8217;s working alright for my friend. Anyway, we decided it&#8217;s best we started working together more rather than do things separately and then analyse each other&#8217;s work.</p>
<p>One thing about the run times that took me a log time to realise was that for a doubling of the mesh size, the run time ncreased by approximately 16 times. If we assume that the time taken per grid point per iteration is constant for all mesh sizes (which is a reasonable assumption and one that had been verified from data collected), then a doubling of mesh size should increase the total time by a factorr of four (since number of grid points are quadrupled). But the number of iterations also increase by four times. I didn&#8217;t understand why this should happen but I guess I haven&#8217;t given it enough thought yet.</p>
<p>There&#8217;s also other stuff about what checks we use to determine convergence, improving the efficiency of the Gauss Elimination method to solve the whole system of linear equations obtained from the grid, and to check the error in value between the real solution and that obtained by using numerical methods. I think I&#8217;m starting to get frustrated writing about this. I could go on and on. But it only makes me think of how much more I have left to do. I guess I&#8217;ll stop here.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=41&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/08/08/stormy-seas-ahead/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>
	</item>
		<item>
		<title>Notepad++</title>
		<link>http://buggeddebugger.wordpress.com/2006/08/02/notepad/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/08/02/notepad/#comments</comments>
		<pubDate>Wed, 02 Aug 2006 18:21:58 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/08/02/notepad/</guid>
		<description><![CDATA[I discovered Notepad++ (a text editor) only today. I decided that it was about time I abandoned Notepad (I work almost entirely on the Windows platform) for a more programming-friendly text editor. So I began searching on Wikipedia for the best text editor. I love the way Wikipedia arranges its software pages. There&#8217;s always a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=42&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I discovered <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> (a text editor) only today. I decided that it was about time I abandoned Notepad (I work almost entirely on the Windows platform) for a more programming-friendly text editor. So I began searching on Wikipedia for the best text editor. I love the way Wikipedia arranges its software pages. There&#8217;s always a page available with a list of softwares of a particular category (text editors, in this case) and there always a software comparison page. Of course, most of the softwares have a page of their own.</p>
<p>I went to the <a href="http://en.wikipedia.org/wiki/List_of_text_editors">list of text editors</a> and randomly started clicking on the different links, and I came to the <a href="http://en.wikipedia.org/wiki/Notepad++">Notepad++ page</a>. The description was perfect! It seemed to have everything that I wanted and supports every programming language that I can think of! And of course its features too. It was tailor-made for programmers. So I downloaded and installed it immediately.</p>
<p>I think this is going to be one of the more useful softwares on my comp. I have this whole cartload of softwares installed, most of which I never use. Every time I see a new software, I get excited by what it can do and install it immediately. It then just lies there occupying space and I forget about it.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=42&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/08/02/notepad/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>
	</item>
		<item>
		<title>Some progress</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/29/some-progress/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/29/some-progress/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 22:38:14 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Numerical methods]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/07/29/some-progress/</guid>
		<description><![CDATA[We finally continued with our program to solve Laplace&#8217;s Equation, after weeks of delay. First, I was relieved to find out  that it was not my program that was terribly inefficient but that programs ran much faster on his computer (due to a better configuration, and probably because he was running them on 64-bit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=37&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We finally continued with our program to solve <a href="http://buggeddebugger.wordpress.com/2006/06/30/laplaces-equation/">Laplace&#8217;s Equation</a>, after weeks of delay. First, I was relieved to find out  that it was not my program that was terribly inefficient but that programs ran much faster on his computer (due to a better configuration, and probably because he was running them on 64-bit Gentoo Linux). I also learnt that using malloc to store my data in dynamic memory rather than using the vector data type made the program run atleast four times faster.</p>
<blockquote><p>double *phi=(double *)malloc(sizeof(double) * (num*num));<br />
double elementvalue=phi[i];</p></blockquote>
<p>malloc returns void data type and therefore has to be typecast when used to create double arrays. The parameter that need to be passed in the number of bytes needed to be allocated. Since we are created a an array of size num*num of double data type, the parameter is as shown above. Using this instead of</p>
<blockquote><p>vector&lt;double&gt; phi;<br />
phi.resize(num*num);</p></blockquote>
<p>On problem that I did encounter while using malloc was that the number of iterations required to converge on the solution increased. This was weird, as we were using the same double data but only shifted to pointers. So there was no change in the accuracy to which the solution was calculated. When I asked my prof, he said that it was because malloc did not initialise all the new memory locations to zero. Different initial values for the problem would definitely affect the speed of convergence. So I had to use the calloc function instead:</p>
<blockquote><p>double *phi=(double *)calloc(num*num,sizeof(double));</p></blockquote>
<p>calloc also return void, and requires two parameters. First is the size of the array (num*num) and second is the size of each each element (sizeof(double)).</p>
<p>We were then asked to try another method to make our program still faster. I mentioned that the initial values that the array elements were assigned determined how fast we would converge to the solution. If the initial values were close to the actual solution, then convergence would obviously be faster (I don&#8217;t suppose this is always true, but for Laplace&#8217;s Equation, I think it can be proved mathematically that you get closer to the actual solution with each iteration). So we try to find out appropriate initial values first.</p>
<p>This method uses mesh refinement, i.e. we first solve for a mesh that is more coarse than required. Then we make the mesh finer by inserting intermediate grid points and  find out their approximate values using the finite difference formula for Laplace&#8217;s Equation:</p>
<blockquote><p>φ(x,y) = [φ(x+h,y) + φ(x-h,y) + φ(x,y+h) + φ(x,y-h)] / 4</p></blockquote>
<p>And then apply the iteration process to this mesh. Now we will find that convergence is actually much faster. How we make the mesh finer is demonstrated by the following figures. The above equation is not restricted to one set of coordinate axes alone and can be applied to any square mesh rotated in plane. The figures mark the unknown grid points and the known adjacent elements from which the approximate value can be determined.</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/mesh1.JPG" alt="mesh1.JPG" /></p>
<p align="center">&nbsp;</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/mesh2.JPG" alt="mesh2.JPG" /></p>
<p align="center">&nbsp;</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/mesh3.JPG" alt="mesh3.JPG" /></p>
<p align="left">Note that the dark red grid points inserted during the second refinement are known, as they are part of the boundary and we are given the boundary conditions.</p>
<p align="left"><b>Update:</b><br />
I&#8217;ve deleted some of the stuff that I had said here before. Basically I thought that the above technique made the program run much faster. And tests proved so, until I realised that I had made a mistake in implementation of the algorithm. In fact, this procedure actually took longer than without mesh refinement. More in a later post.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=37&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/29/some-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/mesh1.JPG" medium="image">
			<media:title type="html">mesh1.JPG</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/mesh2.JPG" medium="image">
			<media:title type="html">mesh2.JPG</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/mesh3.JPG" medium="image">
			<media:title type="html">mesh3.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>Google in Wikipedia Greasemonkey Script</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/26/google-in-wikipedia-greasemonkey-script/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/26/google-in-wikipedia-greasemonkey-script/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 22:45:48 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Greasemonkey]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/07/26/google-in-wikipedia-greasemonkey-script/</guid>
		<description><![CDATA[Function:
It inserts links to Google Web and Images searches in any Wikipedia article, that use the article&#8217;s title as the search phrase. The links are intended to appear below the article title.
Screenshot:
 Click to Enlarge
Comments:

Works for all Wikipedia pages in all languages, irrespective of whether they are articles or other Wikipedia related pages. But their [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=36&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>Function:<br />
</b>It inserts links to Google Web and Images searches in any Wikipedia article, that use the article&#8217;s title as the search phrase. The links are intended to appear below the article title.</p>
<p><b>Screenshot:</b></p>
<p><a href="http://buggeddebugger.files.wordpress.com/2006/07/gm_scshot.JPG"><img src="http://buggeddebugger.files.wordpress.com/2006/07/gm_scshot.thumbnail.JPG" alt="Google in Wiki Screenshot" /></a> Click to Enlarge</p>
<p><b>Comments:</b></p>
<ul>
<li>Works for all Wikipedia pages in all languages, irrespective of whether they are articles or other Wikipedia related pages. But their position on screen is non-intrusive and does not affect normal browsing as far as I have seen.</li>
<li>For few pages, the links may not appear below the article but in some other part of the screen. The articles in which I experienced this problem were mostly ones about sportspersons. These articles usually begin with a career statistics table and the links get placed among the text within the table.</li>
<li>Apparently the problem also exists for articles on comic book heros (e.g. Superman, Spiderman). They&#8217;ve got info tables of their own too.</li>
<li>The <a href="http://userscripts.org/scripts/show/4859">userscripts.org page</a> for this script.</li>
<li>More info about how I got to writing the script can be found <a href="http://buggeddebugger.wordpress.com/2006/07/26/my-first-greasemonkey-script/">here</a>.</li>
</ul>
<p><a href="http://userscripts.org/scripts/source/4859.user.js">Install Google in Wikipedia userscript</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=36&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/26/google-in-wikipedia-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/gm_scshot.thumbnail.JPG" medium="image">
			<media:title type="html">Google in Wiki Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>My First Greasemonkey Script</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/26/my-first-greasemonkey-script/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/26/my-first-greasemonkey-script/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 21:33:30 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[HTML/XML/XHTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/07/26/my-first-greasemonkey-script/</guid>
		<description><![CDATA[I was going to post on my recently concluded Sudoku research, but something amazing happened so quickly that I still can&#8217;t believe I did it. Yes! I wrote my first ever Greasemonkey script!!
I recently realised Greasemonkey scripts could do some really cool things. I guess I was also partly inspired by LouCypher&#8217;s blog, which I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=32&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was going to post on my recently concluded Sudoku research, but something amazing happened so quickly that I still can&#8217;t believe I did it. Yes! I wrote my first ever Greasemonkey script!!</p>
<p>I recently realised Greasemonkey scripts could do some really cool things. I guess I was also partly inspired by <a href="http://loucypher.wordpress.com">LouCypher&#8217;s blog</a>, which I stumbled upon while looking for a script that would help me add Technorati tags at the end of my blog posts.</p>
<p>Seeing that Greasemonkey basically used Javascript and that I was interested in Javascript, I decided to look for help on using Greasemonkey, and the best search result led me to downloading an eBook, <a href="http://diveintogreasemonkey.org/">Dive Into Greasemonkey</a>. And after downloading, I realised that I already had it on my comp, just that I hadn&#8217;t even looked at it ever since I downloaded it! I&#8217;ve also uploaded the book in the <a href="http://buggeddebugger.wordpress.com/ebooks/">eBooks</a> section of the blog.</p>
<p>So I dove right into it and wow! What a book! Everything was explained so well and it gave some excellent links. One of them was to <a href="http://www.squarefree.com/bookmarklets/webdevel.html">Jesse&#8217;s Web Development Bookmarklets</a>. This page has some pretty useful bookmarklets and the two i found most useful while writing the script were shell and jsenv.</p>
<p>shell is a command line interface where you can play around with Javascript commands and get to know the layout of the website and the different commands that let you access the different DOM Objects. jsenv is a Javascript Environment where you can write and execute your own Javascript and view the results of the scripts on the corresponding page live. You will also find the Firefox extensions DOM Inspector (that needs to be installed while installing Firefox) and <a href="https://addons.mozilla.org/firefox/1913/">InspectThis</a> very useful. Actually this is explained in Dive Into Greasemonkey, but I thought I might as well mention them.</p>
<p>I was hardly through with the first twenty pages before I decided that I had to write my own script. It&#8217;d be a very basic one but one that would be pretty useful. I had a great idea that I thought I should work on. Many Wikipedia articles don&#8217;t have pictures, and I&#8217;d have to Google for them. So I thought I&#8217;d just insert links within the article that would directly search for what I want. I decided to use the title of the article as the search term and the link&#8217;s URL needed to be (I decided to add Google Web Search as well):</p>
<blockquote><p>for Google Web Search,<br />
http://www.google.com/search?hl=en&amp;q=&lt;search terms&gt;&amp;btnG=Search&amp;meta=</p>
<p>for Google Images Search,<br />
http://images.google.co.in/images?svnum=10&amp;hl=en&amp;lr=&amp;q=&lt;search terms&gt;&amp;btnG=Search</p></blockquote>
<p>where &lt;search terms&gt; can be replaced by whatever I want. In Google, if you type Hello World and search for it then &lt;search term&gt;=Hello+World. Or if you had used quotes, as in &#8220;Hello World&#8221;, it&#8217;d be %22Hello+World%22. Now if we made &lt;search term&gt;=Hello World with a space and used the URL, it still seemed to work, with the space being replaced by %20 when I hit enter(I guess these numbers are equivalent to certain special characters, here for double quotes and space). So there was no problem in just inserting the Wikipedia article title in place of &lt;search terms&gt;.</p>
<p>The getElementsByTagName functions in Javascript is what I used to obtain the required data that I wanted. It is a member of the document class (as everything is). The DOM inspector and the shell bookmarklet is most useful here.</p>
<blockquote><p>var heading=document.getElementsByTagName(&#8216;h1&#8242;);</p></blockquote>
<p>This function locates all parts of the HTML document with the &lt;h1&gt; tag (level-one heading tag) and in all Wikipedia articles, the title is in the first level-one heading tag. So its contents can be accessed as</p>
<blockquote><p>heading[0].innerHTML</p></blockquote>
<p>innerHTML gives the HTML code contained by the tag. So now we have our search term. Next we have to modify the HTML in the article. The paragraphs in every article are in the &lt;p&gt; tags. I thought I&#8217;ll provide the search links in the beginning of every article. So I need to edit the first paragraph.</p>
<blockquote><p>var paragraphs=getElementsByTagName(&#8216;p&#8217;);</p></blockquote>
<p>p[0].innerHTML stores the first paragraph&#8217;s contents. There is one catch though. Sometimes the first paragraph of the article is not p[0]. If the article has some text in a table concerning the article, then that is sometimes p[0], and the links get inserted within  the table. I haven&#8217;t figured out how to fix this yet, and this is probably the biggest problem with my script. This happens a lot in articles about sportspersons because they usually have a career statistics table in the beginning.</p>
<p>Now all that&#8217;s left is to insert the required link. This is done by using string manipulations to modify p[0].innerHTML and inserting the tag for placing a link, namely the &lt;a&gt; tag. You can check out the code for the whole script</p>
<p>Another thing to note is that the script affects all Wikipedia pages, whether it&#8217;s the main page, user page, help page or anything that is of the type http://*.wikipedia.org/wiki/*. But then as far as I&#8217;ve seen, the links aren&#8217;t in very intrusive locations that may affect normal browsing. So that&#8217;s not a big deal. I find this script really helpful and I guess others might find it useful too.</p>
<p>You can find the script <a href="http://userscripts.org/scripts/source/4859.user.js">here</a>.</p>
<p>Here&#8217;s a list of resources that you might find useful. <a href="http://diveintogreasemonkey.org/">Dive Into Greasemonkey</a> is a great place to start. There are many example scripts available for download from their main site. Javascript Reference can be found at <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference">Mozilla Developers site</a> and at <a href="http://docs.sun.com/source/816-6408-10/">Sun</a>. You can also find HTML Reference Guides at <a href="http://www.w3schools.com/tags/ref_byfunc.asp">W3Schools</a>, <a href="http://www.htmlhelp.com/reference/html40/olist.html">htmlhelp</a> and <a href="http://www.html-reference.com/">html-reference</a>.</p>
<p>I can’t wait to learn more Javascript and get an idea of all that Javascript can do. I think it has a lot of potential, what with AJAX (Asynchronous Javascript &amp; XML) revolutionising the web and Javascript being used extensively these days.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=32&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/26/my-first-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>
	</item>
		<item>
		<title>Some Random Thoughts</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/18/some-random-thoughts/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/18/some-random-thoughts/#comments</comments>
		<pubDate>Mon, 17 Jul 2006 22:40:02 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/07/18/some-random-thoughts/</guid>
		<description><![CDATA[I don&#8217;t think I will be posting regularly because college is starting soon and I have been caught up with some other work. Programming has taken somewhat of a backseat, which means my learning process is impeded. Last thing I thought about doing was writing a Su Do Ku solver. I had tried writing one [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=23&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I don&#8217;t think I will be posting regularly because college is starting soon and I have been caught up with some other work. Programming has taken somewhat of a backseat, which means my learning process is impeded. Last thing I thought about doing was writing a Su Do Ku solver. I had tried writing one earlier but had left it incomplete (like so many other things that I do) and thought I should get back to it. Had a brief look at the program and then decided to perfect it sometime soon.  I just wanted to post a few random thoughts that were in my mind.</p>
<p><a href="http://msdn.microsoft.com/vstudio/express/">Visual Studio 2005 Express Edition</a> &#8211; this is pretty old news but I thought I should write about it. Microsoft has decided to being out the Express Edition for home users and hobbyists. It&#8217;s a stripped down version of their Visual Studio Suite and it&#8217;s available for download on their webiste &#8211; Absolutely Free! Now that&#8217;s nice.</p>
<p>I also saw this link to Microsoft&#8217;s <a href="http://msdn.microsoft.com/coding4fun/">coding4fun</a>. Of course it&#8217;s fun because it&#8217;s all related to games, entertainment and stuff, but the kind of programming they do still seems out of reach. I&#8217;ve realised how much experience and time you require to become a good programmer. Just to write a Firefox extension, I think you need to know quite a lot. That&#8217;ll be something I&#8217;d like to do in the future.</p>
<p>I happened to come across <a href="http://www.google.com/notebook/public/03973726777279038306/BDS00IgoQ3NiF8MQh">my friend&#8217;s Google Notebook on Javascript</a> and I found it a pretty good reference for Javascript beginners. And I felt relieved that Javascript is somewhat like Actionscript (I think Actionscript was based on Javascript) and hopefully I&#8217;ll be able to learn it faster. Most of his notes (rather, all) are from the Javascript section of the <a href="http://www.w3schools.com/">W3Schools</a> site, which I found pretty impressive. It&#8217;s got free tutorials on everything related to web development. They&#8217;ve also got a <a href="http://www.w3schools.com/js/js_examples.asp">whole load of examples</a> which you can edit online, and view the results on their website, which I thought was pretty cool.</p>
<p>Here&#8217;s some disappointing news for me. The guy whom I&#8217;m working with on the <a href="http://buggeddebugger.wordpress.com/2006/06/30/laplaces-equation/">Laplace&#8217;s Equation</a> solver program wrote the same thing using malloc for dynamic memory usage to store the required values. He has a pretty high end computer, with a 64-bit Linux OS (Gentoo I think) installed on it. And he took just about 8 minutes for a 1000&#215;1000 grid!!! Thats a zillion time faster than what I had tried! Worse configuration? Windows? Visual C++? Other running programs? 32-bit OS? Did all these things make it worse or was it just the dynamic data created using malloc vs. vector data type?</p>
<p>The code he described to me (over IM) was:</p>
<blockquote>
<p align="left">float *u=malloc(num*num); //num*num is the size of the grid<br />
element=u[n]; //just use it like a normal array</p></blockquote>
<p align="left">I haven&#8217;t had a look at the full source code yet and have asked him for it, but he says there&#8217;s not much difference elsewhere.</p>
<hr />
<p><b>Technorati Tags:</b> <a href="http://technorati.com/tags/buggeddebugger" rel="tag">buggeddebugger</a>, <a href="http://technorati.com/tags/thoughts" rel="tag">thoughts</a>, <a href="http://technorati.com/tags/javascript" rel="tag">javascript</a>, <a href="http://technorati.com/tags/visual" rel="tag">visual</a>, <a href="http://technorati.com/tags/studio" rel="tag">studio</a>, <a href="http://technorati.com/tags/express" rel="tag">express</a>, <a href="http://technorati.com/tags/c++" rel="tag">c++</a>, <a href="http://technorati.com/tags/coding" rel="tag">coding</a>, <a href="http://technorati.com/tags/efficiency" rel="tag">efficiency</a>, <a href="http://technorati.com/tags/malloc" rel="tag">malloc</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=23&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/18/some-random-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>
	</item>
		<item>
		<title>The Mandelbrot Set &#8211; on Flash</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/14/the-mandelbrot-set-on-flash/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/14/the-mandelbrot-set-on-flash/#comments</comments>
		<pubDate>Thu, 13 Jul 2006 21:46:21 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Mathematics]]></category>

		<guid isPermaLink="false">http://buggeddebugger.wordpress.com/2006/07/14/the-mandelbrot-set-on-flash/</guid>
		<description><![CDATA[I went back to drawing the Mandelbrot set. Ah&#8230; one of the most beautiful pictures ever seen, both aesthetically and philosophically. It has the whole of infinity contained within it, yet you can see the whole of it. You won&#8217;t be able to find more diversity in a single image. One of the mot famous [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=21&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I went back to drawing the <a href="http://en.wikipedia.org/wiki/Mandelbrot_Set">Mandelbrot set</a>. Ah&#8230; one of the most beautiful pictures ever seen, both aesthetically and philosophically. It has the whole of infinity contained within it, yet you can see the whole of it. You won&#8217;t be able to find more diversity in a single image. One of the mot famous  pictures in mathematics, it is the symbol for all of fractals. Surprisingly, it is of dimension 2.</p>
<p>The Mandelbrot set is plotted on the complex plane as a result of a simple iteration. Traverse every point on the plane. Square it  add it to itself. Keep doing this until the value converges or goes to infinity, and depending on what happens, mark the point black or white. If the modulus of the complex number exceeds 2, we are assured of it proceeding to infinity. Else we keep checking till a certain number of iterations.</p>
<p>Now this seems pretty simple and I first tried plotting on a 640&#215;480 screen with 100 iterations per point. I kept getting errors that said the script was taking too long. So I kept tinkering with all the values till I finally settled at a 320&#215;240 resolution screen with 50 iterations. This was my final code:</p>
<blockquote><p>this.createEmptyMovieClip(&#8220;mandel&#8221;, 1);<br />
var s:Number = 80;//scale &#8211; number of pixels equal to 1 unit<br />
var i:Number = 0;<br />
var j:Number = 0;<br />
var n:Number = 50;//Number of iterations<br />
var flag:Boolean = false;<br />
mandel.lineStyle(1, 0&#215;000000, 100);<br />
for (i=0; i&lt;320; i++) {<br />
for (j=0; j&lt;240; j++) {<br />
var X:Number = (i-160)/s;<br />
var Y:Number = (120-j)/s;<br />
var st:Number = 0;<br />
flag = false;<br />
do {<br />
X = (X*X)-(Y*Y)+X;<br />
Y = (2*X*Y)+Y;<br />
st++;<br />
if ((Math.abs(X)&gt;2) || (Math.abs(Y)&gt;2)) {<br />
flag = true;<br />
}<br />
} while ((st&lt;n) &amp;&amp; (!flag));<br />
if (flag) {<br />
mandel.moveTo(i, j);<br />
mandel.lineTo(i+1, j+1);<br />
}<br />
}<br />
}</p></blockquote>
<p>The required iteration would proceed as:</p>
<blockquote><p>z, z²+z, (z²+z)²+(z²+z)&#8230; and so on</p></blockquote>
<p>And so the equation in cartesian coordinates would be:</p>
<blockquote><p>z²+ z = [(x²-y²) + 2xyi] + (x+yi)<br />
new x = (x²-y²) + x<br />
new y = 2xy + y</p></blockquote>
<p>which is exactly what I have done. But the final output I got was this:</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/mandelbrot4-508012320x240.JPG" alt="mandelbrot4-508012320x240.JPG" /><br />
Note that ActionScript does not have a function to  plot a single pixel (or I haven&#8217;t discovered one yet). I had to draw a line from (i,j) to (i+1,j+1), which seemed to do pretty well.</p>
<p>I tried and I tried, but I couldn&#8217;t figure out where the problem was. I have a bad feeling I might have overlooked something terribly obvious. The image does look fractal-like, but in no way does it resemble the Mandelbrot set.</p>
<p>And even this time, I did get the &#8220;script taking too long&#8221; warning but then if I choose to allow it to run, it takes it&#8217;s time and finishes the job, instead of displaying something half done. But every time I cut the size of the output or the number of iterations, the number or messages that ask me to abort get less. Sometimes I didn&#8217;t even get the message and the output just appeared after a few seconds. It&#8217;s very obvious ActionScript was not made for heavy duty work and is just for tiny calculations here and there. I guess this took ActionScript to it&#8217;s limit.</p>
<p>But my problem is still unsolved. I&#8217;ll just have to leave it for another day. Again. And that makes me all the more frustrated.</p>
<p>technorati tags:<a href="http://technorati.com/tag/buggeddebugger" rel="tag">buggeddebugger</a>, <a href="http://technorati.com/tag/flash" rel="tag">flash</a>, <a href="http://technorati.com/tag/actionscript" rel="tag">actionscript</a>, <a href="http://technorati.com/tag/mandelbrot" rel="tag">mandelbrot</a>, <a href="http://technorati.com/tag/set" rel="tag">set</a>, <a href="http://technorati.com/tag/graphics" rel="tag">graphics</a></p>
<p><!-- technorati tags end --></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=21&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/14/the-mandelbrot-set-on-flash/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/mandelbrot4-508012320x240.JPG" medium="image">
			<media:title type="html">mandelbrot4-508012320x240.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>Graphs on Flash &#8211; using ActionScript!</title>
		<link>http://buggeddebugger.wordpress.com/2006/07/09/graphs-on-flash-using-actionscript/</link>
		<comments>http://buggeddebugger.wordpress.com/2006/07/09/graphs-on-flash-using-actionscript/#comments</comments>
		<pubDate>Sat, 08 Jul 2006 23:08:12 +0000</pubDate>
		<dc:creator>The Bugged Debugger</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Graphics]]></category>

		<guid isPermaLink="false">https://buggeddebugger.wordpress.com/2006/07/09/graphs-on-flash-using-actionscript/</guid>
		<description><![CDATA[I have been reading up on ActionScript for a few days now. I started from the very basics, and decided that I would not directly dive into it without having any prior knowledge.  Made a bit of progress. I wrote my first ActionScript program today. And it worked beautifully. This gives me a lot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=20&subd=buggeddebugger&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have been reading up on ActionScript for a few days now. I started from the very basics, and decided that I would not directly dive into it without having any prior knowledge.  Made a bit of progress. I wrote my first ActionScript program today. And it worked beautifully. This gives me a lot of ideas for future programs. Hopefully learning this will aid me in learning Javascript, as I think they are similar in many aspects.</p>
<p><!-- PProtector -->I chose a 640&#215;480 resolution for the movie. It&#8217;s a pretty simple program, and the one that I always try if I have the power of graphics. So far I have been able to work on graphics only in Turbo C++ with the graphics.h header file that comes along with it. But then ever since I shifted to standard C++, I have not had the opportunity to use graphics in any of my programs. This program is to draw the graph of any function. In this very basic code, the function has to be changed in the source code. Here&#8217;s my code:</p>
<blockquote><p>var s:Number=48;<br />
var i:Number=0;<br />
var j:Number=0;<br />
this.createEmptyMovieClip(&#8220;graph&#8221;, 1);<br />
graph.lineStyle(1,0&#215;000000,100);//(pixel width,colour,alpha)<br />
do{<br />
j=240-s*Math.sin((i-240)/s);<br />
graph.moveTo(i,j);<br />
i++;<br />
j=240-s*Math.sin((i-240)/s);<br />
graph.lineTo(i,j);<br />
}while(i&lt;640);</p></blockquote>
<p>It basically draws the sine curve on screen. The createEmptyMovieClip command is required to create an object that will call the functions that are part the object of type MovieClip, like the ones that involves graphics. I don&#8217;t know what exactly the second parameter is supposed to do. It&#8217;s called &#8220;depth&#8221; and a value of 1 worked fine for me. I haven&#8217;t understood it&#8217;s exact purpose yet.</p>
<p>Here&#8217;s the output that I got for the above program:</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/sine.JPG" alt="sine.JPG" /></p>
<p>The lines are a little jagged due to resizing.</p>
<p>That made me real happy. At first, I didn&#8217;t get any output. But later I realised I need to call the lineStyle function to change the plot colour to black and to draw properly.</p>
<p>I decided to plot other functions as well, and the next one that came to my mind was the normal distribution curve. Here, I changed only one of the expressions in the code to the new formula &#8211; instead of both &#8211; by mistake. But the output was amusing:<img src="http://buggeddebugger.files.wordpress.com/2006/07/fusion.JPG" alt="fusion.JPG" /></p>
<p>The region between the sine curve and the normal distribution curve is shaded. This is of course because the moveTo command moves the current position indicator to a point on one curve, and the lineTo draws a line from here to a point on the other curve. This gives a nice effect to the graph.<br />
There was no stopping me now and I just kept trying out more functions one after the other. Here&#8217;s f(x)=exp(-x/3)*sin(3x) :</p>
<p><img src="http://buggeddebugger.files.wordpress.com/2006/07/complicated.JPG" alt="complicated.JPG" /></p>
<p>Since I found this simple enough, I decided to plot Mandelbrot&#8217;s set and was wondering if ActionScript could take that fairly higher amount of intensive calculations. But I was feeling really sleepy at around this time, and I don&#8217;t know if the program did not work because I was too sleepy to debug it properly or if Flash couldn&#8217;t handle it. I think it is the former <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . I suppose I&#8217;ll tackle that some other day.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/buggeddebugger.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/buggeddebugger.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/buggeddebugger.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/buggeddebugger.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/buggeddebugger.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/buggeddebugger.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/buggeddebugger.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/buggeddebugger.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/buggeddebugger.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/buggeddebugger.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/buggeddebugger.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/buggeddebugger.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=buggeddebugger.wordpress.com&blog=281575&post=20&subd=buggeddebugger&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://buggeddebugger.wordpress.com/2006/07/09/graphs-on-flash-using-actionscript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d566a09f6b0542139846d1f2a9de5b6c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">The Bugged Debugger</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/sine.JPG" medium="image">
			<media:title type="html">sine.JPG</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/fusion.JPG" medium="image">
			<media:title type="html">fusion.JPG</media:title>
		</media:content>

		<media:content url="http://buggeddebugger.files.wordpress.com/2006/07/complicated.JPG" medium="image">
			<media:title type="html">complicated.JPG</media:title>
		</media:content>
	</item>
	</channel>
</rss>