Saturday, October 1, 2011

Modulus of a Complex number

For, z = a + bi , the modulus is
|z| = sqrt(a^2 + b^2)

e.g, 
z = (1 + 2i)^2
z = (1 + 2i) . (1 + 2i)
  = 1 + 2i + 2i + 4i^2    (remember that, i^2 = -1 )
  = 1 + 4i + 4(-1)
  = -3 + 4i


|z| = sqrt( -3^2 + 4^2)
    = sqrt(9 + 16)
    = sqrt(25)
|z| = 5



A bit more on Complex numbers



We know that, 
i = sqrt (-1)

and therfore, 
i^2 = -1


Also, sqrt (9) = 3

 sqrt (-9) = sqrt(-1).sqrt(9) = i.sqrt(9) = 3i
We can check this. 
(3i)^2 = 3^2.i^2 = 9.-1 = -9

So, 
(3i)^2 = -9
3i = sqrt(-9)

3i is an imaginary number.

Complex number are imaginary and real numbers together.
e.g.

6 + 3i is a complex number.

Addition of complex numbers 
Here we have two complex numbers zi and z2

zi = a + bi
z2 = c + di
we add the real parts then add the imaginary parts.

zi + z2 = (a + c) + (bi + di)
        = (a + c) + (b + d)i

Subtraction of complex numbers 
Here we have two complex numbers zi and z2
zi = a + bi
z2 = c + di
we subtract the real parts then subtract the imaginary parts.
zi - z2 = (a - c) + (bi - di)
        = (a - c) + (b - d)i

Multiplication of complex numbers 
Again we have two complex numbers zi and z2
zi = a + bi
z2 = c + di

zi . z2 = (a + bi) . (c + di)
        = a(c+di) + bi(c+di)
        = ac+adi + cbi + (bi.di)          ....... (eqn 1)
let's sort out the (bi.di)
(bi.di) = bd.i^2
we know that i^2 = -1
so, db.i^2 = -bd
Returning to where we were in eqn (1),
zi . z2 = ac + adi + cbi - (bi.di)
        = ac + adi + cbi - bd
        = (ac - bd) + (adi + cbi)
        = (ac - bd) + (ad + cb).i



Division of complex numbers 
Again we have two complex numbers zi and z2
zi = a + bi
z2 = c + di

zi / z2 = (a+bi)/(c+di)

We can use the rule:
(a+b).(a-b) = a^2-b^2

The Conjugate of a complex number is a reverse of the direction of the imaginary number.
The Conjugate of (a + bi)is (a - bi)
The Conjugate is written with a bar over the top, so the conjugate of z1 is written z1 bar. 
How do I type that here? I don't know!

When we multiply an imaginary number by its conjugate we get a Real number. Here's the trick:

zi     (a+bi)   c-di   ac-adi + bci-bdi^2
--- =  ------ . ---- = -------------------
z2     (c+di)   c-di   c^2 + d^2

      ac-adi + bci-bdi^2         [remember that , i^2 = -1]
    = ------------------- 
         c^2 + d^2


      ac-adi + bci+bd
    = ----------------- 
         c^2 + d^2

       (ac+bd) + (bc-ad)i
    = --------------------- 
         c^2 + d^2

       ac+bd         bc-ad
    =  --------  +  ------- . i
       c^2+d^2      c^2+d^2


example.

1+2i    (1+2i)   2-3i   (1.2) + (1.(-3i)) + (2.2i) + (2i.(-3i))

---- =  ------ . ---- = ---------------------------------------
2+3i    (2+3i)   2-3i   (2.2) + (2.(-3i) + (3i.(2) + (3i.(-3i))

       2 - 3i + 4i - 6i^2
     = ------------------
       4 - 6i + 6i + 9i^2


        2 - 3i + 4i + 6

     =  ------------------
             4 + 9
     
        8 + i
     =  -----
         13  
     
     =  8      1
       ---  + --- i     
       13     13





Basic imaginary numbers from definition

i^0  = 1
i^1 = i
i^2 = -1
i^3 = -i
i^4 = 1


i^5  = i
i^6 = -1
i^7 = -i
i^8 = 1
i^9 = i

e.g.
So, i^ 325 = ?
325/4 = 8 remainder 1
( note 1 is the modulus)
same as i^1 = i

Remember, i = sqrt( -1 )

OK, a little bit More
I should really quickly note the definition:

We know that, 
i = sqrt -1
and therefore
i^2 = -1


therefore,
i^1 = i    [ anything to the power of 1 is itself ]
i^2 = -1   [ given above ]
i^3 = i^2.i^1 = -1.i = -i   
i^4 = i^3.i^2.i^1 = -i.-1.i = 1




A bit more on complex numbers

Wednesday, September 28, 2011

Camouflage extreme.

!
How can the octopus do this when colour blind?
How is it tricking us?
And so quick.

Tuesday, September 20, 2011

Cleaning the Mac Mighty Mouse

They do get clogged up. That's the only pain with them - they weren't designed to be cleaned and Apple didn't expected them to get clogged with gunk.
Years of scrolling down and not able to scroll up ensued.

How to Clean - attempt ONE.
  1. turn the mouse upside down
  2. Put the ball on a sheet of white paper and quickly move the mouse around for a minute or so making sure the ball is being exercised.
This sort of works sometimes. Though often just as a brief respite.

How to Clean - attempt TWO.
When it's all got too much and attempt one isn't enough then:

Tools needed are few, I used the screwdriver of a Swiss Army knife and a tiny phillips screw driver and glue to put it back together.

There are 4 tiny rollers in the ball device. When you take the device apart make a note of their orientation. You can review it in the video.

How to do it, see this helpful Video.

Friday, September 16, 2011

The Elephant test. It's difficult to describe but you know it when you see it.

I think it's an Indian story but probably our most famous version was by John Godfrey Saxe.


It was six men of Indostan
To learning much inclined,
Who went to see the Elephant
(Though all of them were blind),
That each by observation
Might satisfy his mind

The First approached the Elephant,
And happening to fall
Against his broad and sturdy side,
At once began to bawl:
"God bless me! but the Elephant
Is very like a wall!"

The Second, feeling of the tusk,
Cried, "Ho! what have we here
So very round and smooth and sharp?
To me 'tis mighty clear
This wonder of an Elephant
Is very like a spear!"

The Third approached the animal,
And happening to take
The squirming trunk within his hands,
Thus boldly up and spake:
"I see," quoth he, "the Elephant
Is very like a snake!"

The Fourth reached out an eager hand,
And felt about the knee.
"What most this wondrous beast is like
Is mighty plain," quoth he;
" 'Tis clear enough the Elephant
Is very like a tree!"

The Fifth, who chanced to touch the ear,
Said: "E'en the blindest man
Can tell what this resembles most;
Deny the fact who can
This marvel of an Elephant
Is very like a fan!"

The Sixth no sooner had begun
About the beast to grope,
Than, seizing on the swinging tail
That fell within his scope,
"I see," quoth he, "the Elephant
Is very like a rope!"

And so these men of Indostan
Disputed loud and long,
Each in his own opinion
Exceeding stiff and strong,
Though each was partly in the right,
And all were in the wrong!

Moral: 

So oft in theologic wars,
The disputants, I ween,
Rail on in utter ignorance
Of what each other mean,
And prate about an Elephant
Not one of them has seen!

Eric Evans gave a good lecture on legacy systems which started by using this 

Safari's accidental zoom with Lion and Magic mouse

I've finally twigged why Safari on Mac OS Lion was zooming in for no apparent reason. It only started happening when I started using my Magic mouse which I decided to move from the family iMac.
It wasn't a multi-figure expansion type gesture or a combination of tapping and Command key.
It was of course, the iPhone & iPad smart zoom gesture.

You double-tap a web page for it to intelligently zoom to the main text area of the page. It's not that useful on my large screen so it can be turned off by de-selecting Smart zoom in the Mouse System Preferences.

Friday, August 12, 2011

Doh! Patents and Google - I despair at the pair

I've never liked the Patents thing. It's insane. And Google. I think they're losing the plot.

http://www.theregister.co.uk/2011/08/12/google_customer_notification_patent/

How can anyone grant a patent for, request a patent for, telling someone when their goods will arrive. The world's gone mad. (or is it just the US Patent Office and Google?)



Wednesday, August 3, 2011

Photo2Text

                                 ```````                               
                              .-.``.-:-:/..-.                         
                         ``.-+:---/:.`  `:  .:                        
                     `-::::::--:::::::/:-//  .:                       
                   .:/:------------------/o:-.:                       
                  :/------------------------:s.                       
                 +:---------------------------+.                      
                +:-----------------------------o`                     
               -/------------------------------:/                     
               +--------------------------------o                     
            `:/:--------------------------------o                     
            :/:/::--::::----::::::::::---------:/                     
            .s.`      `:/-::.`      .:/--------+.                     
           `yh`         .sd/          `+:-----:/                      
           :`            oo+           .+--:+-+.                      
           -.            :             .+--os:+/:                     
            :.          `/-            /:-o/+s+/`                     
             ./:--::::::::/:.       `-/:-++-so.:                      
           `::s-s/----------:::---::/:--/o-:d--                       
           /:/o-++:---------------------+::////.                      
           /:+s/++//////////////:----------+//:/                      
            :+o:::::::::::::::://+/:------:o--+.                      
            :+-:::::::::::::::::::/+/----:/::/.                       
            o:::::::::::::::::::::::++----/+`                         
           `o:::::::::::::::::::::::-+/---:/                          
           :/::::::::::::::::::::::::/o---:/                          
          `o:::::::::::::::::::::::::/o---:/                          
           `--:::+:dy::::::::::::::::o:---:o..                        
                 //++::::::::::::::/o:-----+.o.                       
                  `.-o+::::::::::/++:----:/+- :`                      
                 .:.`+///////////:---://:-`   `:                      
                .--. +----------::/::-`        /                      
               .:  ://-------:+:.`             /:.                    
             `-/  `-y:------:/.:             .-` `--` ```             
         `...`+`.:. .+-----/:  :`          .-.    `-:..`.....         
       .-.   .::/`   /:---/:   .-       .-.`    .-.         `.-`      
     `-.      -.      +--/-     /   `...`      --              .-`    
    .-       :.       -+/-      :....`        :.                 -.   
   .:       :`         o-                    --                   --  
  `/       :`                                /                     :` 
  :`      -.                                --                      : 
  /       /                                 :`                      : 

Where's the eyeballs?

Software in pictures

Really quite good article here: Software in pictures.

Here are a some of the pictures from the article. But do go and read the original.
These two are pretty self explanatory.












Yes this next one's obvious too.
















This next one is so true. Go read the article.