Thursday, February 4, 2010

[Ruby] Difference between NaN and Infinity

I am not sure if this is limited to ruby,
but came across a sweet data type that ruby
maintains when some sort of "wrong" operation
is encountered.

Infinity: Is the typical value, when a number
is divided by zero or a very small number (close
to zero).

NaN: Not a number is Ruby's way of saying that
zero was divided by a zero ==> resulting
in an undefined result which is indicated
by the NaN. Unfortunately, I am not sure if
Ruby has support for testing if a variable has
NaN value.

Difference between .dup and .clone in ruby objects

Being a newbie to Ruby I was confused when I had
to deal with the task of producing an object copy.
I came across this very nice post on a mailing
list which helped me understand the difference.

The crux here is:
Clone copies the entire object as is, including the
any state information the object may contain. While
the duplicate call (.dup) does not copy all of the
state while copying the basic data.

The simplest example which shows the difference is as

obj1 = []
obj2 = obj1.clone
obj3 = obj1.dup
p obj1.frozen?, obj2.frozen?, obj3.frozen?
# => true, true, false

Monday, February 1, 2010

What is the stationary time of a mobile wireless channel?

A mobile wireless channel is typically characterised
by a large amount of variation, among other things
due to multipath fading. The stationary time of a
channel can be defined as the time for which the
channel characteristics remain the same for the
given duration. Some studies have shown that the
stationarity of a V2V channel can vary from a couple
of milliseconds to a full second.

Please refer scientific literature for more accurate
information on this topic.