Student Support Forum: 'b=a+1, c=b+1, d=c+1... x=?' topicStudent Support Forum > General > "b=a+1, c=b+1, d=c+1... x=?"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response jf 01/01/13 3:55pm In[2]:= y[0] = 4; y[n_Integer?Positive] := y[n - 1] + 1; In[4]:= y[4] Out[4]= 8 You could probably get away with y[n_] := y[n - 1] + 1; for the recursive definition, but the extra will prevent an infinite recursion in case an invalid argument is given. http://reference.wolfram.com/mathematica/tutorial/PuttingConstraintsOnPatterns.html URL: http://reference.wolfram.com/mathematica/tutorial/MakingDefinitionsForFunctions.html,

 Subject (listing for 'b=a+1, c=b+1, d=c+1... x=?') Author Date Posted b=a+1, c=b+1, d=c+1... x=? Humperdinck ... 12/31/12 10:03pm Re: b=a+1, c=b+1, d=c+1... x=? Steve Keeley 01/01/13 3:47pm Re: b=a+1, c=b+1, d=c+1... x=? jf 01/01/13 3:55pm Re: b=a+1, c=b+1, d=c+1... x=? Bill Simpson 01/01/13 6:58pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic