Frink
11–20 of 66 posts
Re: Frink
#12Re: Frink
#13Re: Frink
#14I love these examples: Let's say you wanted to fill your bedroom up with water. How much water would it take? Let's say your room measures 10 feet by 12 feet wide by 8 feet high. 10 feet 12 feet 8 feet -> gallons 552960/77 (approx. 7181.298701298701) It would take approximately 7181 gallons to fill it. Note that you get both an exact fraction and an approximation. (If you don't want to see the fraction, put a decimal…
Amusingly, this example wouldn't be nearly as impressive if you used metric units instead.
3 m 4 m 3 m -> liters
36000
3 m 4 m 3 m water -> kg
36000
2 metricton / (3 m 4 m water) -> m
1/6Re: Frink
#15I love these examples: Let's say you wanted to fill your bedroom up with water. How much water would it take? Let's say your room measures 10 feet by 12 feet wide by 8 feet high. 10 feet 12 feet 8 feet -> gallons 552960/77 (approx. 7181.298701298701) It would take approximately 7181 gallons to fill it. Note that you get both an exact fraction and an approximation. (If you don't want to see the fraction, put a decimal…
Re: Frink
#16Re: Frink
#17Re: Frink
#18I love these examples: Let's say you wanted to fill your bedroom up with water. How much water would it take? Let's say your room measures 10 feet by 12 feet wide by 8 feet high. 10 feet 12 feet 8 feet -> gallons 552960/77 (approx. 7181.298701298701) It would take approximately 7181 gallons to fill it. Note that you get both an exact fraction and an approximation. (If you don't want to see the fraction, put a decimal…
These are fun and I do them often, but you can just use google for most of this.
Re: Frink
#19The units file (and its comments) makes a thrilling read https://frinklang.org/frinkdata/units.txt
Beware the SI's broken definition of Hz. You should treat the radian as being correct, as a fundamental dimensionless property of the universe that falls out of pure math like the Taylor series for sin[x], and you should treat the Hz as being a fundamental property of incompetence by committee.
[...]
Either way, if I ever develop a time machine, I'm going to go back and knock both groups' heads together. At a frequency of about 1 Hz. Or better yet, strap them to a wheel and tell them I'm going to spin one group at a frequency of 1 Hz, and the other at 1 radian/s and let them try to figure out which one of those stupid inconsistent definitions means what. Hint: It'll depend on which time period I do it in, I guess, thanks to their useless inconsistent definition changes.
The rest of the diatribe on Hz ends up amusingly spittle flecked with some decent frothing in evidence. I always knew that the kilo was bollocks (lump in a jar) but that barely gets a nod here. I had no idea about the state of some of the other units (like Hz)
Re: Frink
#20For the bedroom example someone posted, here's the equivalent in pint:
import pint
# Possibly my least favorite thing about Pint is
# the verbose importing/instantiating dance
u = pint.UnitRegistry()
q = u.quantity()
# there are multiple ways of making objects:
volume = q('10 feet') * q(10, 'feet') * (10 * u.feet)
volume.to('gallons)
# How deep could you fill the room?
(q('2 tons') / (q('10 feet') * q('12 feet') * u.water/u.gravity)).to('feet')
Notes:- Pint has far fewer material property entries in its database (though one can make arbitrary unit registries --- I'm wondering about an importer for the Frink ones... but https://frinklang.org/frinkdata/units.txt doesn't seem to have a license?)
- That said, I'm not wild about Frink's treatment of material properties: Why is the constant `butter` a density, but `eggwhite` a mass, and `naturalgas` a specific energy?
- Pint works (mostly) nicely with numpy and can (sometimes) drop into existing code, since objects quack like builtin numbers.