> local a = ((2.51/R)*x + k/(3.72*d)) > return -2*math.log(a) > end
This can be simplified further, to z = A - 2 log (z + B), to be solved for z.
There is actually a closed form solution using the Lambert W function [1], but I am afraid computing the value of the function is equivalent to solving the equation numerically.