Plurimath

UnitsML

Author’s picture Suleman Uzair Author’s picture Ronald Tse on 08 Apr 2024

Introduction

Plurimath has recently integrated UnitsML, empowering users with enhanced capabilities to process scientific units of measurement. This enhancement reflects Plurimath's commitment to adapting to the evolving needs of users in mathematics and science.

Using UnitsML

We can process UnitsML using two types of syntaxes.

The first type of input will be the same syntax followed for the other languages.

  string = '"unitsml(<unitsml string>)"' # => anything before after the double quotes will be ignored
  string = 'unitsml(<unitsml string>)' # => OR anything before letters "unitsml" and after the closing parenthesis will be ignored
  string = '<unitsml string>' # => OR
  fomrula = Plurimath::Math.parse(string, :unitsml)

Only the '<unitsml string>' part of the string will be processed and the rest will be ignored. see the input examples below

  string = '"unitsml(kg)" 1' # => 1 in this example will be ignored
  string = '1 "unitsml(kg)"' # => Again, 1 in this example will be ignored
  formula = Plurimath::Math.parse(string, :unitsml)
  formula.to_asciimath # => 'rm(kg)'

The other input of UnitsML is restricted to a specific syntax inside of an AsciiMath string and nothing before or/and after will be ignored. See the syntax below.

  string = '<optional asciimath string>"unitsml(<unitsml string>)"<optional asciimath string>'
  fomrula = Plurimath::Math.parse(string, :asciimath)

The output syntax will not be the same as the input, see the example below.

  string = '"unitsml(kg)" 1' # => 1 will not be ignored
  string = '1 "unitsml(kg)"' # => Again, 1 will not be ignored
  formula = Plurimath::Math.parse(string, :asciimath)
  formula.to_asciimath # => '1 rm(kg)'
Note
In AsciiMath strings, UnitsML input must be enclosed within double quotes for clarity and specificity.
Note
UnitsML in output will not be identifiable despite the input syntaxes and/or the output language.