Finding numerical values to an equation describing a hyperplane or a plane (any software suggestion?)

36 Views Asked by At

The following equation $$0.27a+0.1b+0.13c=70$$ can admit many solution. Is there any software/methods I can use so that I can have a large list of all the possible numerical solutions to this equation?

The background to such a problem

So I am designing for my friend a recipe, and I know chicken, yoghurt and eggs, contain 0.27g, 0.1g and 0.13g of proteins per gram respectively. Suppose I would like to have 70g of proteins, what are the combinations of the respective amount of food to make up the desired amount of proteins? In principle I can just determine randomly the amount of chicken I'd like to have and that of eggs and solve for the remaining term, but is there anything I can do so that I can have a list of all possible positive solutions to choose from (to save the hassles?)?

3

There are 3 best solutions below

2
On

That equation has infinitely many solutions, corresponding to the points on the triangle in three dimensions whose vertices correspond to all chicken, all yoghurt and all eggs. So a list is impossible.

I suspect that the recipe would not produce a tasty dish at or near any of those extreme points.

Perhaps you should precompute a short list of solutions near the center of the triangle and give your friend that list.

0
On

If we admit that $(a,b,c)$ are integer, you could consider that you face a diophantine equation in three variables $$27a+10b+13c=7000$$

Have a look here to get the approach and the solutions $$a=10k-9m\qquad b=700-27k+2m\qquad c=m$$ Since all of them must be positive, this restricts the range of the solutions. It is very easy to code.

2
On

I would suggest formulating this as a linear programming problem. Rather than generating a list of feasible solutions and then choosing one manually, the LP will have an objective function so that the model will choose for you, based on some criterion that you establish. For example each food in the diet can have a cost (which you want to minimize) or a taste score (which you want to maximize). In fact this is a classic LP problem called the diet problem.