Do you mean something like:
#fibonacci
def fib(n):
if n==0 or n==1:
return 1
return fib(n-1)+fib(n-2)
#output sequence
for i in range(10):
print fib(i)
#output series
sum=0
for i in range(10):
sum+=fib(i)
print sum
HTH,
A. Jorge Garcia
Applied Math and CompSci
http://shadowfaxrant.blogspot.com
http://www.youtube.com/calcpage2009
-----Original Message-----
From: kcrisman <[email protected]>
To: sage-support <[email protected]>
Sent: Wed, Mar 30, 2011 4:12 pm
Subject: [sage-support] Re: Sequences and Series
On Mar 30, 2:58 pm, ObsessiveMathsFreak
<[email protected]> wrote:
I'm just wondering if there is a canonical (i.e. convienient(i.e.
lazy)) way to define simple sequences and series in sage. In
particular, is there a standard way to define recursive series?
Suppose for example that You wanted to define the series a_n=1/n^2. Is
there a way to do this without writing a for loop?
And moreover, suppose you wanted to define the recursive sequences
a_n=(n^2+2)a_{n-1}. Is there a way to do this automatically?
I think Maxima can do recurrences.
http://maxima.sourceforge.net/docs/manual/en/maxima_76.html
But this hasn't been added to Sage yet, in the sense of wrapping the
functionality nicely.
http://trac.sagemath.org/sage_trac/ticket/1291
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org