Ask Your Question

Revision history [back]

maxima on sagecloud

Hello, i cannot run this maxima program on sage cloud. Someone has an explanation? indentation? or sagecloud doesn't support long program? Thanks for answer. Dominique

%default_mode maxima ︡6cc15a58-c507-4e6b-a762-c36a57d2816f︡ ︠3111f7f9-ddeb-47d6-81c5-4dfab1bef208s︠ RedGauss(A,variable):=block([q,var,listeD,listeQ,i,a,l,D], quad:expand(transpose(variable).A.variable), q:quad,var:variable,listeD:[],listeQ:[],D:zeromatrix(length(A),length(A)), while var#[] do ( a:diff(q,var[1],2)/2,l:subst(0,var[1],diff(q,var[1])), if a=0 and l=0 then var:rest(var) elseif a#0 then ( listeD:append(listeD,[a]),listeQ:append(listeQ,[var[1]+l/(2a)=0]), q:subst(0,var[1],q)-l^2/(4a),var:rest(var)) else ( i:2,while subst(0,var[i],diff(l,var[i]))=0 do i:i+1, a:diff(q,var[i],2)/2, if a#0 then ( listeD:append(liste,[a]),listeQ:append(listeQ,[var[i]+l/(2a)=0]),q:subst(0,var[i],q)-l^2/(4a), var:append(rest(var,i-1-length(var)),rest(var,i))) else ( a:diff(q,var[1],1,var[i],1), l1:subst([var[1]=0,var[i]=0],diff(q,var[1])),li:subst([var[1]=0,var[i]=0],diff(q,var[i])), listeD:append(listeD,[a/4,-a/4]), listeQ:append(listeQ,[var[1]+var[i]+(l1+li)/a=0,var[1]-var[i]+(li-l1)/a=0]), q:subst([var[1]=0,var[i]=0],q)-l1*li/a, var:append(rest(rest(var,i-1-length(var))),rest(var,i))))), for k:1 thru length(listeD) do D[k,k]:listeD[k], return([D,transpose(coefmatrix(listeQ,variable))]))$

︡51a26d2e-89a4-444b-a29f-f7e6f46d4008︡{"stderr":"Error in lines 1-1\n"}︡{"stderr":"Traceback (most recent call last):\n File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 865, in execute\n exec compile(block+'\n', '', 'single') in namespace, locals\n File \"\", line 1, in <module>\n File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 900, in execute_with_code_decorators\n print code_decorator.eval(code, locals=self.namespace),\n File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 1220, in eval\n return self._eval_line_using_file(code)\n File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 724, in _eval_line_using_file\n if \"Input/output error\" in msg[0]: # This occurs on non-linux machines\nIndexError: tuple index out of range\n"}︡

click to hide/show revision 2
No.2 Revision

maxima on sagecloud

Hello, i cannot run this maxima program on sage cloud. Someone has an explanation? indentation? or sagecloud doesn't support long program? Thanks for answer. Dominique

%default_mode maxima
︡6cc15a58-c507-4e6b-a762-c36a57d2816f︡
︠3111f7f9-ddeb-47d6-81c5-4dfab1bef208s︠
RedGauss(A,variable):=block([q,var,listeD,listeQ,i,a,l,D],
                            quad:expand(transpose(variable).A.variable),
                            q:quad,var:variable,listeD:[],listeQ:[],D:zeromatrix(length(A),length(A)),
                            while var#[] do (
                            a:diff(q,var[1],2)/2,l:subst(0,var[1],diff(q,var[1])),
    if a=0 and l=0 then var:rest(var)
    elseif a#0 then (
                   listeD:append(listeD,[a]),listeQ:append(listeQ,[var[1]+l/(2a)=0]),
                   q:subst(0,var[1],q)-l^2/(4a),var:rest(var))
listeD:append(listeD,[a]),listeQ:append(listeQ,[var[1]+l/(2*a)=0]),
                   q:subst(0,var[1],q)-l^2/(4*a),var:rest(var))
    else (
        i:2,while subst(0,var[i],diff(l,var[i]))=0 do i:i+1,
        a:diff(q,var[i],2)/2,
        if a#0 then (
        listeD:append(liste,[a]),listeQ:append(listeQ,[var[i]+l/(2a)=0]),q:subst(0,var[i],q)-l^2/(4a),
listeD:append(liste,[a]),listeQ:append(listeQ,[var[i]+l/(2*a)=0]),q:subst(0,var[i],q)-l^2/(4*a),
        var:append(rest(var,i-1-length(var)),rest(var,i)))
    else (
        a:diff(q,var[1],1,var[i],1),
        l1:subst([var[1]=0,var[i]=0],diff(q,var[1])),li:subst([var[1]=0,var[i]=0],diff(q,var[i])),
        listeD:append(listeD,[a/4,-a/4]),
        listeQ:append(listeQ,[var[1]+var[i]+(l1+li)/a=0,var[1]-var[i]+(li-l1)/a=0]),
        q:subst([var[1]=0,var[i]=0],q)-l1*li/a,
        var:append(rest(rest(var,i-1-length(var))),rest(var,i))))),
    for k:1 thru length(listeD) do D[k,k]:listeD[k],
            return([D,transpose(coefmatrix(listeQ,variable))]))$

return([D,transpose(coefmatrix(listeQ,variable))]))$ ︡51a26d2e-89a4-444b-a29f-f7e6f46d4008︡{"stderr":"Error in lines 1-1\n"}︡{"stderr":"Traceback (most recent call last):\n File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 865, in execute\n exec compile(block+'\n', compile(block+'\\n', '', 'single') in namespace, locals\n File \"\", line 1, in <module>\n File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 900, in execute_with_code_decorators\n print code_decorator.eval(code, locals=self.namespace),\n File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 1220, in eval\n return self._eval_line_using_file(code)\n File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 724, in _eval_line_using_file\n if \"Input/output error\" in msg[0]: # This occurs on non-linux machines\nIndexError: tuple index out of range\n"}︡

range\n"}︡
click to hide/show revision 3
retagged

maxima on sagecloud

Hello, i cannot run this maxima program on sage cloud. Someone has an explanation? indentation? or sagecloud doesn't support long program? Thanks for answer. Dominique

%default_mode maxima
︡6cc15a58-c507-4e6b-a762-c36a57d2816f︡
︠3111f7f9-ddeb-47d6-81c5-4dfab1bef208s︠
RedGauss(A,variable):=block([q,var,listeD,listeQ,i,a,l,D],
                            quad:expand(transpose(variable).A.variable),
                            q:quad,var:variable,listeD:[],listeQ:[],D:zeromatrix(length(A),length(A)),
                            while var#[] do (
                            a:diff(q,var[1],2)/2,l:subst(0,var[1],diff(q,var[1])),
    if a=0 and l=0 then var:rest(var)
    elseif a#0 then (
                   listeD:append(listeD,[a]),listeQ:append(listeQ,[var[1]+l/(2*a)=0]),
                   q:subst(0,var[1],q)-l^2/(4*a),var:rest(var))
    else (
        i:2,while subst(0,var[i],diff(l,var[i]))=0 do i:i+1,
        a:diff(q,var[i],2)/2,
        if a#0 then (
        listeD:append(liste,[a]),listeQ:append(listeQ,[var[i]+l/(2*a)=0]),q:subst(0,var[i],q)-l^2/(4*a),
        var:append(rest(var,i-1-length(var)),rest(var,i)))
    else (
        a:diff(q,var[1],1,var[i],1),
        l1:subst([var[1]=0,var[i]=0],diff(q,var[1])),li:subst([var[1]=0,var[i]=0],diff(q,var[i])),
        listeD:append(listeD,[a/4,-a/4]),
        listeQ:append(listeQ,[var[1]+var[i]+(l1+li)/a=0,var[1]-var[i]+(li-l1)/a=0]),
        q:subst([var[1]=0,var[i]=0],q)-l1*li/a,
        var:append(rest(rest(var,i-1-length(var))),rest(var,i))))),
    for k:1 thru length(listeD) do D[k,k]:listeD[k],
            return([D,transpose(coefmatrix(listeQ,variable))]))$

︡51a26d2e-89a4-444b-a29f-f7e6f46d4008︡{"stderr":"Error in lines 1-1\n"}︡{"stderr":"Traceback (most recent call last):\n  File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 865, in execute\n    exec compile(block+'\\n', '', 'single') in namespace, locals\n  File \"\", line 1, in <module>\n  File \"/projects/ef4515d3-97a4-4ff1-a9ed-7538488a8b36/.sagemathcloud/sage_server.py\", line 900, in execute_with_code_decorators\n    print code_decorator.eval(code, locals=self.namespace),\n  File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 1220, in eval\n    return self._eval_line_using_file(code)\n  File \"/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/expect.py\", line 724, in _eval_line_using_file\n    if \"Input/output error\" in msg[0]: # This occurs on non-linux machines\nIndexError: tuple index out of range\n"}︡