Here is a complete code which works the same as original code, 
independently:

L=2;
var('s','t','T')
DH=[2,0,0,2]
HS={(0,1):(-1/2)*(1-s), (0,2):(-1/2)*(1-s), (1,0):(-1/2)*(1-s), 
(1,3):(-1/2)*(1-s), (2,1):(-1/2)*(1-s), (2,4):(-1/2)*(1-s), 
(3,1):(-1/2)*(1-s), (3,2):(-1/2)*(1-s)};
HS1={(i,i): DH[i]*s+(L/2)*(1-s) for i in range(2^L)};
HS.update(HS1)

A=matrix(HS);
print A.str();

T=1;

f=A(s=t/T)
#f=A(s=0)

reset('i');
reset('x');

def Sch(t,y):
    return [ -i*sum(f[j,k]*y[j] for k in range(2^L)) for j in range(2^L)]   

NL1=[1 for i in range(2^L)]; 
TS=ode_solver()
TS.algorithm = "rk4"
TS.function=Sch
TS.y_0 = NL1
TS.ode_solve(t_span=[0,T], num_points=1000)
print TS.solution;

it results in:

[      s + 1 1/2*s - 1/2 1/2*s - 1/2           0           0]
[1/2*s - 1/2      -s + 1           0 1/2*s - 1/2           0]
[          0 1/2*s - 1/2      -s + 1           0 1/2*s - 1/2]
[          0 1/2*s - 1/2 1/2*s - 1/2       s + 1           0]
Traceback (click to the left of this block for traceback)
...
ValueError: error solving


but when I uncomment line 15: f=A(s=0), it results in: 

        

WARNING: Output truncated!  full_output.txt 
<http://localhost:8080/home/admin/8/cells/2/full_output.txt>


[      s + 1 1/2*s - 1/2 1/2*s - 1/2           0           0]
[1/2*s - 1/2      -s + 1           0 1/2*s - 1/2           0]
[          0 1/2*s - 1/2      -s + 1           0 1/2*s - 1/2]
[          0 1/2*s - 1/2 1/2*s - 1/2       s + 1           0]
[(0, [1, 1, 1, 1]), (0.001, [1.0, 1.0, 0.9985011244377109, 1.0]),
(0.002, [1.0, 1.0, 0.997004495503373, 1.0]), (0.003, [1.0, 1.0,
0.9955101098295707, 1.0]), (0.004, [1.0, 1.0, 0.9940179640539353, 1.0]),
(0.005, [1.0, 1.0, 0.9925280548191384, 1.0]), (0.006, [1.0, 1.0,
0.9910403787728836, 1.0]), (0.007, [1.0, 1.0, 0.9895549325678991, 1.0]),
(0.008, [1.0, 1.0, 0.9880717128619303, 1.0]), (0.009000000000000001,
[1.0, 1.0, 0.9865907163177324, 1.0]), (0.010000000000000002, [1.0, 1.0,
0.9851119396030625, 1.0]),

...
upto:

(0.9970000000000008, [1.0, 1.0, 0.22413650845457392, 1.0]),
(0.9980000000000008, [1.0, 1.0, 0.22380055571943458, 1.0]),
(0.9990000000000008, [1.0, 1.0, 0.22346510653564, 1.0]),
(1.0000000000000007, [1.0, 1.0, 0.22313016014842943, 1.0])]


full_output.txt <http://localhost:8080/home/admin/8/cells/2/full_output.txt>

Sorry if it becomes late, I need time to switch to Linux to provide the 
code exactly as is.
Thanks for your attention.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to