Saturday 23 February 2008

Extrapolation

The problem that nettles me is whether it is possible to use extrapolation, aproximation (various kinds) only on historical data from stock market for discret companies to be able to get a yield of 12% each year. Why only on historical data and only on 12%? Well 12% year to year is a lot as long as it is stable. I am reading recently a book on investment on stock markets and one thing is said there is that since its beginning a stock market in the US gave yield of an average 12% year to year. Of course, some years it was 50%, some it was -40% what counts is the average. It must be said that the best online saving account in the uk gives an interest of around 6.50% (HiSaver account) -> see www.fool.co.uk). 6.50% is decent rate but there is tax on top of that, so nett it is about 5%.

I am aware that historical data should not be used as the only source of information that influences stock market prices. As a matter of fact there are many sources of information. For instance for agrocultural companies a very important source of information would be whether next year there will be a draught. The problem is that we need to get lots of semantically well defined data for computer program to be able to reason about the future. For that purpouse we can use SOA and let a computer system collect relevant data from many different sources to be able to reason about the future. Speaking in mathematical language we always want to have a function from now, known point (today) to some not so distant point in the future, lets say next day or a week. That function shape is determinated by many factors and to be able to build it from these factors first we have to have lots of data and then to write an algorithm that calculates this function from known set of data. Shape of the function will change based on current data but historical data will also be taken into account. I am sure many have attempted to write a computer system that would be able to do that. Well that would be my dream. I just want a stable yield of 12% year to year.

Wednesday 13 February 2008

Equality in Ruby - == eql? and equal?

The == comparison checks whether two values are equal

eql? checks if two values are equal and of the same type

equal? checks if two things are one and the same object.

How do I remember which is which ... The longer the operator, the more restrictive the test it performs

Example:

irb(main):013:0> val = 17
=> 17
irb(main):014:0> val == 17.0
=> true
irb(main):015:0> val.eql?(17.0)
=> false
irb(main):016:0> val.eql?(17)
=> true
irb(main):017:0> val.equal?(17)
=> true
(written 2006-12-14 16:49:47)