Payment is a per DAY thing. You have 49 soldiers because you pay 0 upkeep on them, but the moment you have 50, upkeep goes up to 1 gold.(this price stays constant until 61 or so soldiers).
If you know the forumla, it shouldn't be hard to just plug numbers in. In fact, you can barely call that math. It's more like elementary arithmetic.
ceil((pow($troops, 1.03) * 1.8 - 100)/24)
Formula is pretty simple. $troops is the amount of troops, raised the the 1.03 power. Multiplied by 1.8 subtract 100. That gives per day cost. Divide by the 24 indicated for the per hour cost. the ceil just means you round up to nearest whole number.