On Thu, Jul 12, 2012 at 11:01 AM, Takayuki Muranushi <[email protected]>wrote:
> > sunPerMars :: [Double] > > sunPerMars = (/) <$> sunMass <*> marsMass > > Sadly, this gives too many answers, and some of them are wrong because > they assume different Earth mass in calculating Sun and Mars masses, > which led to inconsistent calculation. > I think what you want to do is factor out the Earth's mass, and do your division first: > sunPerMars'' = (/) <$> sunMassCoef <*> marsMassCoef The mass of the earth cancels. That gives a list of length 9, where your approach gave 16 distinct results. But I think that's just floating point rounding noise. Try the same monadic calculation with integers and ratios. The moral? Using numbers in a physics calculation should be your last resort ;)
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
