I want to speed up calculations with unit conversions. I suspect primarily that some units evaluate from Wolfram|Alpha. Any way to prevent this automatically, so that Mathematica throws errors/warnings instead of grabbing units from Wolfram|Alpha?
If you don't want Mathematica to use Wolfram | Alpha for correcting incorrect units, you can just set
$AllowInternet = False. The downside of this is that it also blocks internet access for the curated data functions such as
FinancialData, etc. You can also use
Block to disallow internet only within your function.
A properly formatted
Quantity expression should work just fine, without trying to connect to WolframAlpha servers for conversion. For example,
Quantity[1, "Feet"] + Quantity[2, "Inches"]
should run with or without internet connectivity. In contrast,
Quantity[1, "Foot"] + Quantity[2, "Inches"]
will attempt to contact WA servers in an attempt to correct the malformed
I have found it efficient to enter expressions with units using the "Inline free-form input", and then clicking the InputForm (the bottom line) to replace the entered text with a canonical input form. This gives me an easy-to-read notebook that computes without internet connectivity, at the expense of a mouse click when entering units, and a slight delay when moving away (with right-arrow) from the box.
The keyboard shortcut is Ctrl-= by default, I had to remap to Ctrl-+ to fit my Norwegian layout, by editing
as described here
I gave up trying to use Quantity and the units package in version 9 because of the drop in speed and the clumsy way of incorporating units that makes long expressions difficult to read. I have therefore stuck with Jon McLoone's package that works very well. It can found at http://blog.wolfram.com/2010/12/09/automatic-physical-units-in-mathematica/#comments