Ask Your Question

canisvetus's profile - activity

2021-11-13 17:28:00 +0200 received badge  Famous Question (source)
2020-12-08 12:48:48 +0200 received badge  Popular Question (source)
2017-10-25 17:15:54 +0200 received badge  Famous Question (source)
2017-10-25 17:15:54 +0200 received badge  Notable Question (source)
2017-09-17 06:11:42 +0200 received badge  Popular Question (source)
2017-09-17 06:11:42 +0200 received badge  Notable Question (source)
2016-10-19 23:06:40 +0200 received badge  Notable Question (source)
2014-06-29 20:42:08 +0200 received badge  Famous Question (source)
2014-06-29 20:42:08 +0200 received badge  Popular Question (source)
2014-06-29 20:42:08 +0200 received badge  Notable Question (source)
2014-06-29 20:40:11 +0200 received badge  Famous Question (source)
2014-06-29 20:40:11 +0200 received badge  Notable Question (source)
2014-06-29 11:58:19 +0200 received badge  Famous Question (source)
2014-06-29 11:58:19 +0200 received badge  Notable Question (source)
2014-06-29 11:58:19 +0200 received badge  Popular Question (source)
2014-06-14 00:16:27 +0200 received badge  Famous Question (source)
2014-02-18 05:16:19 +0200 asked a question random selection

How I do randomly select a element in GO(n,RR)?

2013-11-20 08:50:41 +0200 received badge  Popular Question (source)
2013-06-26 11:35:59 +0200 received badge  Popular Question (source)
2013-04-22 08:01:01 +0200 received badge  Notable Question (source)
2013-04-02 01:50:19 +0200 received badge  Popular Question (source)
2012-11-28 17:52:14 +0200 received badge  Popular Question (source)
2012-05-24 17:29:39 +0200 received badge  Student (source)
2012-03-25 06:17:05 +0200 commented question why cannot recalculate (2)?

In these form I can recalculate without problems

2012-03-25 06:15:58 +0200 asked a question why cannot recalculate (2)?
html("<h1> From Dictionary to Matrix (2)</h1>")
@interact
def newtarph( D=input_box(default={0: {1: 2, 2: 3}, 1: {0: 3, 2: 4}, 2: {3: 2, 4: 1}, 3: {0: 2, 1: 3, 4: 1}}, label='Dictionary')):
    G = DiGraph(D)
    W= G.weighted_adjacency_matrix()
    n=G.num_verts()
    C=[(i,j) for (i,j) in CartesianProduct(range(n),range(n)) if (W[i][j]<>0)]
    E0=matrix(C)
    V=vector([W[i][j] for (i,j) in C])
    E=column_matrix([E0.column(0),E0.column(1),V])
    print E
2012-03-25 06:06:31 +0200 received badge  Commentator
2012-03-25 06:06:31 +0200 commented question why cannot recalculate?

Hello Jason Grout, Really dont work. The error message is include in the two previus commentaries. for obtain these error I take the dictionary D={0: {1: 2, 2: 3}, 1: {0: 3, 2: 4}, 2: {3: 2, 4: 1}, 3: {0: 2, 1: 3, 4: 1}} and suprime in a second step 0: {1: 2, 2: 3}. Thank you for your help.

2012-03-25 06:00:19 +0200 commented question why cannot recalculate?

AyOiA0fSwgMjogezM6IDIsIDQ6I\ DF9LCAzOiB7MDogMiwgMTogMywgNDogMX19'), globals()); _interact_.recompute('40');" + '\n', '', 'single') File "", line 1, in <module> File "/home/sage/sage/devel/sagenb/sagenb/notebook/interact.py", line 3770, in recompute S['function']() File "/home/sage/sage/devel/sagenb/sagenb/notebook/interact.py", line 2572, in _ z = f(*[variables[arg] for arg in args]) File "/tmp/tmpiy2_h0/___code___.py", line 8, in newtarph for i in range(len(D.values()[u])): IndexError: list index out of range

2012-03-25 05:59:12 +0200 commented question why cannot recalculate?

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_20.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("X2ludGVyYWN0Xy51cGRh\ dGUoJzQwJywgJ0QnLCA0LCBfaW50ZXJhY3RfLnN0YW5kYXJkX2I2NGRlY29kZSgnZXpFNklI\ c3dPaUF6TENBeU9pQTBmU3dnTWpvZ2V6TTZJRElzSURRNklERjlMQ0F6T2lCN01Eb2dNaXdn\ TVRvZ015d2dORG9nTVgxOScpLCBnbG9iYWxzKCkpOyBfaW50ZXJhY3RfLnJlY29tcHV0ZSgn\ NDAnKTs="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpx7r7GI/___code___.py", line 3, in <module> exec compile(u"_interact_.update('40', 'D', _sage_const_4 , _interact_.standard_b64decode('ezE6IHswOiAzLC

2012-03-25 05:08:01 +0200 commented question why cannot recalculate?

Excuse me Shashank and Jason Grout. Perhaps I make a mistake writen the dictionary. Now work also for me. Eusebio Corbacho.

2012-03-24 15:53:58 +0200 commented question why cannot recalculate?

Yes, seems to work, but if you modifie the dictionary, you can obtein an error

2012-03-24 08:21:07 +0200 asked a question why cannot recalculate?

These code work fine

html("<h1> From Dictionary to Matrix (1)</h1>")
    @interact
    def newtarph( D=input_box(default={0:{1:3}, 1: {0: 2, 4: 2, 5: 2}, 2: {0: 3, 1: 4}}, label='Dictionary')):
        E=[]
        for u in D.keys():
            for i in range(len(D.values()[u])):        
              E.append([u, D.values()[u].keys()[i], D.values()[u].values()[i]])
        print matrix(E)

These other code d'ont work:

html("<h1> From Dictionary to Matrix (1)</h1>")
    @interact
    def newtarph( D=input_box(default={1: {0: 2, 4: 2, 5: 2}, 2: {0: 3, 1: 4}}, label='Dictionary')):
        E=[]
        for u in D.keys():
            for i in range(len(D.values()[u])):        
              E.append([u, D.values()[u].keys()[i], D.values()[u].values()[i]])
        print matrix(E)
2012-03-22 12:51:48 +0200 commented answer how to construct a dictionary of dictionaries from a list

Thank you very much. Sincerely Eusebio Corbacho

2012-03-22 06:18:44 +0200 commented question how to construct a dictionary of dictionaries from a list

The matrix as a list of rows

2012-03-22 06:16:14 +0200 asked a question how to construct a dictionary of dictionaries from a list

Given the matrix [0,1,2] [1,0,3] [1,2,4] [0,2,3] [2,4,1] [2,3,2] how to obtain the dictionary D={0:{1:2,2:3},1:{0:3,2:4},2:{3:2,4:1}} ?

2012-03-16 05:54:24 +0200 commented question how to obtain the real part of a complex function

how to obtain the real part of u0=b*vector([Xh0[3],Xh0[4],Xh0[5]])

2012-03-16 05:53:02 +0200 asked a question how to obtain the real part of a complex function

html("

Trajectory of a particle in a viscose medium under a linear oscilator

") html("

in two cases:

") html("

1) with an external force that annulates the viscosity

") html("

2) with a given external force

") var('t s yes no') @interact def newtraph(m = input_box(default=1, label='mass'), b = input_box(default=0.3, label='air viscosity'), T = input_box(default=20, label='total time'), K = input_box(default=[1,1,1], label='eigenvalues'), V = input_box(default=yes, label='antiviscose force: yes or no'), F = input_box(default=[0,0,0], label='another external force'), CI= input_box(default=[1,1,1,1,1,-2], label='CI')):

             RDF
             assume(t>0)
             N=matrix(3)
             U=identity_matrix(3)
             K=diagonal_matrix([K[0],K[1],K[2]])
             A=block_matrix([[N,U],[-K/m, -b*U/m]])
             CI=vector(CI)
             S=exp(A*t)
             Xh=S*CI
             Ss=S(t=t-s)               
             if V==yes:
                 A0=block_matrix([[N,U],[-K/m, N]])
                 S0=exp(A0*t)
                 Xh0=S0*CI
                 u0=b*vector([Xh0[3],Xh0[4],Xh0[5]])
                 FA=parametric_plot3d((lambda t: real(u0[0](t=t).n()), lambda t: real(u0[1](t=t).n()), lambda t: real(u0[2](t=t).n())), (t,0,T),rgbcolor=(0,1,0),thickness=0.3,plot_points=[20*T])
                 C=parametric_plot3d((lambda t: real(Xh0[0](t=t).n()), lambda t: real(Xh0[1](t=t).n()), lambda t: real(Xh0[2](t=t).n())), (t,0,T),rgbcolor=(1,0,0),thickness=0.5,plot_points=[20*T])
                 show(FA+C)
             else: 
                 u=t^0*vector([0,0,0,F[0],F[1],F[2]])/m
                 u=u(t=s)
                 B=Ss*u
                 XP=integral(B,s,0,t)
                 X=Xh+XP
                 FC=parametric_plot3d((F[0],F[1],F[2]), (t,0,T),rgbcolor=(0,1,0),thickness=0.3,plot_points=[20*T])

                 C=parametric_plot3d((lambda t: real(X[0](t=t).n()), lambda t: real(X[1](t=t).n()), lambda t: real(X[2](t=t).n())), (t,0,T),rgbcolor=(1,0,0),thickness=0.5,plot_points=[20*T])
                 show(FC+C)
2012-03-13 13:08:53 +0200 received badge  Supporter (source)
2012-03-09 13:51:38 +0200 received badge  Editor (source)
2012-03-09 10:42:54 +0200 commented question exponential matrix exp(A*t)

The program not calculates a good answer for exp(A*t)

2012-03-09 09:51:35 +0200 asked a question exponential matrix exp(A*t)
html("<h1>Partícula bajo oscilador lineal</h1>")
var('t s')
@interact
def newtraph(m = input_box(default=1, label='masa'),
             b = input_box(default=1, label='viscosidad aire'),
             T = input_box(default=10, label='tiempo total'),
             k1 =input_box(default=1, label='primer autovalor'),
             k2 =input_box(default=1, label='segundo autovalor'),
             k3 =input_box(default=1, label='tercer autovalor'),
             Fx =input_box(default=0, label='Impulso unitario x'),
             Fy =input_box(default=0, label='Impulso unitario y'),
             Fz =input_box(default=0, label='Impulso unitario z'),
             CI= input_box(default=[1,1,0,1,1,-2], label='CI')):

                 N=matrix(3)
                 U=identity_matrix(3)
                 K=diagonal_matrix([k1,k2,k3])
                 A=block_matrix([[N,U],[-K/m, -b*U/m]])
                 S=exp(A*t)
                 Ss=exp(A*(t-s))
                 u=vector([0,0,0,Fx,Fy,Fz])
                 B=Ss*u
                 CI=vector(CI)
                 Xh=S*CI
                 XP=integral(B,s,0,t)
                 X=Xh+XP
                 parametric_plot3d((X[0],X[1],X[2]),(t,0,T))
2012-03-08 09:51:07 +0200 asked a question exponential matrix exp(A)

What is the maximum size of a square matrix A to calculate exp(A)

2012-01-17 11:48:54 +0200 commented question How introduce inputs in a @interact sage program

exactly, for introduce a concrete graph I need know the number of vertices, the number of arcs and use these inputs for introduce other inputs of second level

2012-01-17 10:52:51 +0200 asked a question How introduce inputs in a @interact sage program

Concretely, how tranlate the following MATLAB program to SAGE:

n=input('number of vertices n= ');
m=input('number of edges m= ');
disp('write weighted edges as [v1 v2 w12]');
for i=1:m
    E(i,:)=input(['arco ',num2str(i), '= ']);
end
disp(E)