Quantcast
Channel: ASKSAGE: Sage Q&A Forum - RSS feed
Browsing all 5 articles
Browse latest View live

Comment by petropolis for I think the confusion here involves the fact that...

Thank you! First time that I hear about Sage-level functions versus Python functions.

View Article



Answer by DSM for Consider the following function:def f(n) : def retfunc(x) :...

I think the confusion here involves the fact that your examples use f(1) as an expression, but Python functions and the values those functions take are two different things. There are several ways to...

View Article

Comment by petropolis for Your error is not due to recursion. The following...

Thank you Laurent for your help. "The following code does not produce the error." Unfortunately the code also does not produce what I need :) "I don't really understand what you are trying to do."...

View Article

Answer by Laurent Claessens for Consider the following function:def f(n) :...

Your error is not due to recursion. The following example (slightly simplified with respect to yours) produces the same error : def f(n) : def retfunc(x) : if n==0: return 1 return x*f(3) return...

View Article

Type error in recursion

Consider the following function: def f(n) : def retfunc(x) : return 1 if n == 0 else x*add(f(n-k) for k in (1..n)) return retfunc The test w = f(9); print w, type(w) gives "function retfunc at...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images