May be this problem is trivial (RTFM...) but:

1) Suppose I run this in the REPL:

from sage.all import *
from rkkit.RKRungeKutta import * #my code
class RK4(RungeKutta):
    def __init__(self):
        title="Classical Runge-Kutta 4 explicit method"
        A=matrix(AA,[[0,0,0,0],[1/2,0,0,0],[0,1/2,0,0],[0,0,1,0]])
        B=vector(AA,[1/6,2/6,2/6,1/6])
        super().__init__(A,B,title)


then I can do:

R=RK4()
everything is ok.

2) Now, in a directory "methods" I put the same piece of code as above in a file called "RK4.py".

I add a file __init__.py in methods/, which is:

from sage.all import *
from rkkit.RKRungeKutta import *
__all__=["RK4"]

So, I have
methods/
 __init__.py
 RK4.py

Now, typing:

from methods import *
R=RK4.RK4()

I get the error message:

typeError: Illegal initializer for algebraic number

How can I avoid this?

(something like putting Integer() around the elements of the list in
matrix(AA,[[0,0,0,0],[1/2,0,0,0],[0,1/2,0,0],[0,0,1,0]])
is something I want (need) to avoid).

Yours,
Thierry

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-support/9fbe6b5b-1bd1-4bf2-bc66-ee0ff7343826%40math.univ-lyon1.fr.

Reply via email to