Thursday, September 24, 2009

When E is not... E?

I was working on a family here at the company, and it turned out we need to use a formula that involved using a Log function (you remember Calculus right? Cause I don't.....). In excel the Natural Log (that is the log taken of e, your handy dandy mathematical constant) is notated with the function ln(). Which is fine and dandy. If you look in Revit help under valid syntax, is conveniently says that the "log" can be taken of any number, what they fail to mention is the base the Revit log function operates in, which is 10, not e (bummer :( )

But....! If you do enough research (or remember enough Calculus) you find out that Logs in base 10, can be converted to Logs in another base, by some simple alegabra. (hooray!) Even better, Revit help clearly states that the function exp() will raise e to the specified power, so therefore we could write:

= log()/log(exp(1))

and we would get the result we need, since a number raised to the power of 1, will simply be the original number. This is good, because theoretically this means that Revit (and or your computer) will use e calculated to the most accurate value the program (Revit) will accept (you're still with me, right?).

Yet, for some reason, Revit's result did not agree with Excel . With a little more help from some friends (read the whole AUGI thread here) it was discovered that the function exp() resulted not in raising e to the specified power, but 10!!! So, exp(1) = 10 in Revit, contradicting Revit's own help documenation!

Now I ask, why would we ever need a function that raises 10 to a power? I can always write: 10^2, 10^2..... I can even use parameters for both values if I need to, 10 is a number, not too hard to deal with. I would much rather have access to e particularly since I need it!

For now, we're using a truncated value for e in our formula, and its close enough, but I would say, with relative certainty that somewhere (quite a long time ago) someone made a mistake...

Not that too many people are running around using Logs and e in their Revit formulas, but with the advent of the new massing tools, it could become a possibilty. Besides, its the principal of the matter, right, we should have access to our standard mathematical functions, and the documentation should be correct!

1 comment:

alleycatbabe said...

http://www.youtube.com/watch?v=SXx2VVSWDMo

You just need "new math"