tonybaldwin: tony baldwin (Default)
I need a #physicist and/or a #physician here.
I want to be able to calculate #calories burned in a running #workout .
Now, there are all kinds of "calorie calculators" online, but I don't want to use those. I need to know what math they employ to derive their answers.
But searching online just keeps giving me these "calorie calculators".
No where am I finding a mathematical formula, which is what I was hoping to find.

If I try to work backwards from the answers they give me:
The three factors most commonly asked for are
My #weight: 145 lbs
Time: 30 mins
Activity: #running 10 min/mile
-----------------------------
Response: 330 calories

Seems to imply that moving 145 lbs 3 miles burns 330 calories,
thus, 110 calories/mile to move my carcass.
(actuall, I've lost c. 5lbs, and am now down to 140, but just working from past workouts).

I think this gives me 110/145=calories/pound/1mile
This gives me roughly 0.7586 calories/lb/mile

So, if I weighed, theoretically, 160 and ran 5 miles
0.7586X160X5, I burn 606.9 calories?
One of the online calorie calculators gives me 608, so I can't be too far off (-1.1 difference).

So I've come up with (for English measures, lbs., miles).
calsburned=`echo "0.7568 * $weight * $distance" | bc -l`

Because a #calorie is simply a measure of heat or kinetic energy, thus, work,
and, work, as I understand it (high school physics, my friends)
is a matter of moving a certain mass a certain distance.
My understanding is that the speed or time is irrelevant.
It shouldn't matter whether I walk or run.
(although, I'm aware that resistance/friction probably do have an influence).
Moving 145 lbs 1 mile, apparently expends 110 calories.
So why do they ask me my pace or the time in these calculators?
(of course, they didn't ask for distance, but with the time+pace, the math is simple).
Shouldn't they just ask for my weight and the distance?
These calculators seem to imply that if I were running faster or slower, that would make a difference,
but, I'm guessing that's because they don't ask for distance, and are calculating that with the time and pace data, as did I.

I'm looking to incorporate this as a feature in runlog, calculation of calories burned.
Now, since I allow the user to choose what units for distances, of course, I'm also going to have to get the math for calories per kg per km, or something, too (anyone?).

But anyone who knows this shite, does it look like I'm on the right track here?

@Runner #fitness #math
tonybaldwin: tony baldwin (Default)

Originally published at tony baldwin | baldwinsoftware.com. Please leave any comments there.

Someone asked me what this:

was all about…having astutely noticed it in the last screenshot I posted.

I often have to quick math on the fly while generating estimates for clients and doing other off the cuff calculations.
Previously, while using openbox or fluxbox, I had a keybinding bring up a calculator and did the math and then killed the calculator with ctrl+q.
But, I’m all about efficiency, and lately have been learning more and more of the powerful tools in bash to do various things, from navigating the file system to handling files and manipulating text. In wmii, I always have at least one bash terminal open (my preferred terminal emulator currently being roxterm).
So, I figured there had to be an efficient means of doing math without bringing up a gui calculator, too, but bash doesn’t like floating point numbers so well.
Now, with expr or echo or let one can do some basic math (ie. expr 220+34, or echo $((220+34))), but not with floating point numbers (with decimal points), which I need.
But bc can do it. One would have to type in something like:
echo ‘5467 * 0.09′ | bc
or
bc -l <<< 5467*0.09
to get the result....
Not really quick-n-dirty...
So, I scripted it:

#!/bin/bash
# do math with bc
echo “Enter your equation:”
read e
echo “The result is:”
bc -l <<< $e

I called the script ‘M’ (for ‘Math’), and stuck it in /usr/local/bin.
Now, I just type
$ M
and I see:

Enter your equation:
(enter equation here)
The result is:
(result appears)
$
all done.
I type 1 letter (two keys, shift+m), and my equation.

tony@deathstar:~$ M
Enter your equation:
3452*0.09
The result is:
310.68
tony@deathstar:~$

./tony

Profile

tonybaldwin: tony baldwin (Default)
tonybaldwin

December 2013

S M T W T F S
1234567
8 91011121314
15161718192021
22232425262728
293031    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags