simple weight conversion

83 Views Asked by At

I need some help of mathematicians :D , So here is the problem

So i am calculating calories in foods.

If I google for "calories in banana" , I get this

For 100 grams its 89 calorie ,
for 81 grams its 72 calories.
for 225 grams its 200 calories.

So Basically I know 100 grams = 89 , keeping this value how to find other calorie values using custom grams.

for example

how much calorie in 224 grams.
2

There are 2 best solutions below

1
On BEST ANSWER

As you notice, $100~\text{grams of banana} = 89~\text{calories of banana}$.

Dividing to one side, we get $\frac{100}{89}\cdot \frac{\text{grams of banana}}{\text{calories}}=1$ or equivalently $\frac{89}{100}\cdot\frac{\text{calories}}{\text{grams of banana}}=1$

You may always multiply anything by 1 without changing it's value. The trick is what "one" looks like. We may use the identity we found above.

For arbitrary $x~\text{grams of banana}$, we have

$$(x~\text{grams of banana})\cdot 1 = (x~\text{grams of banana})\cdot (\frac{89}{100}\cdot\frac{\text{calories}}{\text{grams of banana}}) = x\cdot \frac{89}{100}~\text{calories}$$


I should hope it goes without saying, but the exact ratio of calories to grams depends on what object it is in question. The ratio given above works for bananas, but might not work for water or for chocolate cake. You would need to find out how many calories are in each of those foods to create a new ratio. To create the ratio, again, you find some source of information that says "there are $C$ amount of calories in $G$ many grams of such and such food", and you can create a "one" to multiply by as $\frac{C}{G}\cdot\frac{\text{calories}}{\text{grams of such and such}}=1$

0
On

Solution:

Since 100 g = 89 calories you can conclude that every grams has .89 calories

Check $$81 * .89 \approx 72$$ and $$225 * .89 \approx 200$$

your formula is

$$ n = \text{mass} $$ $$n*.89 = \text{calories}$$

You can check on inspect element's javascript console

Sorry I haven't done javascript for forever(this is my first time doing javascript)

Javascript function

var x;
var a = 100;
function calc(a){ return a*.89}
x = calc(a){ return a*.89}
console.log(x(a));