Skip to content

Units #46

@Ephraim-Bryski

Description

@Ephraim-Bryski

Units would be great to include, and would make it much more useful for engineering.
Check out https://github.com/sharkdp/insect

Notation for Units

I think requiring the user to import the units they want to use would be a bit annoying. Instead I think there should be a way for the user to indicate they are typing a unit; this would also avoid ambiguities.

Here's some possibilities:

  • units in curly braces, for example {m/s}
  • user types "unit", it then converts italicized text to standard text (same as when a user types a trig function) with parentheses, for example "unit(m/s)"
  • user types "unit", new box with border appears, similar to SwiftCalcs

If we have a result section on the right side, the units could be displayed with a separate color, similar to how SwiftCalcs shows units.
swiftcalcsunits

Check Input

It should check whether the unit typed makes sense. If the user types in {m/s^2}:

  • Operations are valid (multiplication, division, and exponents only)
  • All the parts (e.g. m and s) are valid units

It should also check for dimensional consistency of the equation (e.g. LHS and RHS have same dimensions, added values have same dimensions, exponents are dimensionless), and the output should have the proper dimensions. I have code for this, which produces and solves equations for dimensional consistency. I will need to modify it a bit to have it work for this project.

Change Output Units

The user should be able to change the units of the output to one of the same dimension. SwiftCalcs has a nice interface for this.
swiftcalcschangeunits

Standard Units

For now, I think we could focus on Mass, Length, and Time units although we could extend to all seven basic quantities (Mass, Length, Time, Current, Luminosity, Temperature, and Amount).

We definitely should have SI units. Especially if we want to make this useful for engineering, we should also include important U.S. customary units.

  • notation for units
  • check input
  • change output units
  • standard units
  • custom defined units

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions