Fat Math
11 years ago
So, I came home after school today with the math part of my brain still running at full-tilt, and the fat-loving part of my brain starting to edge in. The result? I take what I'm learning in school right now and apply it to things it was probably never meant to apply to. FOR SCIENCE!
This also, oddly enough, was a good exercise to keep me polished on system analysis in discrete time.
Because the math part of my brain is starting to shut down, this is copy-pasted from the notes I made earlier.
So, without further ado:
[Start Math]
A very rough formula to represent a person's weight and weight gain, based on starting weight
and food eaten each day. This is not intended to model real life nutrition, just imitate it.
I'll use a discrete-time formula for this.
y[k] = person's weight on day k; starting weight is y[0]
f[k] = amount of food eaten on day k.
Three constants:
a: Fraction of food converted into body weight; this is dependent on the kind of food eaten,
but for now I'll keep it as a constant to keep things simple. In most cases, this will be
between 0 and 1.
b: Fraction of body weight needed each day for sustenance, and therefore subtracted from any
weight gain. Again, this is dependant on the exact body type, composition, activities, and
temperature, but I'll keep it as a constant for now. In most cases, this will be between 0 and
1.
c: Starting weight; aka, person's initial weight when this modeling started. In most cases,
this should be the person's lean weight.
To simplify things later, I'm introducing a fourth variable now, which is based on b:
d = (1-b): This is fraction of body weight retained each day.
(-d) = (b-1)
NOTE: We're assuming this is a causal system, so f[k] = f[k]u[k]. This system can only track
food eaten starting on day 0.
And now, the formula:
y[k+1] = y[k] + af[k] - by[k]
With the initial condition y[0] = c
Put into standard form:
y[k+1] + (b-1)y[k] = af[k]
y[0] = c
Solving for the zero-input equation yields:
y(zin)[k] = c(1-b)^k = cd^k
This is exponential decay when 0<b<1, which makes 0<d<1, which makes sense; someone should
lose weight if they aren't eating anything.
Solving for h[k] yields:
h[k] = ((b-1)/a)*(unit impulse function[k]) + c(1-b)^k*(unit step function[k])
Solving for h[0] by plugging h[k] and (unit impulse function [k]) into the formula yields:
h[0] = a
Plugging this into h[k], making it h[0], yields:
a^2 + (-c)a + (1-b) = 0
Going back to h[k], solving for the zero-state equation yields:
y(zis)[k] = f[k] convoluted with h[k].
This yields:
y(zis)[k] = ((b-1)/a)*f[k] + c(1-b)^k*(Sum, as m goes from 0 to k, of f[m]/(c(1-b)^m))
Plugging in d yields:
y(zis)[k] = (-d/a)*f[k] + cd^k*(Sum, as m goes from 0 to k, of f[m]/(cd^m))
Putting it all together:
y[k] = y(zin)[k] + y(zis)[k]
y[k] = cd^k + (-d/a)*f[k] + cd^k*(Sum, as m goes from 0 to k, of f[m]/(cd^m))
And finally:
y[k] = (-d/a)*f[k] + cd^k(1 + (Sum, as m goes from 0 to k, of f[m]/(cd^m)))
[End Math]
So, what do you think? By the way, this isn't as advanced as it looks; if you can't follow along, that's probably because I'm taking a few shortcuts for the sake of space; if I wasn't so impatient to get this posted, I'd take the time and space to explain each step of the way.
This also, oddly enough, was a good exercise to keep me polished on system analysis in discrete time.
Because the math part of my brain is starting to shut down, this is copy-pasted from the notes I made earlier.
So, without further ado:
[Start Math]
A very rough formula to represent a person's weight and weight gain, based on starting weight
and food eaten each day. This is not intended to model real life nutrition, just imitate it.
I'll use a discrete-time formula for this.
y[k] = person's weight on day k; starting weight is y[0]
f[k] = amount of food eaten on day k.
Three constants:
a: Fraction of food converted into body weight; this is dependent on the kind of food eaten,
but for now I'll keep it as a constant to keep things simple. In most cases, this will be
between 0 and 1.
b: Fraction of body weight needed each day for sustenance, and therefore subtracted from any
weight gain. Again, this is dependant on the exact body type, composition, activities, and
temperature, but I'll keep it as a constant for now. In most cases, this will be between 0 and
1.
c: Starting weight; aka, person's initial weight when this modeling started. In most cases,
this should be the person's lean weight.
To simplify things later, I'm introducing a fourth variable now, which is based on b:
d = (1-b): This is fraction of body weight retained each day.
(-d) = (b-1)
NOTE: We're assuming this is a causal system, so f[k] = f[k]u[k]. This system can only track
food eaten starting on day 0.
And now, the formula:
y[k+1] = y[k] + af[k] - by[k]
With the initial condition y[0] = c
Put into standard form:
y[k+1] + (b-1)y[k] = af[k]
y[0] = c
Solving for the zero-input equation yields:
y(zin)[k] = c(1-b)^k = cd^k
This is exponential decay when 0<b<1, which makes 0<d<1, which makes sense; someone should
lose weight if they aren't eating anything.
Solving for h[k] yields:
h[k] = ((b-1)/a)*(unit impulse function[k]) + c(1-b)^k*(unit step function[k])
Solving for h[0] by plugging h[k] and (unit impulse function [k]) into the formula yields:
h[0] = a
Plugging this into h[k], making it h[0], yields:
a^2 + (-c)a + (1-b) = 0
Going back to h[k], solving for the zero-state equation yields:
y(zis)[k] = f[k] convoluted with h[k].
This yields:
y(zis)[k] = ((b-1)/a)*f[k] + c(1-b)^k*(Sum, as m goes from 0 to k, of f[m]/(c(1-b)^m))
Plugging in d yields:
y(zis)[k] = (-d/a)*f[k] + cd^k*(Sum, as m goes from 0 to k, of f[m]/(cd^m))
Putting it all together:
y[k] = y(zin)[k] + y(zis)[k]
y[k] = cd^k + (-d/a)*f[k] + cd^k*(Sum, as m goes from 0 to k, of f[m]/(cd^m))
And finally:
y[k] = (-d/a)*f[k] + cd^k(1 + (Sum, as m goes from 0 to k, of f[m]/(cd^m)))
[End Math]
So, what do you think? By the way, this isn't as advanced as it looks; if you can't follow along, that's probably because I'm taking a few shortcuts for the sake of space; if I wasn't so impatient to get this posted, I'd take the time and space to explain each step of the way.
But seriously, that's something I've learned in my later math classes... it becomes less about number-crunching and more about understanding the concepts.
And just two weeks later, our teacher finally started talking about how to run a Laplace transform on stuff like this. The only reason I didn't find it in the book earlier is because, apparently, it's called the "Z-Transform", which kinda threw me for a loop. I'll update this when I get the time.
And eight months later? I'm flattered anyone still notices this. I really need to update it at some point. When I have both effort and time at the same moment.