# Can FindFit be used with units?

I am trying to use the units capabilities of Mathematica throughout a course that I am teaching, but am finding that it isn't uniformly implemented across many functions. In particular, I would love to be able to do the following:

p = (R T ρ)/M;
pressures = Quantity[{12.223, 25.20, 36.97, 60.37, 85.23, 101.3}, "kPa"];
massdensities =
Quantity[{0.225, 0.456, 0.664, 1.062, 1.468, 1.734}, "kg per (m m m)"];
data = {massdensities, pressures}\[Transpose];
R = Quantity["MolarGasConstant"];
T = Quantity[25 + 273.15, "Kelvins"];

FindFit[data, p, M, ρ]


Unfortunately, FindFit seems to require that everything be unitless. Am I missing something?

• No, unit functionality isn't yet implemented in FindFit – ilian Jan 10 '18 at 3:21
• Thank you. It's a shame, as the units functionality is quite useful, and yet my students and I are repeatedly coming across cases where we have to strip the units in order to do something, and it often takes quite some time to track down to it being the units that are the problem. – Kevin Ausman Jan 15 '18 at 23:31
• Help > Give feedback brings you to: wolfram.com/support/contact/email – rhermans Jul 9 '18 at 22:53