Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Difficulty with sagetex

Please forgive any short comings as I am new to sage, python and sagetex, perhaps I'm trying to run before I can walk or even crawl!

I am trying to run the the sageblock below to obtain the sequence 'S' and reference individual elements of the list 'S'. It works fine in Sage but cannot get any where with sagetex.

    \begin{sagesilent}
    def nmax(max=100):
        n = 1
        an = 20
       while n <= max:
          yield an
          n += 1
          an = 0.9*an-5

          a = nmax(30)
          S=[]
          for i in a:
          S.append(i.n())
\end{sagesilent}

produces the error

** Error in Sage code on line 36 of sequences01.tex! Traceback follows. Traceback (most recent call last):
File "sequences01.sagetex.py", line 43, in <module> _st_.inline(_sage_const_3 , latex(S)) NameError: name 'S' is not defined

When I try to access 'S' with $\sage{S}$, am beginning to feel at a loss as to where to look now.