# Apply If function to FoldList [closed]

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]),
c0*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] /@
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

• What does m*\s mean (inside of the If statement)? – QuantumDot Jul 21 '16 at 12:38
• You are asking Mathematica to calculate whether a list is greater than 0, this is a meaningless expression. – Feyre Jul 21 '16 at 12:40
• Also, the way you use it, the comparison (*List*) > 0 doesn't mean anything. It has to be a List on both sides. – QuantumDot Jul 21 '16 at 12:40
• Also, is the C0 in the third line really supposed to be capitalized? – QuantumDot Jul 21 '16 at 12:43
• 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 – user41673 Jul 21 '16 at 12:55

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

• I think you need another & between the FoldList and /@. FoldList[cpdz[#1, 2, #2, 0.01, 2, 720] &, 1569.3 , #]& /@ SetofLists – Jack LaVigne Jul 21 '16 at 14:34