Ask Your Question

Sergey's profile - activity

2013-03-18 14:19:31 +0200 received badge  Supporter (source)
2013-03-18 14:18:46 +0200 answered a question truncated output problem

I am getting the same problem

2013-02-12 17:09:32 +0200 received badge  Editor (source)
2013-02-12 17:07:08 +0200 answered a question Cannot make inline Fortran compiler (f2py) work

Hello again! I've found the answer to my question: the problem was due to different versions of numpy in my system and in sage package! It's a shame that Sage's version is so old! I had to update the numpy in Sage to version 1.7 This is done by installing numpy to ...sage-5.6/local folder (see the numpy building manual)

2013-02-12 11:25:39 +0200 asked a question Cannot make inline Fortran compiler (f2py) work

Hello!
I am trying to make the inline Fortran compiler work. It gave some long errors in Sage 5.5. Now I try in Sage 5.6 (Ubuntu 11.10 64 bit): The evaluation of %fortran cell returns None , but no symbols seem to be defined.

I tried the simple Fibonacci example from the documentation and it did not work as it should. The ordinary command-line compilation with f2py works ok!

Please, could anyone try to help me.

%fortran
C FILE: FIB3.F
      SUBROUTINE FIB(A,N)
C
C     CALCULATE FIRST N FIBONACCI NUMBERS
C
      INTEGER N
      REAL*8 A(N)
Cf2py intent(in) n
Cf2py intent(out) a
Cf2py depend(n) a
      DO I=1,N
         IF (I.EQ.1) THEN
            A(I) = 0.0D0
         ELSEIF (I.EQ.2) THEN
            A(I) = 1.0D0
         ELSE
            A(I) = A(I-1) + A(I-2)
         ENDIF
      ENDDO
      END
C END FILE FIB3.F

None

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_41.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZmliKDUp"),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/tmp/tmpBVbhBE/___code___.py", line 3, in <module> exec compile(u'fib(_sage_const_5 ) File "", line 1, in <module>

NameError: name 'fib' is not defined

Best wishes, Sergey