Is there some way to extend Mathematica's dimensional analysis? For example, I'd like to be able to provide it with dimensional equations like energy=mass with units scalings like c^2 and have it extend the possible interpretations in terms of target dimensions and/or units.

Although my question is more general, the aforementioned case is supported by DimensionalCombinations if you provide the additional parameter IncludeQuantities -> "PhysicalConstants" with this example:

       { QuantityVariable["E", "Energy" ]},
       QuantityVariable["m", "Mass"],
     IncludeQuantities -> "PhysicalConstants",
     GeneratedParameters -> None]

which produces these possible interpretations: enter image description here

PS: I'm aware of this answer providing a kludge to extend units conversions but it isn't clear this will also extend the function of, for example, DimensionalCombinations and, in any event, I would hope for something that isn't a kludge. (And in any event, the code in that answer doesn't work on my cloud notebook copy. It produces an error upon executing the test.)

  • 1
    $\begingroup$ It isn't clear what you are looking for (also I don't see the connection to the post you linked to). Can you provide an example input that you would like to work but does not? $\endgroup$
    – Jason B.
    Commented Aug 30, 2022 at 17:40
  • $\begingroup$ I had the wrong link. Corrected. $\endgroup$ Commented Aug 30, 2022 at 17:53
  • $\begingroup$ BTW, there is a strong preference on SE for questions to be self-contained and not to depend on potentially volatile links to essential code. Folks seem okay with posting code to a permanent service like pastebin.com, if the code won't fit in a question. $\endgroup$
    – Michael E2
    Commented Aug 30, 2022 at 18:08
  • $\begingroup$ The code in that linked post is a horrible kludge because it tries to redefine internal functions that are bound to change - I would be very surprised if it still works after these years. Instead one should define their own function GeneralizedUnitConvert[....] which defaults to the usual UnitConvert when it has no special rules for the given inputs. $\endgroup$
    – Jason B.
    Commented Aug 30, 2022 at 18:39
  • $\begingroup$ Maybe these questions are related: Specify set of base units to use in UnitConvert, Getting useful units for combinations of physical constants like on WolframAlpha? $\endgroup$
    – Roman
    Commented Aug 30, 2022 at 20:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.