performance - Optimization of algebraic computation -
using mathematica, can compute mathematical representation of function want code in c++.
say like:
f=log[2*x+3*y]+sin[4*x+6*y]
it makes sense in case computation:
temp=2*x+3*y f=log[temp]+sin[2*temp]
is there way expression reduce execution time / number of operations / size of expression or metric given more complex mathematical expression?
although doesn't work simple example, can try following in mathematica
experimental`optimizeexpression[{log[(2*x^3 + 3*y)^2] + sin[2 (2*x^3 + 6*y)^2]}]
as result get
experimental`optimizedexpression[ block[{compile`$3, compile`$4}, compile`$3 = x^3; compile`$4 = 2 compile`$3; {log[(compile`$4 + 3 y)^2] + sin[2 (compile`$4 + 6 y)^2]}]]
Comments
Post a Comment