Recursive functions and Advanced Graphing
|
09-11-2018, 12:34 PM
Post: #1
|
|||
|
|||
Recursive functions and Advanced Graphing
I’m intrigued by the ability of the Prime to handle recursion in simple function definitions.. but also its limitations.
Note - I’m just using the Lite app at present, so have no access to programming. Ay first sight, it appears that the Define function does not allow you to reference the function being defined. If I try to define fact(X)=when(X<=2,X,X*fact(X-1)), it gives a syntax error. However, I discovered that if you first define fact as a non-recursive function, e.g. X*(X-1), and exit the Define screen, the calculator ‘learns’ that “fact” is a function; you can then go back in and edit the function to make the recursive call to itself. Sure enough, fact(5) gives 120. (The calculator does struggle after roughly 35 iterations, presumably as the stack overflows, but that’s to be expected.) Next, I plot fact(X)in the Graphing app. It’s a tad slower than plotting a ‘normal’ function, but very impressive! I now go into Advanced Graphing, and try Z1: Y=fact(X)... and sadly get an ‘Invalid object’ error. Does anyone know why this fails, and if there’s a way around it? (Motivation: what I really want to do is define mandelbrot(N, Z, C)= when(N<2, |Z|<2, mandelbrot(N-1, Z^2+C),C), and plot mandelbrot(20, 0, X+Yi)=1 ! :-) ) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Recursive functions and Advanced Graphing - Sven44 - 09-11-2018 12:34 PM
RE: Recursive functions and Advanced Graphing - ijabbott - 09-11-2018, 04:44 PM
RE: Recursive functions and Advanced Graphing - Sven44 - 09-11-2018, 04:53 PM
RE: Recursive functions and Advanced Graphing - danielmewes - 09-12-2018, 04:30 AM
RE: Recursive functions and Advanced Graphing - cyrille de brébisson - 09-12-2018, 05:25 AM
RE: Recursive functions and Advanced Graphing - CyberAngel - 09-12-2018, 07:14 PM
RE: Recursive functions and Advanced Graphing - Sven44 - 09-12-2018, 09:21 AM
RE: Recursive functions and Advanced Graphing - cyrille de brébisson - 09-13-2018, 06:17 AM
RE: Recursive functions and Advanced Graphing - CyberAngel - 09-13-2018, 10:11 AM
RE: Recursive functions and Advanced Graphing - cyrille de brébisson - 09-14-2018, 05:31 AM
RE: Recursive functions and Advanced Graphing - Stevetuc - 09-14-2018, 08:44 AM
|
User(s) browsing this thread: 2 Guest(s)