{VERSION 3 0 "IBM INTEL NT" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "2 D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 }{CSTYLE "Help Heading" -1 26 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 } {PSTYLE "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Error" 7 8 1 {CSTYLE "" -1 -1 "" 0 1 255 0 255 1 0 0 0 0 0 0 0 0 0 } 0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {SECT 0 {PARA 0 "" 0 "" {TEXT 26 6 "Error:" }{TEXT -1 30 " to o many levels of recursion" }}{PARA 0 "" 0 "" {TEXT -1 515 "It often h appens in Maple that one procedure will call a second procedure, which in turn calls a third, and so on. Each time a procedure calls anothe r, some information must be stored in an area of memory called the sta ck. This is removed when the called procedure returns. The stack has only a finite capacity, and when it is full this error message occurs . The size of the stack may vary depending on the platform, available memory in the computer, and whether or not you are using a student ed ition of Maple." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 101 "In many cases when the error message occurs, it is the r esult of an infinite recursion. For example:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "f:= n -> f(n-1) + n:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 5 "f(2);" }}{PARA 8 "" 1 "" {TEXT -1 42 "Error, (in f) \+ too many levels of recursion" }}}{PARA 0 "" 0 "" {TEXT -1 38 "What hap pens here is that to evaluate " }{MPLTEXT 0 21 4 "f(2)" }{TEXT -1 9 " \+ we need " }{XPPEDIT 18 0 "f(1)" "6#-%\"fG6#\"\"\"" }{TEXT -1 31 ", and to evaluate that we need " }{XPPEDIT 18 0 "f(0)" "6#-%\"fG6#\"\"!" } {TEXT -1 221 ", and so on forever. No matter how much stack space we \+ have, it will all fill up and result in an error message. A cure for \+ this problem, if we will only want to evaluate the function on positiv e integers, is to assign " }{MPLTEXT 0 21 4 "f(0)" }{TEXT -1 46 ". Th en the chain of evaluations, starting at " }{MPLTEXT 0 21 4 "f(n)" } {TEXT -1 26 " for any positive integer " }{MPLTEXT 0 21 1 "n" }{TEXT -1 15 ", will stop at " }{XPPEDIT 18 0 "f(0)" "6#-%\"fG6#\"\"!" } {TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "f(0):= 0:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "f(10);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"#b" }}}{PARA 0 "" 0 "" {TEXT -1 19 "However, if we tr y " }{MPLTEXT 0 21 4 "f(n)" }{TEXT -1 26 " for a sufficiently large " }{MPLTEXT 0 21 1 "n" }{TEXT -1 32 " we can still fill up the stack." } }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "f(1000);" }}{PARA 8 "" 1 "" {TEXT -1 42 "Error, (in f) too many levels of recursion" }}}{PARA 0 " " 0 "" {TEXT -1 78 "Another way this error message occurs is as a resu lt of a circular definition." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "q:= 1 + q;" }}{PARA 7 "" 1 "" {TEXT -1 37 "Warning, recursive defi nition of name" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"qG,&\"\"\"F&F$F& " }}}{PARA 0 "" 0 "" {TEXT -1 16 "If the variable " }{MPLTEXT 0 21 1 " q" }{TEXT -1 129 " had a value assigned to it, this statement would be perfectly fine: it would simply increase that value by 1. But in thi s case " }{MPLTEXT 0 21 1 "q" }{TEXT -1 96 " did not have a value, and we have a circular definition: in effect we are attempting to define \+ " }{MPLTEXT 0 21 1 "q" }{TEXT -1 114 " in terms of itself. The constr uction itself produces a warning rather than an error, but if you try \+ to evaluate " }{MPLTEXT 0 21 1 "q" }{TEXT -1 57 " when it is defined t his way the result will be an error." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "q;" }}{PARA 8 "" 1 "" {TEXT -1 35 "Error, too many lev els of recursion" }}}{PARA 0 "" 0 "" {TEXT -1 29 "When Maple tries to \+ evaluate " }{MPLTEXT 0 21 1 "q" }{TEXT -1 49 ", it obtains an expressi on which itself contains " }{MPLTEXT 0 21 1 "q" }{TEXT -1 84 ", then t ries to evaluate that, and the process repeats until the stack is fill ed up." }}}{SECT 0 {PARA 3 "" 0 "" {TEXT 26 9 "See also:" }}{PARA 0 " " 0 "" {HYPERLNK 17 "procedure" 2 "procedure" "" }{TEXT -1 2 ", " } {HYPERLNK 17 "Warning: recursive definition of name" 2 "Warning:recurs ive_definition_of_name" "" }}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 22 "Map le Advisor Database" }{TEXT -1 18 " R. Israel, 1997" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "0 12 1 0" 37 }{VIEWOPTS 1 1 0 1 1 1803 }