
12 Jul
2012
12 Jul
'12
8:05 p.m.
On Thu, Jul 12, 2012 at 11:01 AM, Takayuki Muranushi
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 ;)