# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Find the limiting ingredient in something similar to a chemical reaction

Contributed by:
Peter Burbery

ResourceFunction["LimitingIngredient"][ finds the limiting ingredient given | |

ResourceFunction["LimitingIngredient"][ finds the values of the properties in the list | |

ResourceFunction["LimitingIngredient"][ finds the values for all the properties. |

The *relation* should be given in the form <|*input*_{1}→*quantity*_{1},…|>→<|*output*_{1}→*quantity*_{1},…|>. For example <|"*tire*"→4,"*headlight*"→2|>→<|"*car*"→1|>.

The *available* should be an Association with the inputs as keys and the number of inputs as values like <|"bread" → 28, "cheese" → 11|>.

ResourceFunction["LimitingIngredient"] assumes that only one of the ingredients is limiting. This assumption is not valid all of the time. However, by assuming there is only one limiting ingredient, we can simplify the calculations and programming logic.

The output contains the following keys:

LimitingItem | limiting item |

ExcessItems | items that are in excess with some left over |

LimitingItemRelation | association representing how the limiting item is consumed |

LeftOver | association detailing how many items are not consumed |

Relations | association representing how each item is consumed for each item |

Factors | information on what you would multiply the input "reaction" by to get a reaction for each item. |

Find the limiting ingredient for the construction of a car modeled as a reaction (as shown in Chem Libretexts).

In[1]:= |

Out[1]= |

Lists of properties are supported:

In[2]:= |

Out[2]= |

Get all available properties:

In[3]:= |

Out[3]= |

See the same reaction with different supplies:

In[4]:= |

Out[4]= |

Consider the sandwich example from OpenStax Chemistry Atoms First Second Edition Section 7.4 Reaction Yields:

For the reaction 1 slice of cheese+2 slices of bread⟶1 sandwich, how many sandwiches can we make with 28 slices of bread and 11 slices of cheese:

In[5]:= |

Out[5]= |

We can make 11 sandwiches with 11 slides of cheese and 22 slices of bread:

In[6]:= |

Out[6]= |

The cheese is the limiting item (or ingredient). The excess item is the bread:

In[7]:= |

Out[7]= |

2 laser printers, 14 desks, and 30 chairs are needed for 10 full-time faculty members and 20 full-time staff. We are given 201 laser printers, 1400 desks, and 3000 chairs. Compute the limiting resource:

In[8]:= |

Out[8]= |

In this case there are actually two limiting reagents: desks and chairs:

In[9]:= |

Out[9]= |

How many big pancakes can we make given a set of ingredients:

In[10]:= |

Out[10]= |

Wolfram Language 13.1 (June 2022) or above

- 1.0.0 – 06 December 2023

This work is licensed under a Creative Commons Attribution 4.0 International License