I think the biggest problem I have is that when I get together with Java and Python programmers at a party, I always have to justify why I brought two tall, blonde models with me when none of them can ever get a date. Then one of them always asks me to move my Ferrari because it's blocking their Toyota Corolla. Sometimes they bully me for being so successful so I have to wipe my tears away with $100 bills. I don't think people understand how hard it is to have a language that's so in demand that you can always find good paying work. So I guess I don't like how sometimes I feel like an outcast because I have so little to complain about.
Oh... and units of measure . C# has a time unit of measure, but you always have to roll your own mass, temperature, length and currency units of measure. A language like Frink already makes it pretty easy to do this. I don't understand why a business oriented language like C# doesn't have units of measure already baked in.
So this article links the Frink unit list, which about 10% of the way down has a 171 line comment ranting about the adoption of the candela as an SI unit. It's a thoroughly entertaining read.
EDIT: And of course after getting through the entire units list (it's a slow day, okay) and back the the article the author highlights that exact comment further down. Note to self: finish the article before commenting.
Written in F#, but with API's that are friendly to both F# and C#. Here's a quick F# code example:
// download standard Frink units use client = new WebClient() let lookup, msgOpt = client.DownloadString("https://frinklang.org/frinkdata/units.txt") |> Frink.parse msgOpt |> Option.iter Assert.Fail
// lookup units we'll need to calculate the age of the universe let km = lookup?km let megaparsec = lookup?megaparsec let s = lookup?s let gigayear = lookup?gigayear // billions of years
// age of the universe is the reciprocal of the Hubble constant let hubble = 73 @ km/s/megaparsec let universe = 1/hubble => gigayear Assert.AreEqual(13.39, float universe.Value, 0.01)
Also available on Nuget here: https://www.nuget.org/packages/ConUom/
If you're actually calculating something harder (like how many oxen you need to plough a starfield), google unit conversions quickly become a real hassle to keep track of.
I personally use & endorse frink (plain-ass website) which you can get here. It exists "to make physical calculations simple, to help ensure that answers come out right".
It's got an absolute ton of units predefined. In the 'programming' mode you can incrementally build up your calculation, document assumptions etc. I used it awhile back because I was curious about how much land area is needed to feed a human (assuming no losses in conversion from sunlight to food energy, less than a square meter; for high-efficiency crops, 20-50 square meters).
Not sure if the gauge shown at the start is the pressure applied at the face, but assuming 4000 psi, a face diameter of 10cm and a compressed book thickness of 5 cm, the compressed volume is about 400cc, and energy = volume * pressure
In Frink:
400cc 4000psi -> g TNT
~=2.4 grams TNT
>And about confusing units in a scientific calculation: is this about very specific programming languages which support scientific units?
Have a look at the Frink language: https://frinklang.org, and see how far you want to go down that path. It supports 1000s of different units IIRC.
There are lots of bugs that can still occur in programming which are nothing to do with using the wrong types. That includes dynamic languages where type-checking is at runtime.
I like this, it reminded me of frink, a programming language I experimented a bit with, the author was concerned with people often forgetting about converting units of measure.
Here's a quick example that shows how you can calculate the wavelength of MIT's radio station in the school's favorite unit of length, the "smoot":
// download and parse standard units using var client = new WebClient(); var str = client.DownloadString("https://frinklang.org/frinkdata/units.txt"); var success = Frink.TryParse(str, out UnitLookup lookup); Assert.IsTrue(success);
var smoot = lookup["smoot"]; // height of Oliver Smoot var wmbr = lookup["megahertz"].Measure(88.1m); // frequency of radio station WMBR var c = lookup["c"].Measure(1); // speed of light (as a measurement) var wavelength = c / wmbr; // WMBR's wavelength var nSmoots = wavelength.ConvertTo(smoot); // wavelength of WMBR in smoots Assert.AreEqual(2.0, (double)nSmoots.Value, 0.001); // WMBR wavelength = 2 smoots!
Frink seems to have the last word on using units within a language:
I think some thousands of different units are supported. After looking at that, there seemed little point in trying to do anything much in my own languages...
The Frink language:
> Frink is a practical calculating tool and programming language designed to make physical calculations simple, to help ensure that answers come out right, and to make a tool that's really useful in the real world. It tracks units of measure (feet, meters, kilograms, watts, etc.) through all calculations, allowing you to mix units of measure transparently, and helps you easily verify that your answers make sense. It also contains a large data file of physical quantities, freeing you from having to look them up, and freeing you to make effortless calculations without getting bogged down in the mechanics.
For most students, algebra and trig is usually the hardest thing about calculus, so review those. Linear algebra is actually fairly easy compared to trig and just as important to physics, and practically speaking even more important - numerical approximations to calculus are used in practice, but there's no getting around the need for linear algebra. Studying AC electric circuits is a good motivation to apply and way to visualize complex linear algebra and related things such as Fourier transforms. I think the best way to understand math is through physics, and the best way to understand physics is though electric circuits.
Also try playing with "Fermi questions" (educated guessing to get order of magnitude estimates) and try out Frink.
Why not just put a superconducting magnet around the equator with a cross section of a few square meters?
At a guess, it's the same order of magnitude as a 1-turn solenoid with a length of europaradius, and since we are interested in flux density, the area cancels out, and we want a magnetic field about 100x that of Earth in that neighborhood, so 50 gauss. Using Frink:
europaradius (50gauss)/mu0 -> A
~=2pi *10^9 amps
and superconductors can do 200,000 amps/cm^2 and we'll say a square cross section to make things easy, so:
(europaradius (50gauss)/mu0 /(200000 amps/cm^2))^(1/2)
~= 1.77 m on a side, square x-section s.c. cable running around the equator of Europa
and the volume of that would be:
(europaradius (50gauss)/mu0 /(200000 amps/cm^2)) 2pi europaradius
~=3.1 * 10^7 m^3 of Niobium-tin at 5.7g/cc
~= 175 million tonnes
I'm guessing MgB2 would be cheaper if you're on a budget.