# 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

## closed as off-topic by LLlAMnYP, Cassini, bbgodfrey, MarcoB, István ZacharJul 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.

• 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

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

• 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
• @JackLaVigne 13 minutes ago :) – LLlAMnYP Jul 21 '16 at 14:36