Ask Your Question
0

maxima on sagecloud

asked 2014-11-23 11:07:56 +0100

dso449 gravatar image

updated 2015-01-17 17:48:56 +0100

FrédéricC gravatar image

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"}︡
edit retag flag offensive close merge delete

Comments

There is something about "tuple index out of range", does this mean you should replace "1 thru length(listeD)" by "0 thru Length(listeD)-1" or something similar?

slelievre gravatar imageslelievre ( 2014-11-24 09:23:42 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-11-24 15:49:45 +0100

William Stein gravatar image

This is a general problem with Sage, which isn't specific to SageMathCloud. I'm surprised nobody noticed this before. Anyways, the problem is really that

sage: maxima._read_in_file_command('x')
...
NotImplementedError:

What is happening is that nobody implemented the _read_in_file_command function in Sage for the maxima interface, since I guess nobody hit this or none of us know how to read a file in (for evaluation) in Maxima. If that function were implemented, things would just work.

The reason that things work fine for smaller input is that the maxima interface doesn't use a file for smaller input.

This is an old bug in Sage. It's probably related to this: http://trac.sagemath.org/ticket/1660

I opened http://trac.sagemath.org/ticket/17388 for this bug.

edit flag offensive delete link more

Comments

And to answer your original question. You can run your program on SageMathCloud, but you have to do it in a more traditional way. (1) Create a terminal and open it. (2) type "maxima" in the terminal, (3) paste in your code.

You can also create a file then read it into the maxima program started from the terminal somehow (not sure how).

William Stein gravatar imageWilliam Stein ( 2014-11-24 15:51:09 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-11-23 11:07:56 +0100

Seen: 787 times

Last updated: Nov 24 '14