0
$\begingroup$

I am new to Mathematica and expecting some help.

I am trying to plot a discrete recursive function f[m, n] against m, for different values of n.

Show[Table[
  DiscretePlot[f[m, n], {m, 0, 80}, AxesOrigin -> {-1, 0},  
   PlotRange -> All], {n, 20, 100, 20}]]

I want each curve for n to be in a different color. Using PlotThemecolored them all in same color and the following gave me a recursion depth exceeded exception.

DiscretePlot[
 Evaluate[Table[f[m, n], {n, 20, 100, 20}]], {m, 0, 80}, 
 PlotTheme -> "DarkColor"]

Can someone please help? Thanks in advance.

Edit Below is the simplified version of the code.

populationRatio[m_, n_] := a polynomial of m, n and a set of constants
population[m_, n_]      := populationRatio[m, n]*population[m-1, n]
population[0, n_]       := 1/(1+Sigma(k->n)[Pi(r->k)[populationRatio[r, n]]])
$\endgroup$
  • 2
    $\begingroup$ Please post f. $\endgroup$ – David G. Stork Dec 8 '17 at 1:28
  • $\begingroup$ And your title has nothing to do with your problem. Once you plot two functions, their colors will automatically differ. $\endgroup$ – David G. Stork Dec 8 '17 at 2:46
  • $\begingroup$ @CarlWoll : It worked fine for me for non recursive functions. I posted an edit, so that you can see the nature of the function. Thank you for your time. $\endgroup$ – DNL Dec 8 '17 at 5:15
  • $\begingroup$ @DavidG.Stork : I have posted an edit. Thank you $\endgroup$ – DNL Dec 8 '17 at 5:16
  • $\begingroup$ Try to add this option: PlotStyle -> Hue[n/100]. $\endgroup$ – Alexei Boulbitch Dec 8 '17 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.