Updates from June, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • Akarsh Simha 5:07 am on June 27, 2008 Permalink
    Tags: TNR   

    Result of too much C++ 

    04:44 < vimzard> kstar::message(I know that hes a very well known speaker, on many FOSS topics (check site)"
    04:44 < vimzard> kstar::sendSmilely(":-)")
    04:44 < kstar> vimzard::message( "He\s in. );
    04:49 < kstar> vimzard::message( kstar, ( vimzard::evaluate( &spranesh::isFromHyd() ) ? Yes : No );
    04:49 < kstar> Oops, syntax error.
    04:50 < kstar> vimzard::message( kstar::Instance(), ( vimzard::evaluate( &spranesh::isFromHyd() ) ? Yes : No );
    04:53 < vimzard> kstar::sendReply(Yes)
    04:56 < kstar> vimzard::message( kstar::Instance(), ( hyderabadCity::meetUp( &vimzard, &spranesh ) ) ? Yes : No );
    04:57 < vimzard> kstar::sendMessage(not yet)
    04:57 < kstar> vimzard::queryPlans( pContext );
    04:57 < vimzard> kstar::decalrePlans(ILUG-HYD meeting this sunday. %s giving talk., this)
    04:58 < kstar> vimzard::acceptBowsFrom( kstar::Instance(), true ); // Second argument is a force flag
    04:58 < vimzard> kstar::congruenceTest(&spranesh,&vimzard)==True
    04:59 < vimzard> kstar: vimzard::introspect(prepared) == False
    04:59 < kstar> vimzard::setSemicolonsAtTheEndOfEachStatement( true );
    04:59 < vimzard> kstar::increment_Tness(10000);
    04:59 < kstar> vimzard::ask( What is Tness? );
    05:00 < vimzard> kstar::reply (SI Metric of TNR value)
    05:00 < kstar> vimzard::messageBackValue( vimzard::TalkTopic == vim );

  • Akarsh Simha 2:42 am on June 27, 2008 Permalink  

    Aligning images for KStars 

    Well, it took more time to debug the code than to write it!

    The problem is that, with the increased number of stars that KStars is going to display, image misalignments become more vivid. Images should be rotated, scaled and offset appropriately, so that stars in the field of photos of galaxies match their corresponding catalog stars that are drawn by KStars.

    I found out that it takes about an hour to manually align an image, so I had no choice but to write a program to suggest the operations automatically. This program accepts an input that looks like

    !PA filename imagewidth imageheight
    currentX currentY
    targetX targetY
    currentX currentY
    targetX targetY

    • basically a map between the current coordinates of a point on the image and the target coordinates. The program just uses one of those standard formulas to do a least-sum-of-squares fit and decides the correct rotation, scaling and offset to do to get the image align to the stars, and then chalks out the image magick commands required to do that.

    The PA is currently redundant, and some features are not working. Comment on this blogpost if you are interested in the very dirty, badly written, make-shift code that does this.

    At the other end, I patched KStars to do some tricks so that it outputs the coordinates of a point when I press a certain key. The bug that took me a long time to fix was that I had been very dumb in translating the (x, y) on screen to the (x, y) on the image, and forgot to take into account the change in orientation as time passes. So I just needed to measure position angles with the correct, standard reference (i.e. line towards NCP).

  • Akarsh Simha 12:13 pm on June 22, 2008 Permalink  

    PseudokalpanAswaram in the bathroom 

    I feel that there is just as much fun in producing music (or probably more) as there is in listening to it. My taste has become more Classical nowadays, but unfortunately my music-producing skills are not very far from the old unpolished-school-level-film-song-keyboardist skills. Somehow I manage to bray pseudocarnatic music on the Bansuri nowadays and am tempted to think that I can manage Mohanam and Hamsadhwani marginally (although my Mohanam anaalaapanais usually contain a lot of nishadams!) nowadays.

    Typically, when you start listening to Music, you feel like singing it out as well. So I usually end up trying to sing. My family (including my brother 😮 ) somehow manages to bear me. Nowadays I try to put pseudokalpanAswarams for songs just for fun, and consequently am forced to alter the taaLam to fit the beginning of the sAhityam correctly.

    Considering that many murders of beautiful girls shown in movies occur in bathrooms, I usually end up kolepaNNifying beautiful rAgams like varALi and beautiful kRtis like SESAcalanAyakam in the bathroom. I find the bathroom an ideal place for singing, because the reverb and resonance is just ideal! In addition, it somehow becomes very easy to pick a Shruti in the bathroom with a ‘Sa’ that is resonant! I think it is because the sound of water filling in the bucket is a noise containing a lot of random frequencies and the walls of the bathroom amplify, by resonance only certain harmonic frequencies which match the bathroom’s natural frequency. I am not able to justify this, because, going by the idea of cavity radiation, I think I should expect something similar to the Planckian blackbody radiation curve because the bathroom acts like a cavity with “black” walls. Maybe I should spend some time working out these details. I simply love singing in the bathroom for this reason. Thankfully, I need not play the flute (the bamboo flute, and not any other!) in the bathroom, because my room produces enough reverb for the loud flute, of course, when played near the attached bath 😛

    The most recent performance involved a pseudokalpanAswaram in “naivavarALi” rAgam. I’m sure the neighbours and street passers-by would be disgusted to have a pseudocarnatic-bathroom-singer next door, but I simply can’t help it.

    • naveen 1:18 pm on June 22, 2008 Permalink | Log in to Reply

      good “pseud” Carnatic music 🙂

      >although my Mohanam anaalaapanais usually contain a lot of nishadams!

      I am glad that it doesnt contain any Nishabdams 😀

  • Akarsh Simha 11:36 am on June 22, 2008 Permalink
    Tags: Ganesh, Kumaresh, Shanmukhapriya, Violin   

    RTP in Shanmukhapriya by Ganesh and Kumaresh 

    I really enjoyed this piece, a Ragam Tanam Pallavi in Shanmukhapriya by R. Ganesh and R. Kumaresh (Violin duet), so I thought I should put it on my blog.

    I somehow feel that their style is a little light and like to listen to it sometimes. I like the Shanmukhapriya raaga a lot. Besides the acoustics of the auditorium seem to be very good with just sufficient reverb (or I don’t know if that might have been later processing). I liked the raagamaalikai, epecially the bit in Ranjani and parts of the kalpanaaswaram after the raagamaalikai.

  • Akarsh Simha 9:01 am on June 21, 2008 Permalink
    Tags: , LASER, reflection grating   

    LASER diffraction off a CD-ROM 

    I recently took a photo of LASER diffraction off a CD. Some of my friends (and I) liked it, so I thought it should appear on my blog as well. So here it is:

    I’ve labelled the various beams that you see in the photograph in this version:

    Trivia: Why is the second maximum beam (n=2) brighter than the first maximum beam (n=1)?

    I was able to roughly estimate that the CD’s tracks are about a micrometre apart and that the pits containing the data are either further apart than that, or show a regularity on a larger scale than that. Need to do some more qualitative experiments on that.

    The photo is a 15 second exposure at f/3.5 @ ISO 1600. Released to public domain. Credits requested.

  • Akarsh Simha 5:26 am on June 19, 2008 Permalink
    Tags: German, Sanskrit, The Awful German Language   

    The “Awful”? (nay, beautiful!) Sanskrit language 

    My friend Vikram pointed me to this

    After I read through it, I realised how very similar Sanksrit was!

    First, there are genders. Sometimes illogically assigned. ब्रह्मन् can be both male and neutral. The male ब्रह्मन् refers to the creator Brahma and the neuter ब्रह्मन् to the self (आत्मन्). Thanks to this, we have two interpretations to “aham brahmAsmi” as quoted by SaNkarAcArya. विश्वपा (Caretaker of the World) is masculine, but लता is female, although both end with dIrghaswaras. मति: (the mind) is female, but कवि: (a poet) is masculine. While मति: is feminine, मनस् (mind) is neuter. संस्क्Rतम् (Sanskrit) is neuter, but संस्कRतभाषा (The Sanskrit Language) is feminine! [Please interpret the ‘R’ here as the 7th swara, usually written incorrectly as “ru” or “ri”]

    Let’s say we want to translate “that the bird is waiting in the blacksmith shop on account of the rain.” :D.
    खग: = bird, male. (because I can’t recall the gender of the more common word पक्षि: :D)
    व्Rष्टि: = rain, female.

    German has only 4 cases. Sanksrit has 8!! So which one should I put व्Rष्टि: in? Is it the instrumental (third) case or the Ablative (fifth) Case? I think it should be the ablative, but I decide to escape here and say, “व्Rष्टॆ: कारणात्” which translates to “due to the rain”. That’s a safe Ablative noun now.

    In Sanskrit, like in German, the verb goes to the end:
    खग: व्Rष्टॆ: कारणात् लॊहकारस्य आपणॆ तिष्टति
    ( तिष्टति = to stand / to wait )
    A literal “anvayArtha:” in English would be:
    (The) Bird, due to rain, at the blacksmith’s shop stands.

    Thankfully, the adjective isn’t compulsory in Sanskrit.

    There are no Sanskrit newspapers, but there are Sanskrit works which are famous for seemingly never-ending sentences with elaborate descriptions, paranthesis, re-paranthesis, re-reparanthesis and so on and finally comes the verb at the very end of such an elaborate description. बाणभट्ट:’s कादम्बरी is famous for this. Each sentence in the significantly simplified abridged version supplied in our textbooks used to be half a page long in small print! It takes several cycles of brain waves and a good knowledge of Sanksrit to interpret every single sentence in the abridged version of the kAdambarI. I studied an extract from the kAdambarI where a bird describes how it was rescued by a maharSi’s children in its childhood. My goodness! Starting from the tree in which the bird was living in, and the calamity that separated the bird from its parents (can’t remember what it was. I think a hunter, described as ‘sAkSAt yama:’ etc.), and the lake in front of the maharSi’s ASram, the maharSi and his ASram – each carried a paragraph full of adjectives (declined in the appropriate case, of course 😉 )! How would an “abridged” bhANabhaTTa have described a modern love-at-first-sight case?

    जगत: पंचॊनद्विशतदॆशसुन्दरतमाम् अरुणॊदयसमयपूर्वदिग्वर्णॊत्तरियावस्त्रधराम् आभरणैर्वर्धितसहजसौन्दर्यां स्पर्शानन्दसौभाग्यपात्रपवनाहतकॆशापि रतिसमानसौन्दर्ययुतां शीतलीकरणॊपनॆत्रालंकारभूषितकपालाम् निकासितकॆशशारीरां युवतीम् द्Rष्टवति तस्मिन् आजानुबाहौ कुलीने अतिशयगुणगणैर्भूषितॆ पुष्टॆ व्Rकॊदरसद्Rशकायॆ अतिशयबलादिभूषितॆ तीव्रसमुद्रनीलरागजीन्स्धरॆ युवकॆ तत्क्षणं श्Rंगारस्य लहरी अजनयत्|

    This thing took me about an hour, and several references to Monier William’s English-Sanskrit dictionary to craft with my rusty Sanskrit skills. Please excuse my inappropriate use of the anuswAra – I still don’t know how to use SCIM effectively. It hopefully translates phase-by-phrase to:

    “Of-the-world 195-countries-beautiful-most dawn-time-east-direction-colour-uppercloth-garment-wearing by-ornaments-increased-natural-beauty-possessing touch-bliss-goodfortune-recipient(?)-wind-fluttered-hair-despite ‘Rati’-equal-beauty-possessing cooling-spectacles-ornament-endowed-forehead removed-hair-body maiden having-seen in-him till-knee-armed belongingtoanoblefamily several-by-goodqualities’-collection-endowed strong vRkOdara-like-bodied extreme-might-etc.-endowed intense-seeblue-colour-Jeans-wearing youth that-instant of-love wave was born.”

    I wish I had a reference to quote from bANabhaTTa, but deciphering each sentence was a real challenge – a cryptic puzzle which I used to enjoy to try in vain to solve.

    Just as in German, notice that we have the same compound words whose inventors Mark Twain wishes to punish. Unfortunately, this seems to be the only way of creating new words for modern gadgets etc. in a language as ancient as Sanskrit. Fortunately, this adds to the beauty (IMO; definitely not in Mark Twain’s!) to the language. Thanks to this way of compounding words (called समास:), three interpretations of “रामॆश्वर:” (referring to Lord Siva, or Lord Rama) are easily possible:
    1. रामस्य ईश्वर: = रामॆश्वर: [षष्टी तत्पुरुष समास:] Rama’s boss = Siva
    2. राम: ईश्वर: यस्य स: = रामॆश्वर: [बहुव्रीहि समास:] He who’s boss is Rama = Siva
    3. रामश्च असौ ईश्वरश्च = रामॆश्वर: [कर्मधारयसमास:] Rama, who is verily the Lord = Rama
    (It seems that though the Gods are happily worshipping each other mutually, their “devotees” fight over “their” God’s superiority. :-P)

    This leaves a lot of scope for multiple interpretations, clever, perverse interpretations and mis-interpretations of Sanskrit literature. Adding to that is the same complication of ‘Zug’ and ‘Schlag’. What could the word ‘शिवं’ mean? It could be the accusative of Siva, it could mean auspisciousness and it could, for a pervert, mean the male phallus. (Misinterpret “सत्यं शिवं सुन्दरं”). The reason for this wide variety of meanings is that the root meaning of “Shiva” captures all of these interlinked meanings. Auspiciousness == Lord Siva && Phallus == Representation of Lord Shiva (the male energy) && so on. I beg to differ in my opinion and say that this actually adds beauty to the language. Where else could you say:

    कॆ शवं पतितं द्Rष्ट्वा पाण्डवा: हर्षनिर्भरा: |
    रुदन्ति कौ-रवास्सर्वॆ हा हा कॆ शव कॆ शव ||

    And interpret it in two entirely different, totally uncorrelated, ways!!

    Thankfully, we don’t have separable verbs in Sanskrit. But there are prefixes that can mean totally different things when attached to different verbs, just as ‘ver-, ab-, auf-‘ could have varying meanings depending on the root word to which they are prefixed in German. Even worse, sometimes, the meaning of (prefix+verb) and the meaning of the verb alone can be totally uncorrelated. There’s in fact a verse that illustrates this (Sanskrit seems full of verses, probably because facts are easier to remember when in verse form, just like “Thirty days has September…” makes it easy to remember the number of days in each month):

    धात्वर्थं बाधतॆ कश्चित्, कश्चित् तम् अनुवर्ततॆ |
    प्रहाराहार संहार विहार परिहारवत् ||

    It loosely means “Some (prefixes) kill the meaning of the root (of the verb), others reinforce the same, just like prahAra: (???), AhAra: (bringing?), samhAra: (killing), vihAra: (enjoying?), parihAra: (remedying)” [I’d appreciate if someone could help me fill in all the meanings correctly].

    While German has just four cases, as stated earlier Sanskrit has 8 cases – which correspond to “vibhakti:” (divisions?) called ‘first, second, third, …, seventh, and vocative’. The cases are mapped to the divisions (forms?) as follows:

    • First = Nominative
    • Second = Accusative
    • Third = Instrumental
    • Fourth = Dative
    • Fifth = Ablative
    • Sixth = Genetive
    • Seventh = Locative
    • Vocative

    And probably this is the only language to have the additional complication of a “dual” in addition to a singular and a plural. So, if two people are going to the theatre, they’d say:
    “आवां चित्रमन्दिरं गच्छाव: |”
    But if three were going, they’d say:
    “वयं चित्रमन्दिरं गच्छाम: |”
    In English, both would translate to “We go to the theatre”.

    This means that the student of Sanskrit memorizes 8 x 3 = 24 forms for words of various endings, various exceptional cases etc. Most words ending with the same syllable, and having the same gender, have similar forms in all 8 cases and 3 numbers, making it easier to remember. But there are painfully weird exceptions like the all-time favourite, and easily-forgettable “पथिन्” (I can’t recall it’s gender. Must be male?) meaning “traveller”, i.e. one who goes on the path (पथ्). It’s the first nightmare that every Sanskrit student encounters – because it’s nominative is nowhere close to पथिन् – the nominative is पन्था, पन्थान्तौ, पन्थान्त: (singular, dual, plural). Yonder lies a huge heap of exceptional cases of the type of “विश्वपा” (आ-ending, male). (Interestingly, although the belief is that there is only one sustainer for the universe, namely Lord Vishnu, this word exists in the dual and plural forms too!)

    Somehow, these cases are rather intuitive to many people. I had no problem memorizing 24 forms of several nouns with weird endings in Sanskrit, but had a lot of trouble remembering the 4 x 2 = 8 forms of nouns and adjectives in German! [BTW, even in Sanskrit, the adjective follows the case, number and gender of the noun, and the verb follows the number and gender of the noun. The verb does impose the case of the noun]. Maybe it is because most Indian languages bear some resemblence to Sanskrit in grammar. Probably, people whose mother-tongues are the Germanic dialects would never complain about “die See” and “der See”.

    How do we decide which case to use? Somehow, most of it is intuitive if a South Indian language is your mother tongue, but some of it is not immediately intuitive. For instance, while in Kannada, Hindi, Telgu and Tamizh, you use the dative when you say “tell him the news”, you use the Accusative in Sanskrit. This too, somehow, I found intuitive very soon. I still find it difficult to decide whether I should be using “mir” or “mich” with a given verb. The “reflexive” idea works usually, but I can’t handle the exceptions! In Sanskrit, thankfully, all exceptions are well documented by Panini, the authority on Sanskrit grammar. Unfortunately, Panini’s sUtras (“formulae”) describing syntactic rules are totally incomprehensible without context:
    “नाज्झलौ”, “तरप्तमपौघ:”, “आद्यान्तवदॆकस्मिन्”, “श्नाताषट्”, “रॊ रि”
    Somehow, there are nice ‘eye-catching’ sequences of syllables that one can identify – like ‘tarap’ ‘tamap’ (hey! those are suffixes indicating comparative and superlative degrees!), or ‘ach’, ‘hal’ (referring cryptically to swaras and vyanjanas) but no ordinary human (except maybe SrIdharAnandaSAstry-types) can understand what they mean in totality, IMHO. “सहयॊगेSप्रधानॆ” only misguides me that I should use the sampradAnakArakam (the dative case) when using ‘सह’ because of the similar sound of ‘sampradAna’ and ‘apradhAna’, whereas, I should be using the instrumental case with ‘सह’ (meaning along-with).

    I remember “रॊ रि” because it makes absolutely no sense to me, but somehow is supposed to mean that when two ‘र्’s come one after the other, one of the two should be dropped. I can’t think up of an example, but I do remember vaguely that र् + र् = आर्. It is generally easier to remember the exceptions directly than to remember the sUtras.

    Thankfully, the “exceptions” with prepositions and the cases that they demand are few – saha, sArdham (along-with) should be used with the instrumental case, nama: (salutations-to) with the dative, antarA (without) with accusative and abhita:, parita: (near, surrounding) with accusative [like German], and somehow they become intuitive with a few examples. The major relief is that there is no distinction between “I place the cup on the table” and “the cup is on the table” in the case used with the object in Sanskrit.

    And yes, the same gender-of-parts-of-the-body issue exists with Sanskrit – the eyes are (if I remember right) neutral, the hair is male, the nose is male, the tongue is male, etc. But there’s usually an escape from this, because most parts of the body are two in number, so you could get away by creating the “dual compound” and say “Cleanse your eye-pair”, in which case the pair is always neutral. Thankfully it isn’t as bad that we would be addressing the turnip as ‘he’, and talking about the fishwife and its ashes and how he was buried. [ My my! That tale of the fishwife was Hilarious! I couldn’t stop laughing for minutes as I read that passage!! =)) ]

    Somehow this whole ultracomplex structure that Sanskrit has, I notice that many find intuitive. That’s way the (nay, beautiful!) in the brackets. I don’t think it is possible to have so many interpretations of one damn thing in any other language, and there lies the beauty and the ugliness 😀

    I should thank Vikram a lot for pointing me to that hilarious article!

    • Akarsh Simha 4:02 am on June 23, 2008 Permalink | Log in to Reply

      I must thank my brother for correcting my Sanskrit. The unfortunate chap is now learning the declining of ‘Pathin’:

      Correction 1 : Pathin == Path, and not traveller
      Correction 2 : It is ‘panthA:’, ‘panthAnau’, ‘panthAna:’ in the first case.

    • CSLV 2:46 am on July 6, 2008 Permalink | Log in to Reply

      As I am reading the article,I go back to those days spent in learning sanskrit in our school and our teacher who made us realize the beauty of it.
      What better way to spend some of your summertime enjoying its elegance !
      I am getting inspired to spend time on it again..
      Thanks to you.

    • DultowneseeRow 8:05 am on August 3, 2008 Permalink | Log in to Reply


    • Darin 10:06 am on August 23, 2008 Permalink | Log in to Reply

      Ancient Greek also has a dual number.

    • Barbara 9:02 pm on November 4, 2008 Permalink | Log in to Reply

      Hi. I came across your blog in my search for the sanskrit translation for the word “miracle”. If you would be able (and so kind) as to tell me where I might best look for a reliable translation tool I would be most indebted. A thousand thanks.

    • Akarsh Simha 9:42 pm on November 14, 2008 Permalink | Log in to Reply

      @all: Thanks for the comments. Interesting to know that Greek has a dual as well.

      @Barbara: I found this German site:

      The most appropriate word would be ‘camatkAra:’ amongst those pointed out by the dictionary. AScarya: more appropriately refers to a state of amazement.

    • Barb 7:26 am on December 1, 2008 Permalink | Log in to Reply

      Thanks so much for the link; and for the nod toward camatkAra.

    • Pedro 3:47 am on January 8, 2009 Permalink | Log in to Reply

      Arabic has dual as well

    • Obsetspes 5:06 am on April 20, 2009 Permalink | Log in to Reply

      Очень полезно

    • smruthi 12:34 pm on July 1, 2009 Permalink | Log in to Reply

      that was awesome 😀

      i thought nAsikA was feminine

      praharati = strikes or hits

      the gender notation, which we, due to convention find funny, might be because of the svabhavA or the inherent nature of the artha of the word from the human perspective.

    • smruthi 12:35 pm on July 1, 2009 Permalink | Log in to Reply


    • Akarsh Simha 10:10 am on July 2, 2009 Permalink | Log in to Reply

      @smruthi: Probably I was considering ghANa: – which, if I amn’t wrong – is male. I don’t remember now – maybe it was a mistake.

      Thanks for praharati.

      I agree, it might have something to do with the svabhAva of the word.

    • smruthi 12:00 am on July 3, 2009 Permalink | Log in to Reply

      ghrANa if ve not mistaken is neuter

      kudos for the interesting penning 🙂

    • Wanda Holbrook 8:05 pm on May 31, 2010 Permalink | Log in to Reply

      Really interesting post! Honest!

    • రాకేశ్వర రావు 12:11 am on December 29, 2010 Permalink | Log in to Reply

      I came here looking for पथिन् . Was shocked to see it meant traveller. But am very thankful for your mother’s intervention 🙂

      रॆ and रे are different. so are रॊ and रो. the first are used to write the short diphthongs of Dravidian languages and are not used in Sanskrit, they are a new addition to the script by a govt. body.

      कृष्ण has the correct symbol for ऋ in it. I would strongly suggest familiarizing yourself with Devanagari Unicode symbols, and the inscript keyboard.

    • Akarsh Simha 7:25 am on December 29, 2010 Permalink | Log in to Reply

      Oh, I didn’t know that रॆ and रे were different. I thought both meant the same dīrgha swara. Thanks for pointing that out. And I don’t have an inscript keyboard, so I was using ITRANS, but I didn’t know the ITRANS for ऋ. Thanks.

      I’m slowly tending to forget all the Sanskrit I knew, which is very worrisome.

  • Akarsh Simha 12:55 am on June 19, 2008 Permalink  

    Alien from StarWars pays amateur astronomer a visit 

    This was about an hour ago in my room. The chappy landed in a U.F.O. on my terrace and communicated with me that he wanted some fundaes on amateur astronomy. Requested him for a pose:

    Thanks Amar! Now showing people the stars will be much easier! I tested out this stuff today and the beam was good enough to point to the stars.

  • Akarsh Simha 4:36 am on June 18, 2008 Permalink

    Straight Edge Diffraction Pattern from a Point Source 

    A nice way to find the angular diameters of stars is by Lunar occultations of stars. Since ordinary telescopes only show stars as point objects, this cannot be directly measured by observation. HST and such huge observatories with precise optics alone can resolve such details.

    What limits the resolution of a telescope and thus our capability to see the disks of stars is diffraction, but the very same diffraction can help us find out the angular diameter of stars! When the moon passes across a star, the limb of the moon can act like a straight edge (it is straight in comparison to the star’s angular dimensions) and produce a diffraction pattern of the star’s light.

    Here is a beautiful article outlining the whole procedure, of finding angular diameters of stars using this technique. Dr. Shylaja at the planetarium wanted me to write a small program to convert such an intensity pattern into the angular diameter of the star. I liked the idea and have started working on it. I’m assuming the formula for the intensity distribution, as he does in the article.

    I wrote today, a program to numerically evaluate the intensity pattern from a point source, as explained in the article. I found out that the GNU Scientific Library (GSL) does integrations in a very elegant manner. You needn’t rewrite Simpson’s Rule! Here’s a code snippet that evaluates the required intensity distribution function:

    gsl_integration_workspace *w = gsl_integration_workspace_alloc (1000);
    double result, error;
    double params[2];
    double cosint, sinint;
    double coserr, sinerr;

    params[1] = M_PI / ( screenDist * lambda );
    gsl_function F;
    F.function = &straightedge_integrand;
    F.params = (void *)params;

    // TODO: Decide lower limit more intelligently
    params[0] = 0;
    gsl_integration_qags( &F, -200, -100, 0, 1e-1,
    1000, w, &cosint, &coserr );
    fprintf(stderr, "Cosine integral from -1000 to -100 = %e\n", cosint);

    double b = sqrt( lambda * screenDist );

    gsl_integration_qags( &F, -20 * b, x, 0, 1e-7, // TODO: Set appropriately
    1000, w, &cosint, &coserr );
    params[0] = M_PI / 2;
    gsl_integration_qags( &F, -20 * b, x, 0, 1e-7, // TODO: Set appropriately
    1000, w, &sinint, &sinerr );

    // fprintf(stderr, "cosint = %e, sinint = %e\n", cosint, sinint);
    double intensityFactor = cosint * cosint + sinint * sinint;
    double relerr = ( ( cosint != 0 && sinint != 0 ) ? 2 * ( coserr / cosint + sinerr / sinint ) : 1.0 );
    (*f)[ x ] = intensityFactor;
    return intensityFactor;

    Somehow, the integral from -inf to x failed to evaluate, probably because the transform that GSL does to evaluate semi-infinite integrals of this form retained the oscillatory behaviour of the sine and cosine. I need to look into this sometime. Instead, I neglected the portion from -inf to -20*b, which is almost zero (intensity deep inside the geometric shadow region).

    My program also stores all the function values it keeps in a map. I preferred a hash, but STL has no hashing function for doubles. Probably I should convert double into string using atof and then hash against that, but I don’t know whether the overhead of atof will be acceptable. I guess it will. This kind of storage will, IMO, help immensely when the convolution is performed between the intensity distribution of the star (“1-D kernel”) and the point source diffraction pattern.

    I still don’t understand why it should be convolution rather than finding the correlation, i.e. Why is the mirroring of the kernel required? Anyway, both are the same in this case.

    Here are today’s results, which have come after some messing around with the STL containers all night:


  • Akarsh Simha 9:19 pm on June 16, 2008 Permalink
    Tags: ADSL Router, , , SSH   

    Switching on a lightbulb from 360km away! 

    Yes, my friend Prasanna just did the same. He SSHed into my system from Chennai and switched on the CFL in my room 😀
    Feels like the Big Bang Theory, except that it isn’t from all over the world 😀

    I opened SSH access on my ADSL router. A lot of articles on the net helped me, but let me write this out, so that it is clear and in one place. And before any brilliant bruteforcers decide to track me down, yes, I have the openSSH fix and run Debian, which means all vulnerable keys have been eliminated.

    Most routers support telnet:

    [13:akarsh@PENGUIN$ www]$ telnet
    telnet> o
    Connected to
    Escape character is '^]'.
    BCM96338 ADSL Router
    Login: admin

    Once I login, I get this main menu on my router. Most routers have a very similar main menu if I amn’t mistaken.

    Note: If you have problem with Backspace key, please make sure you configure your terminal emulator settings. For instance, from HyperTerminal you would need to use File->Properties->Setting->Back Space key sends.

    Main Menu

    1. ADSL Link State
    2. LAN
    3. WAN
    4. DNS Server
    5. Route Setup
    6. NAT
    7. Firewall
    8. Quality Of Service
    9. Management
    10. Passwords
    11. Reset to Default
    12. Save and Reboot
    13. Exit

    If you want to setup a virtual server (which is like a proxy server running on the router that hands over all requests for a particular port on the router to a particular port on a particular system on the local subnet), choose option 6, Followed by 1.

    Note: If you have problem with Backspace key, please make sure you configure your terminal emulator settings. For instance, from HyperTerminal you would need to use File->Properties->Setting->Back Space key sends.

    Virtual Server Menu

    1. Add
    2. Remove
    3. Show
    4. Exit
    / NAT/Virtual Server ->

    You can now setup virtual servers. This is my configuration (I hit option 3 to get this). The internal IP of my system on our local subnet is The config basically tells the router to forward all requests on port 80 (http) and port 22 (ssh) to and respectively on the local subnet.

    Virtual Server Show

    Server Name Proto. External Start External End Internal Start Internal End Server
    Port Port Port Port IP Address
    http TCP 80 80 80 80
    ssh TCP 22 22 22 22

    You will also have to set up the firewall to allow incoming packets on these ports. That’s option 7 (Firewall) on my router’s main menu, followed by option 1 (IP Filtering), followed by option 2 (Incoming).

    Prasanna and I also played ‘alsamixer’ on his system. It’s real fun to be able to do what we were once doing within the local intranet of the institute with a 360km gap in between!!

    • Prasanna 10:11 pm on June 16, 2008 Permalink | Log in to Reply

      Yay us! 😀

    • Kumar Appaiah 12:25 pm on June 17, 2008 Permalink | Log in to Reply

      Great work, guys! This is fun, and definitely useful to test out things. It’d be nice for one of you to run a stress test and find out how many HTTP requests or FTP requests your machine can handle per second. Also, it would be interesting to see if the performance improves with a scripted page with caching, ala Drupal. Game for this?

    • Akarsh Simha 1:52 am on July 1, 2008 Permalink | Log in to Reply

      I suppose we could do that Kumar. We’ll work out a time when we’re all free to do that. Why aren’t you seen on #iitm-linux nowadays?

    • wan acceleration 2:52 pm on November 12, 2008 Permalink | Log in to Reply

      I’ve found that in our network WAN accelerators have made a big difference

  • Akarsh Simha 1:46 pm on June 13, 2008 Permalink  

    1E6 Stars! 

    When I get a bigger telescope, I can still use KStars to prepare finder charts. Thanks to James Bowlin, who foresaw all the hurdles in the achievement of this goal and laid out the correct data structures – it actually worked the first time, perfectly! I just replaced the mag 10 Hipparcos star catalog with the mag 12 Tycho-1 star catalog, and it just works!! KStars displays 1 million stars down to mag 12, and there’s only a little freezing because the magnitude limit vs. zoom factor formula needs a bit more tweaking!

    It’s really nice to see that the core of Globular Cluster M22 was actually displayed as individual stars, with 11.2 mag stars shown.

    There are still quite a few bugs, because I notice a very uneven distribution of mag 11.5+ stars. They are not at all displayed in the Sagittarius milky way region – this is bad, because it should be easy to find mag 12 stars in the rich star clouds of SGR.

    For those who are familiar with my GSoC project – no this is not the end of it. It is a “new beginning” (to get very poetic about it). I still have to settle the issues of proper motion (i.e. duplicate high PM stars in all trixels that they may cross in a 20000 year timescale) and improve the loading speeds and reduce the cache size. Besides, there’s a lot of clean up and code quality improvement to be done – we want to split named and unnamed stars into different SkyComponent classes, because the data structures that are used to store them are different.

    I’ll post screenshots etc once I’m done with debugging of the problem I mentioned above (No mag > 11.5 stars in SGR!)

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc