Re: am I doing something wrong

39 views
Skip to first unread message
Message has been deleted

Volker Braun

unread,
Nov 28, 2012, 9:59:50 AM11/28/12
to sage-s...@googlegroups.com
Confirmed, this is now http://trac.sagemath.org/13773

On Tuesday, November 27, 2012 7:12:56 PM UTC, Alan wrote:
my first attempt at using the online version was to move from polar to cartesian coods. I tried

var('r theta psi x y z')
(r,theta,psi,x,y,z)
e1 = r == +sqrt(x^2+y^2+z^2)
e2 = theta == arccos(z/sqrt(x^2+y^2+z^2))
e3 = psi == arctan(y/x)
solve([e1,e2,e3],x,y,z)

with the  result


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_53.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dmFyKCdyIHRoZXRhIHBzaSB4IHkgeicpCihyLHRoZXRhLHBzaSx4LHkseikKZTEgPSByID09ICtzcXJ0KHheMit5XjIrel4yKQplMiA9IHRoZXRhID09IGFyY2Nvcyh6L3NxcnQoeF4yK3leMit6XjIpKQplMyA9IHBzaSA9PSBhcmN0YW4oeS94KQpzb2x2ZShbZTEsZTIsZTNdLHgseSx6KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
   
  File "/tmp/tmpCMmv9N/___code___.py", line 8, in <module>
    exec compile(u'solve([e1,e2,e3],x,y,z)
  File "", line 1, in <module>
   
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 753, in solve
    sol_list = string_to_list_of_solutions(repr(s))
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 457, in string_to_list_of_solutions
    v = symbolic_expression_from_maxima_string(s, equals_sub=True)
  File "/sagenb/sage_install/sage-5.4-sage.math.washington.edu-x86_64-Linux/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 1791, in symbolic_expression_from_maxima_string
    raise TypeError, "unable to make sense of Maxima expression '%s' in Sage"%s
TypeError: unable to make sense of Maxima expression '[If(and(-pi/2<parg(-r),-pi/2<parg(r),parg(-r)<==pi/2,parg(r)<==pi/2,-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==-tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==-r*cos(theta)],union()),If(and(-pi/2<parg(-r),-pi/2<parg(r),parg(-r)<==pi/2,parg(r)<==pi/2,r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==-r*cos(theta)],union()),If(and(-pi/2<parg(r),parg(r)<==pi/2,-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==-tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==r*cos(theta)],union()),If(and(-pi/2<parg(r),parg(r)<==pi/2,r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==r*cos(theta)],union())]' in Sage


It seems to be objecting to "in Sage" in the return value from Maxima

kcrisman

unread,
Nov 28, 2012, 10:49:29 AM11/28/12
to sage-s...@googlegroups.com

TypeError: unable to make sense of Maxima expression '[If(and(-pi/2<parg(-r),-pi/2<parg(r),parg(-r)<==pi/2,parg(r)<==pi/2,-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==-tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==-r*cos(theta)],union()),If(and(-pi/2<parg(-r),-pi/2<parg(r),parg(-r)<==pi/2,parg(r)<==pi/2,r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==-r*cos(theta)],union()),If(and(-pi/2<parg(r),parg(r)<==pi/2,-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==-r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==-tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==r*cos(theta)],union()),If(and(-pi/2<parg(r),parg(r)<==pi/2,r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))!=0,sqrt(r^2*(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1))+r^2*cos(theta)^2+tan(psi)^2*r^2*(1-cos(theta))*(cos(theta)+1)/(tan(psi)^2+1))!=0),[x==r*sqrt(1/(tan(psi)^2+1)-cos(theta)^2/(tan(psi)^2+1)),y==tan(psi)*r*sqrt(1-cos(theta))*sqrt(cos(theta)+1)/sqrt(tan(psi)^2+1),z==r*cos(theta)],union())]' in Sage


It seems to be objecting to "in Sage" in the return value from Maxima

It's objecting to the "if", actually.  The "in Sage" is just what we append. Also, the "union" in the spot they're in will not get properly parsed, though we do handle that in certain easy circumstances.
Reply all
Reply to author
Forward
0 new messages