Re: Age in days.
- From: Michael Orion <beeworks@xxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 12:40:10 EST
> Here is a simple way of calculating a persons age in
> thousands of days.
>
> Age(days) = age(years) / 3 + one tenth of the result.
>
> For a 45 year old: 45 / 3 = 15. Now add one tenth of
> 15 to 15 = 15 +
> 1.5 = 16.5 so the person is approximately 16 500 days
> old.
>
> The person will be less than their calculated age in
> days on their
> birthday. They will reach the calculated days some
> months afterwards.
> The number of months can be calculated by
>
> months = age(years) / 20
>
> So the 45 year old will reach 16 500 days of age
> about 2 months after
> their birthday.
>
> The more mathematically astute will realise that the
> formula for the
> age in days is just
>
> age(days) = 1.1 * x / 3
>
> which, when multiplied by 1000 becomes
>
> age(days) = 366 * age(years)
>
> but it's not so easy to work out mentally as the
> above algorithm.
>
Such algorithms have existed for a long time. Here is a very accurate algorithm to find the number of days from January 1, 1 AD. You could easily employ it to get your number of days old a person is, but with much more accuracy than your algorithm.
Convert the year, month, and day to Julian day. See "Numerical Recipes" by Press, Flannery, Teukolsky, and Vetterling, p10.
Input:
iy = year (AD)
im = month (1 to 12)
id = day (1 to 31)
Algorithm
igreg = 588829;
if iy == 0, error('There is no year 0'), end
if iy < 0, iy = iy+1; end
if im > 2
jy = iy;
jm = im + 1;
else
jy = iy - 1;
jm = im + 13;
end
julday = floor(365.25*jy) + fix(30.6001*jm) + id + 1720995;
if (id + 31*(im+12*iy)) >= igreg
ja = fix(0.01*jy);
julday = julday + 2 - ja + fix(0.25*ja);
end
- MO
.
- Follow-Ups:
- Re: Age in days.
- From: Michael
- Re: Age in days.
- References:
- Age in days.
- From: Michael
- Age in days.
- Prev by Date: Re: the doors
- Next by Date: Re: Fourier transform of a frequency dependent gaussian function
- Previous by thread: Age in days.
- Next by thread: Re: Age in days.
- Index(es):
Relevant Pages
|
|