• Please visit and share your knowledge at our sister communities:
  • If you have not, please join our official Homebrewing Facebook Group!

    Homebrewing Facebook Group

Math wizbangs wanted... beer algebra complicated!

Homebrew Talk

Help Support Homebrew Talk:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

DSorenson

Well-Known Member
Joined
Mar 25, 2013
Messages
819
Reaction score
131
Problem:

I want to solve the hop utilization equation for T (time in boil). I have included the gravity of the wort at any given time into my equation in an effort to (probably nominally) increase my estimation accuracy. You will find the condensed problem in bold at the end.

Equations:

I = (A*U*75)/G
Where:
I is the IBU value
A is the Alpha Acid Unit value (AAU = Alpha Acid value * Ounces)
U is the utilization value
G is the terminal volume post boil in gallons

So Algebraically: U=(I*G)/(75A)

U is calculated by the following:

U=Y*Z

Where:
Y=1.65*0.000125^(((S-1)G)/(RT+G))
(S= terminal gravity post boil)
(R=boil-off rate)
(T=time in minutes)
additional note: the gravity of any given point in time of the boil is represented here as
((S-1)G)/(RT+G). The S, G, R, and G values are known constants, the only variable here is T.

AND
Z=(1-e^(-0.04T))/4.15

Setting the two equations for U equal to one another, we have the equation I must manipulate to solve for time (T).

(I*G)/(75A) = [1.65*0.000125^(((S-1)G)/(RT+G))] * [(1-e^(-0.04T))/4.15]

So, come on and make my day! I can't figure out for the life of me where I'm going wrong, but I trust that I'm forgetting a key property with working with logarithms. I've been working on this for two days.

In shorter, more brief terms:
Solve for T:
(I*G)/(75A) = [1.65*0.000125^(((S-1)G)/(RT+G))] * [(1-e^(-0.04T))/4.15]
 
Yeah, the math gets pretty thorny pretty quick. I think the best way to approach this is to look at the reasonable value range for T and do some estimating.

We're trying to calculate hop utilization, so we're probably not looking to use this equation to deal with your finishing hops, which might only be in the boil for a few minutes. Rather, the bittering hops are probably more what you're concerned with.

The messiest part of the math here is with the [(1-e^(-0.04T))/4.15] factor. If you take a look at the range of values this factor can take on, you might find it reasonable to just estimate its final value.

If T = 45, then [(1-e^(-0.04T))/4.15] is approximately 0.201.
If T = 60, then [(1-e^(-0.04T))/4.15] is approximately 0.219.
If T = 90, then [(1-e^(-0.04T))/4.15] is approximately 0.234.

Obviously, the whole point is to figure out what T is, but since the algebra is pretty much intractable, it might be reasonable to say that since we expect T to be somewhere between 45 and 90 minutes we can just estimate [(1-e^(-0.04T))/4.15] to be, say, 0.22.

That simplifies the math greatly.

Then we have something more like
(I*G)/(75A) = [1.65*0.000125^(((S-1)G)/(RT+G))] *0.22
(I*G)/(75A) = 0.363*0.000125^{[(S-1)G]/(RT+G)}
(I*G)/(27.225A) = 0.000125^{[(S-1)G]/(RT+G)}
ln[(I*G)/(27.225A)] = [((S-1)G)/(RT+G)]*ln(0.000125)
.
.
.
T = [(S-1)*G*ln(0.000125)]/{R*ln[I*G/(25.225*A)]}

In the end, it comes down to how much you're willing to assume. And if the type of assumption I proposed is acceptable, the precise value chosen for the [(1-e^(-0.04T))/4.15] factor is something you'll have to settle on. Note that by the time T = 45, the [(1-e^(-0.04T))/4.15] factor doesn't change much as T increases. But if you did want to look at hop utilization for T = 10, [(1-e^(-0.04T))/4.15] is about 0.079. If you take a look at the graph of y = (1-e^(-0.04T))/4.15 you can see that it doesn't really start to flatten until T is around 35.

If you anticipated short boil times, you'd probably want to recalculate the [(1-e^(-0.04T))/4.15] factor.

Assuming I've done my math correctly, I think the simplified equation above should serve you pretty well. I hope that helps.
 
Duboman: thanks, but I need to accomplish this manually.

Likelybikey: I like your approach. Very practical. My last resort was going to be having a computer run the calculation with integers from 1 to 120 to find the closest value. This would solve the problem of the asymptotic graph and the values for T never converging.

What does intractable mean? Is this just one of those problems that requires another mathematical work around that is way more trouble than it's worth?
 
Intractable, mmm, basically it just can't be solved algebraically. Like a Rubik's Cube that somebody scrambled up and then glued together. I'm sure in your struggles with the math you got as far as having ln[1-e^(-0.04T)] as part of your equation. I feel pretty safe in asserting here that there's no way to "free" the T from that jumble. So I think that it's not even a matter of needing a difficult mathematical workaround; I don't think it can be done. But hopefully you can get meaningful values for T by somewhat waving a wand over the [(1-e^(-0.04T))/4.15] bit.

Glad to help!
 
You're exactly right, my friend. The 1-e^-.04t bit was killing me.

Could I approximate that with some kind of Taylor/power series from 1 to 90? This has nothing really to do with functionality at this point... just for interest.
 
Yeah, I think that should work. I set up e^(-0.04T) as a Maclaurin Series and got a pretty good approximation of the [1-e^(-0.04T)] term.

Since e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ...
(see Wikipedia)

it follows that

e^(-0.04T) is approximately 1 - .04T + 0.016T^2/2 - ...

so

[1-e^(-0.04T)] is approximately .04*T - .0016*T^2/2 + .000064*T^3/6 - .00000256*T^4/24 + .0000001024*T^5/120 - .000000004096*T^6/720 + .00000000016384*T^7/5040

If you carry out the series to the above T^7 term, you get very good approximations for ln[1-e^(-0.04T)] from T = 0 to 60 (error of no more than 0.07--the Maclaurin Series has greater values than the actual function in question). The two graphs start to diverge after about T = 60, and at T = 90, using the Maclaurin Series approximation, the value of ln[Maclaurin Series] is about 0.4 greater than ln[1-e^(-0.04T)]. You will get a better approximation if you carry out the Maclaurin Series further, but I'm not sure how many terms you'd have to take it to have acceptable values throughout the T = 0 to 90 range. There may be other (polynomial, etc) approximations out there as well, but we've about maxed out my knowledge.

The attached graphs show (1) y = 1-e^(-0.04T) and the Maclaurin Series approximation, (2) y = ln[1-e^(-0.04T)] and the natural logarithm of the Maclaurin Series approximation, and (3) y = ln[1-e^(-0.04T)] - ln[Maclaurin Series] (basically a graph of the error).

Thanks for making me use my math again!

1.JPG


2.JPG


3.JPG
 
Dude... What is your background?! This is fantastic stuff. I really didn't think I'd actually have much luck with this question on HBT. I'm delighted to know you'd actually take the time to thoroughly answer my question. I commend your skill.

I will play around with this a bit longer and I'll be sure to post what I find. I'm fairly certain your Maclarin series will be more than sufficient. I rarely do boils longer than 60 minutes and hardly ever bittering additions at 90 mins. At this point I'm just carrying on for the love of problem solving.
 
Wolfram Alpha / Mathematica may be able to suggest an alternate arrangement that makes T more accessible.
 
Hey, many thanks for the compliment. I had fun with it. As for my background, I was a math teacher a long time ago, and I definitely miss playing with numbers for a living. I will say that I was largely drawn to the problem by your enthusiasm for the challenge. It's always nice to encounter a kindred spirit.

ShootsNRoots is correct that the Wolfram products can solve equations, and they might have some fancy built-in magic that can solve yours. My ancient edition of Mathematica--version 4--can't do it. It looked like Wolfram Alpha was trying to solve for T, but the amount of processing time it was taking required that I use Wolfram Alpha Pro. They did offer a free trial. And I see that you can also download Mathematica 9 for free for 30 days. A decade later and Mathematica 4 is still pretty cool; I bet Mathematica 9 is super-awesome. I'd wager that if the Wolfram software can solve for T that the result will look a lot more intimidating/messy than the original equation. But if a computer is going to be crunching the numbers in the end, it can't hurt to give it a try.

Cheers!
 
Back
Top