Cooking Ingredient Converters
These tools, in the modality of cooking ingredient converters, are a proof of concept for the notion of merging different recursive forms (RFs). This time, we merged RFs for volume and mass conversions.
RFs automatically submit themselves when a user completes the following steps (see Theory section).
- Select an initial option or accept the default one.
- Input a value compatible with said option.
- Select a new option.
It is common in cake recipes that the sugar in the cake should be equal to the weight of the flour. If a recipe asks for 1 measuring cup of granulated sugar, how much of all-purpose flour (sifted) is needed?
To answer that question, let use our sugar and flour converters. Because there are way too many different types of flours, these are listed in alphabetical order (A-C, D-O, P-R, and S-W) across several converters. Thus all-purpose flour is listed in the A-C Flour Converter whereas granulated sugar is listed in the Sugar Converter.
Selecting the "cup, US (c)" option from the Sugar Converter, entering 1, and switching to the "granulated sugar (g)" option, indicates that 1 cup of granulated sugar is about 200 g. Repeating this exercise, but this time with the A-C Flour Converter, it turns out that 1 cup of all-purpose flour (sifted) is about 120 g.
That gives us a mass ratio of about 200/120 = 1.6. This ratio is also the density ratio of the ingredients. So if a recipe asks for 1 cup of sugar, we may use 1 cup + 2/3 cup of flour. Done!
Note please that these are mere estimates. Certainly the most accurate way to measure cooking ingredients is with a digital kitchen scale. If one is not available, ingredient amounts can be estimated using conversion tables, measuring cups, and some math. The RFs listed in this web page were designed to simplify these tasks.
RFs similar to these can be implemented in a science lab setting. After all, measuring, weighing, mixing, stirring, decanting,... are all processes used in kitchens and laboratories.
That reminds me of something I wrote a while ago (Garcia, 1995):
"If I have a theory, but no experimental results,
I may have nothing.
And If I have a theory without practical applications,
I may have an artifact."
We define a recursive form (RF) as an HTML form where the name/value pairs of successful controls are recursively generated through the decision-making process of users.
The algorithm implemented by these RFs is based on a one-dimensional associative array of the form
$index = [ "unit_1" => "value_1", "unit_2" => "value_2", ⋮ ];
where $index is obtained by merging an associative array of volumes with an associative array of masses, computed at run time as density-weighted volumes.
- The initial option and input value become the name/value pair of a dynamically generated hidden field.
- The values of the new and initial options are located in the index and their ratio taken so a scaling ratio is computed.
- The initial input value is multiplied by the scaling ratio, and the result displayed in the input field as the new value.
Users can repeat this process as many times as they wish to by simply switching to a new option.
- Prove that the mass ratio given in the example is the same as the density ratio of sugar and flour.
- Using the Milk Converter, estimate the density of whole milk in g/mL.
- CulinarySchools (2022). Recipe Ingredient Conversion Calculator. Retrieved on February 7, 2022.
- Exploratorium (2022). Cooking Conversion Calculator. Retrieved on February 7, 2022.
- FoodConverter(2022). Food Converter. Retrieved on February 7, 2022.
- Garcia, E. (1995). PhD Thesis.
- KingArthurBaking (2022). Ingredient Weight Chart | King Arthur Baking.
- MyKitchenCalculator (2022). Recipe Converter. Retrieved on February 7, 2022.
- Olson, A. (2022). Baking Conversions. Baking Day. Retrieved on February 7, 2022.
- Sciencing (2022). The Subtleties of the Density Ratio for Cake Baking. Retrieved on February 7, 2022.
- TheCalculatorSite (2022). Cooking Recipe Converter. Retrieved on February 7, 2022.
- TraditionalOven (2022). Convert measuring units of Cheese, cheddar type amount. Retrieved on February 7, 2022.