Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

My question is how to pre-compile the rules1, rules2 and result parts of the following Module code without hard-coding the many (and changing number of) variables and rather complicated equations:

    fn[pars_]:=Module[{rules1,rules2,rules3,result},
    rules1=[externalvars1->pars];
    rules2=Join[rules1, externalrules/.rules1];
    rules3=Join[rules2, externalfunction[externalvars2/.rules2]];
    result=externalvars3/.rules3]

Thanks. (PS I have studied Mathematica's Compile tutorial and Rob Knapp's 2011 Presentation)

share|improve this question
    
You will need to supply all relevant definitions, including the rules. At the moment, your question is unclear. –  Yves Klett Jul 9 at 6:27
    
Dispatch[rules] might be what you are looking for. –  Stephen Luttrell Jul 9 at 10:28
    
Thanks Yves and Stephen, I will investigate further –  stuartn Jul 11 at 3:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.