I have defined the following function:

cpdz[c0_, m_,s_, r_, t_, n_] := 
If[c0 > 0, c0*(m*c0\s - (m - 1)*Exp[r*t/n]), 

for s I have a set of lists like {{0,1,2,3,4},{5,4,7,8,9}}. Now I want to apply this function to FoldList like this:

CushionListe = 
Map[FoldList[cpdz[#1, 2, #2, 0.01, 2, 720] &, 
1569.3 , SetofLists] /@ 

my problem is now Mathematica doesn´t evaluate the If function. How can i apply the If function to my FoldList with my set of lists for s? Sry it must be something in the defintion of the Map or FoldList but i doen´t know what is wrong. My set of lists must stay like this because I need an output that is again a set of lists.

Hope someone can help. Thank you


closed as off-topic by LLlAMnYP, Cassini, bbgodfrey, MarcoB, István Zachar Jul 22 '16 at 9:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – LLlAMnYP, Cassini, bbgodfrey, MarcoB, István Zachar
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What does m*\s mean (inside of the If statement)? $\endgroup$ – QuantumDot Jul 21 '16 at 12:38
  • 2
    $\begingroup$ You are asking Mathematica to calculate whether a list is greater than 0, this is a meaningless expression. $\endgroup$ – Feyre Jul 21 '16 at 12:40
  • $\begingroup$ Also, the way you use it, the comparison (*List*) > 0 doesn't mean anything. It has to be a List on both sides. $\endgroup$ – QuantumDot Jul 21 '16 at 12:40
  • $\begingroup$ Also, is the C0 in the third line really supposed to be capitalized? $\endgroup$ – QuantumDot Jul 21 '16 at 12:43
  • $\begingroup$ I edited it sry mistake. @QuantumDot yes i want to know how can I edit the If function so that mathematica use every single number of the List from my FoldList expression $\endgroup$ – user41673 Jul 21 '16 at 12:55

The issue was due to a simple, but unobvious syntax mistake.

The intended behavior is given by

FoldList[cpdz[#1, 2, #2, 0.01, 2, 720] &, 1569.3 , #] & /@ SetofLists
  • $\begingroup$ I think you need another & between the FoldList and /@. FoldList[cpdz[#1, 2, #2, 0.01, 2, 720] &, 1569.3 , #]& /@ SetofLists $\endgroup$ – Jack LaVigne Jul 21 '16 at 14:34
  • $\begingroup$ @JackLaVigne 13 minutes ago :) $\endgroup$ – LLlAMnYP Jul 21 '16 at 14:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.