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.

I don't have experience using Mathematica for parallel calculation. I need to do something simple to parallelize the calculation of f which is calculate each time n iterates:

f[k_] := Sum[r[j], {j, k}];
SetSharedFunction[f] 

r[1] = 1;
f[1] = 2;

Table[r[n] = 2 r[n - 1] + f[n - 1], {n, 2, 4}]

Thanks for your help.

share|improve this question
    
Would something like this work for you? f[k_] := Sum[r[j], {j, k}]; r[1] = 1; f[1] = 2; r[n_] := r[n] = 2 r[n - 1] + f[n - 1]; SetSharedFunction[f, r]; ParallelTable[r[n], {n, 2, 18}] –  chris May 17 at 23:34
1  
it's a recursive formula, so it is not parallelizable, using ParallelTable, etc., won't help there either –  Wizard May 19 at 22:46
add comment

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.