From: Canopus56 on
Dear Group,
> I could use some help in coaxing the JulianDayNumber output from an exponential form, e.g. -
> 2.43612*10^6 into the form: 2436116.31

Jumping back to my 1-18 message, any ideas on how to force the formatting of the number output of the function.

Thanks, Kurt

----- Original Message ----
From: Canopus56 <canopus56(a)yahoo.com>
Sent: Mon, January 18, 2010 7:13:03 PM
Subject: Re: First function debug help

Please disregard the prior message.� I was able to debug the function and get it running by applying a little more brain power. The final functions are appended.

I could use some help in coaxing the JulianDayNumber output from an exponential form, e.g. -

2.43612*10^6

into the form:

2436116.31

Thanks again for all your help.

- Kurt


JulianDayNumber[{y_, m_, d_, h_, mins_, s_}] := Module[
� {b, f, JD, MJD},
� (* This function computes the Modified Julian Day from a system \
formatted date. Domain is restricted to Greogorian dates. Source:
� Meeus. 1998. Chap. 7. Astronomical Alogrithms. p.
� 61.� Test data is for launch of Sputnik on {1957,10,4,19,26,
� 24} which should yield JD2436116 .31 *)
� b = 2 - IntegerPart[y/100] + IntegerPart[IntegerPart[y/100]/4];
� (* fractionalize the day value *)
� f = d + (h/24) + (mins / ( 24 * 60 )) + (s /(24 * 3600));
� JD = IntegerPart[(365.25 *(y + 4716))] +
��� IntegerPart[(30.6001*(m + 1))] + f + b - 1524.5;
� MJD = JD - 2400000.5;
� (* NumberForm[JD,{15,10}] *)
� JD
� ]

JulianDayModified[{y_, m_, d_, h_, mins_, s_}] := Module[
� {b, f, JD, MJD},
� (* This function computes the Modified Julian Day from a system \
formatted date. Domain is restricted to Greogorian dates. Source:
� Meeus. 1998. Chap. 7. Astronomical Alogrithms. p.
� 61.� Test data is for launch of Sputnik on {1957,10,4,19,26,
� 24} which should yield MJD36115 .81 *)
� b = 2 - IntegerPart[y/100] + IntegerPart[IntegerPart[y/100]/4];
� (* fractionalize the day value *)
� f = d + (h/24) + (mins / ( 24 * 60 )) + (s /(24 * 3600));
� JD = IntegerPart[(365.25 *(y + 4716))] +
��� IntegerPart[(30.6001*(m + 1))] + f + b - 1524.5;
� MJD = JD - 2400000.5;
� (* NumberForm[MJD,{15,5}] *)
� MJD
� ]




From: Albert Retey on
Am 21.01.2010 10:53, schrieb Canopus56:
> Dear Group,
>> I could use some help in coaxing the JulianDayNumber output from an
>> exponential form, e.g. - 2.43612*10^6 into the form: 2436116.31
>
> Jumping back to my 1-18 message, any ideas on how to force the
> formatting of the number output of the function.

one simple possibility is this:

AccountingForm[x, 10]

or if you need a string for e.g. exporting it:

ToString[AccountingForm[x, 10]]

hth,

albert