Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: First function debug help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106746] Re: [mg106629] Re: First function debug help
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Fri, 22 Jan 2010 05:40:13 -0500 (EST)
  • References: <201001191013.FAA29050@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

JulianDayNumber[{2006, 1, 21, 15, 22, 36}]
AccountingForm[%, 10]

2.45376*10^6

2453755.141

Bobby

On Tue, 19 Jan 2010 04:13:47 -0600, Canopus56 <canopus56 at yahoo.com> wrote:

> 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
>  ]
>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Finding and changing strings in a matrix
  • Next by Date: Re: How To invert ColorFunction
  • Previous by thread: Re: First function debug help
  • Next by thread: Re: First function debug help