P
P
pcdesign2021-08-21 22:50:20
Python
pcdesign, 2021-08-21 22:50:20

How to calculate BJU?

For example, there are products that in 100 grams contain:

[
   {
      "Гречка":{
         "Белки":11.7,
         "Жиры":2.7,
         "Углеводы":75
      }
   },
   {
      "Яйца":{
         "Белки":12.7,
         "Жиры":11.5,
         "Углеводы":0.7
      }
   },
   {
      "Сало":{
         "Белки":1.4,
         "Жиры":90,
         "Углеводы":0
      }
   }
]


How much you need to eat to get it, for example 100 gr. protein, 95 gr. fats and 150 gr. carbs?

In theory, the first thing that came to mind was
https://ru.wikipedia.org/wiki/Task_about_backpack
I got into Google, well, I found some options.
https://pypi.org/project/knapsack/
But they are not very suitable for this problem.

PS If it's stupid to count in Excel, then it turns out you need to eat ~ 200 gr. buckwheat, 600 gr. eggs and 20 gr. fat.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hint000, 2021-08-22
@pcdesign

https://www.google.com/search?q=linear+algebra+p...
https://ru.wikipedia.org/wiki/Transition_matrix
gre=11.7*pro+2.7*fat+75*cbh
egg= 12.7*pro+11.5*fat+0.7*cbh
sal=1.4*pro+90*fat+0*cbh Transition matrix :
11.7
2.7 75
12.7 11.5 0.7
1.4 90 50, 150). Do not forget that 100 g was taken as a unit of measurement.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question