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

Full-simplify improvements #89

Open
2 of 3 tasks
sharkdp opened this issue Jul 5, 2023 · 6 comments
Open
2 of 3 tasks

Full-simplify improvements #89

sharkdp opened this issue Jul 5, 2023 · 6 comments
Milestone

Comments

@sharkdp
Copy link
Owner

sharkdp commented Jul 5, 2023

input, current result, desired result

input current result desired result
gal/in 6.135792 gal^(2/3) 231 in²
Pa m² 1 Pa m² 1 N (qalculate: 1 J/m)
J/s 1 J/s 1 W
sqrt(ℏ gravitational_constant / speed_of_light^3) 1.61626e-35 J^(1/2)·s/kg^(1/2) 1.61626e-35 m
m * g / cm 1 g·m/cm 100 g
mph * s/m 1 mph·s/m 0.44704
J/atm*mpg/mi 9.52979e-7 J·mpg^(3/2)/atm 0.00260718
3% * 1kg 3 %·kg 0.03 kg

They seem to fall into different categories:

  • can be simplified to scalar (seems easy to fix?)
    • mph * s/m, 1 mph·s/m, 0.44704
    • J/atm*mpg/mi, 9.52979e-7 J·mpg^(3/2)/atm, 0.00260718
  • just give us the base unit for this dimension (see also: Introduce unit systems #116)
    • sqrt(ℏ gravitational_constant / speed_of_light^3), 1.61626e-35 J^(1/2)·s/kg^(1/2), 1.61626e-35 m
    • J/s, 1 J/s, 1 W
    • Pa m², 1 Pa m², 1 N
    • m * g / cm, 1 g·m/cm, 100 g
    • 3% * 1kg, 3 %·kg, 0.03 kg
  • more complex cases
    • gal/in, 6.135792 gal^(2/3), 231 in²

Additional references:

@sharkdp sharkdp modified the milestone: public release Jul 10, 2023
@sharkdp sharkdp added bounty and removed bounty-50 labels Jul 12, 2023
@sharkdp
Copy link
Owner Author

sharkdp commented Aug 29, 2023

The trivial case is fixed, e.g. we now have mph · s/m = 0.44704.

@sharkdp
Copy link
Owner Author

sharkdp commented Aug 29, 2023

Another case closed: m * g / cm is now simplified to 100 g.

sharkdp added a commit that referenced this issue Aug 29, 2023
@sharkdp
Copy link
Owner Author

sharkdp commented Aug 29, 2023

And another one: 3% · kg is now simplified to 0.03 kg

@sharkdp
Copy link
Owner Author

sharkdp commented Aug 29, 2023

This is quite ridiculous:

The bohr radius definition in the current prelude

4 pi ε0 ℏ^2 / (electron_charge^2 electron_mass)

leads to

5.29177e-11 F·J²/(C²·kg·m·Hz²)

instead of the simplified

5.29177e-11 m

@sharkdp
Copy link
Owner Author

sharkdp commented Sep 2, 2023

Both the bohr_radius case as well as the gal/in case have been resolved with #142

@sharkdp
Copy link
Owner Author

sharkdp commented Nov 27, 2023

Just a few more examples that need to "just work":

  • 50 Ω * 2 A -> 100 V
  • 10 N / 5 Pa -> 2 m²

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

1 participant