2

It is entirely possible that there is no solution to this problem, but here goes...

I have a number of equation of states for fluids that have terms that are of the form

${\phi _r} = \sum\limits_i^N {{a_i}{\tau ^{{t_i}}}{\delta ^{{d_i}}}}$

but the evaluation of these terms takes too much computational effort. For instance, N might be 20 or so. So for one evaluation of $\phi_r$ we need at least forty power evaluations which is computationally very expensive. For reference, evaluation of $\phi_r$ takes about 1 $\mu$s, which for my purposes is just not fast enough.

So my first idea was to break up $\phi_r$ using ${\phi _r} = \sum\limits_i^N {{a_i}\exp \left( {\ln \left( {{\tau ^{{t_i}}}{\delta ^{{d_i}}}} \right)} \right) = } \sum\limits_i^N {{a_i}\exp \left( {{t_i}\ln \tau + {d_i}\ln \delta } \right)}$

And then I calculate $\ln \tau$ and $\ln \delta$ once and then just re-use the values. But I still have to do one evaluation of exp() per term in the sum. The exponential function takes about as much computational effort as a power evaluation, so we get about a factor 2 speedup.

What I am wondering is if there is some magical way to using logarithmic identities in order to decompose the sum into a form where we only have terms of $\ln \tau$ and $\ln \delta$ and perhaps one ln() call as well.

I was playing with the logarithmic identities on wikipedia (http://en.wikipedia.org/wiki/List_of_logarithmic_identities), but I couldn't see a way that I could get away from at least one power or exponential evaluation per term

azimut
  • 22,696
ibell
  • 151
  • What kind of numbers are the $t_i$ and $d_i$? Integers? Horner's Method speeds up evaluation of one-variable polynomials, I'm sure it can be adapted for two variables. – Gerry Myerson Mar 12 '13 at 11:57
  • Nope, both $t_i$ and $d_i$ are in the general case floating point values which is why this is so messy. – ibell Mar 12 '13 at 12:42

0 Answers0