stefnotch / quantum-sheet

QuantumSheet - A user friendly mathematics worksheet and solver
https://stefnotch.github.io/quantum-sheet/
GNU General Public License v3.0
55 stars 5 forks source link

Units #46

Open Ephraim-Bryski opened 3 years ago

Ephraim-Bryski commented 3 years ago

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:

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}:

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.

stefnotch commented 3 years ago

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

Ephraim-Bryski commented 3 years ago

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.