Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units #46

Open
5 tasks
Ephraim-Bryski opened this issue Aug 29, 2021 · 2 comments
Open
5 tasks

Units #46

Ephraim-Bryski opened this issue Aug 29, 2021 · 2 comments

Comments

@Ephraim-Bryski
Copy link
Collaborator

Ephraim-Bryski commented Aug 29, 2021

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
@stefnotch
Copy link
Owner

@Ephraim-Bryski
Copy link
Collaborator Author

Alternatively we could use the [ ] for units
https://math.stackexchange.com/questions/2332348/is-there-a-symbol-for-has-units-of/2332352#2332352

Yeah, I think that might be the most elegant. The only issue is if we decide to use brackets for arrays, it could get confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants