Consider the code below:
variable = Sin[x];
fun = Compile[{x}, variable ];
fun[1]
When I do this I get the error:
CompiledFunction::cfse: Compiled expression Sin[x] should be a machine-size real number
CompiledFunction::cfex: Could not complete external evaluation at instruction 1; proceeding with uncompiled evaluation. >>
However, if I use:
fun = Compile[{x}, Sin[x]];
Everything is fine. I need to compile as I presented first, the one which gives error because in my case variable
is a huge very big expression. How can I achieve this goal?