Mathematica – UTF-8 – MacRoman – BOM

I experienced a weird situation in Mathematica yesterday. I have wholeheartedly embraced Unicode for several years, and for several years have been including Unicode characters in .m files. (In notebooks, whether characters are entered as single keystrokes (possibly modified by shift and/or option), as \[codes], or as \.xx or \:uuuu in hex, they end up as Unicode in …

Continue reading ‘Mathematica – UTF-8 – MacRoman – BOM’ »

Mathematica’s PlanckConstant

I had occasion to use Planck’s constant in some calculations the other day. Mathematica introduced new handling of units in version 9, but at present the documentation is poor. The documentation for PhysicalConstants` says “As of Version 9, the new units framework can be used via Quantity in place of the PhysicalConstants` package”; but the documentation is …

Continue reading ‘Mathematica’s PlanckConstant’ »

Mathematica Assert[ ]

I’ve been using my own Assert[] function in Mathematica for quite some time. In Mathematica version 8, it was implemented as a built-in. I skipped version 8, but recently installed version 9. When I first used the new Assert, I was confused: Assert[True] returned unevaluated! I quickly discovered that you need to enable the Assert function through evaluating     On@Assert I found nothing on Google; …

Continue reading ‘Mathematica Assert[ ]’ »

Mathematica RawArray, ArrayObject

I skipped Mathematica Version 8, going directly from 7 to 9, so I’m not sure exactly when RawArray and ArrayObject were added to Mathematica. These are apparently compact forms, roughly comparable to Packed Array, of lists of: unsigned bytes (“Byte”), unsigned (16‑bit) halfwords (“Bit16”), unsigned (32‑bit) words (“Integer32”, or “Integer”, which maps to “Integer32”), machine float single (“Real32”), and …

Continue reading ‘Mathematica RawArray, ArrayObject’ »