This is new in 10.5.beta6, and seems serious :
sage: var("x, y, rho, theta", domain="real") (x, y, rho, theta) sage:
Sys=[tan(theta)==y/x, x^2+y^2==rho^2] sage: solve(Sys, (rho, theta))
---------------------------------------------------------------------------
SyntaxError Traceback (most recent call last) File
/usr/local/sage-10/src/sage/calculus/calculus.py:2409, in
symbolic_expression_from_maxima_string(x, equals_sub, maxima) 2408
SRM_parser._callable_constructor().set_names(function_syms) -> 2409 return
SRM_parser.parse_sequence(s) 2410 except SyntaxError: File
/usr/local/sage-10/src/sage/misc/parser.pyx:573, in
sage.misc.parser.Parser.parse_sequence() 572 --> 573 cpdef
parse_sequence(self, s): 574 """ File
/usr/local/sage-10/src/sage/misc/parser.pyx:590, in
sage.misc.parser.Parser.parse_sequence() 589 cdef Tokenizer tokens =
Tokenizer(s) --> 590 all = self.p_sequence(tokens) 591 if tokens.next() !=
EOS: File /usr/local/sage-10/src/sage/misc/parser.pyx:654, in
sage.misc.parser.Parser.p_sequence() 653 elif token == c'[': --> 654 obj =
self.p_list(tokens) 655 elif token == c'(': File
/usr/local/sage-10/src/sage/misc/parser.pyx:686, in
sage.misc.parser.Parser.p_list() 685 self.parse_error(tokens, "Malformed
list") --> 686 all = self.p_sequence(tokens) 687 token = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:663, in
sage.misc.parser.Parser.p_sequence() 662 else: --> 663 obj =
self.p_eqn(tokens) 664 PyList_Append(all, obj) File
/usr/local/sage-10/src/sage/misc/parser.pyx:754, in
sage.misc.parser.Parser.p_eqn() 753 """ --> 754 lhs = self.p_expr(tokens)
755 cdef int op = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:795, in
sage.misc.parser.Parser.p_expr() 794 cdef int op --> 795 operand1 =
self.p_term(tokens) 796 op = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:830, in
sage.misc.parser.Parser.p_term() 829 cdef int op --> 830 operand1 =
self.p_factor(tokens) 831 op = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:873, in
sage.misc.parser.Parser.p_factor() 872 tokens.backtrack() --> 873 return
self.p_power(tokens) 874 File
/usr/local/sage-10/src/sage/misc/parser.pyx:901, in
sage.misc.parser.Parser.p_power() 900 """ --> 901 operand1 =
self.p_atom(tokens) 902 cdef int token = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:958, in
sage.misc.parser.Parser.p_atom() 957 func = self.callable_constructor(name)
--> 958 args, kwds = self.p_args(tokens) 959 token = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:995, in
sage.misc.parser.Parser.p_args() 994 while token == c',': --> 995 arg =
self.p_arg(tokens) 996 if isinstance(arg, tuple): File
/usr/local/sage-10/src/sage/misc/parser.pyx:1044, in
sage.misc.parser.Parser.p_arg() 1043 tokens.backtrack() -> 1044 return
self.p_expr(tokens) 1045 File
/usr/local/sage-10/src/sage/misc/parser.pyx:795, in
sage.misc.parser.Parser.p_expr() 794 cdef int op --> 795 operand1 =
self.p_term(tokens) 796 op = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:830, in
sage.misc.parser.Parser.p_term() 829 cdef int op --> 830 operand1 =
self.p_factor(tokens) 831 op = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:873, in
sage.misc.parser.Parser.p_factor() 872 tokens.backtrack() --> 873 return
self.p_power(tokens) 874 File
/usr/local/sage-10/src/sage/misc/parser.pyx:901, in
sage.misc.parser.Parser.p_power() 900 """ --> 901 operand1 =
self.p_atom(tokens) 902 cdef int token = tokens.next() File
/usr/local/sage-10/src/sage/misc/parser.pyx:970, in
sage.misc.parser.Parser.p_atom() 969 if token != c')': --> 970
self.parse_error(tokens, "Mismatched parentheses") 971 return expr File
/usr/local/sage-10/src/sage/misc/parser.pyx:1047, in
sage.misc.parser.Parser.parse_error() 1046 cdef parse_error(self, Tokenizer
tokens, msg="Malformed expression"): -> 1047 raise SyntaxError(msg,
tokens.s, tokens.pos) 1048 SyntaxError: Mismatched parentheses During
handling of the above exception, another exception occurred: TypeError
Traceback (most recent call last) Cell In[9], line 1 ----> 1 solve(Sys,
(rho, theta)) File /usr/local/sage-10/src/sage/symbolic/relation.py:1157,
in solve(f, *args, **kwds) 1154 except Exception: # if that gives an error,
stick with no solutions 1155 s = [] -> 1157 sol_list =
string_to_list_of_solutions(repr(s)) 1159 # Relaxed form suggested by Mike
Hansen (#8553): 1160 if kwds.get('solution_dict', None): File
/usr/local/sage-10/src/sage/symbolic/relation.py:576, in
string_to_list_of_solutions(s) 574 from sage.structure.sequence import
Sequence 575 from sage.calculus.calculus import
symbolic_expression_from_maxima_string --> 576 v =
symbolic_expression_from_maxima_string(s, equals_sub=True) 577 return
Sequence(v, universe=Objects(), cr_str=True) File
/usr/local/sage-10/src/sage/calculus/calculus.py:2411, in
symbolic_expression_from_maxima_string(x, equals_sub, maxima) 2409 return
SRM_parser.parse_sequence(s) 2410 except SyntaxError: -> 2411 raise
TypeError("unable to make sense of Maxima expression '%s' in Sage" % s)
2412 finally: 2413 is_simplified = False TypeError: unable to make sense of
Maxima expression '[if((_SAGE_VAR_x != 0) and
(1-(_SAGE_VAR_y-I*_SAGE_VAR_x)/(_SAGE_VAR_y+I*_SAGE_VAR_x) !=
0),[_SAGE_VAR_rho == -sqrt(_SAGE_VAR_y^2+_SAGE_VAR_x^2),_SAGE_VAR_theta ==
-((I*log(-((_SAGE_VAR_y^2+_SAGE_VAR_x^2)/(_SAGE_VAR_y^2+2*I*_SAGE_VAR_x*_SAGE_VAR_y-_SAGE_VAR_x^2)))-2*pi*z2067)/2)],union()),if((_SAGE_VAR_x
!= 0) and (1-(_SAGE_VAR_y-I*_SAGE_VAR_x)/(_SAGE_VAR_y+I*_SAGE_VAR_x) !=
0),[_SAGE_VAR_rho == sqrt(_SAGE_VAR_y^2+_SAGE_VAR_x^2),_SAGE_VAR_theta ==
-((I*log(-((_SAGE_VAR_y^2+_SAGE_VAR_x^2)/(_SAGE_VAR_y^2+2*I*_SAGE_VAR_x*_SAGE_VAR_y-_SAGE_VAR_x^2)))-2*pi*z2675)/2)],union())]'
in Sage
However :
sage: solve(Sys, (rho, theta), algorithm="sympy") [{rho: -sqrt(x^2 + y^2),
theta: arctan(y/x)}, {rho: sqrt(x^2 + y^2), theta: arctan(y/x)}]
as expected. By the way, giac is also problematic :
sage: solve(Sys, (rho, theta), algorithm="giac")
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last) Cell In[19], line 1 ----> 1
solve(Sys, (rho, theta), algorithm="giac") File
/usr/local/sage-10/src/sage/symbolic/relation.py:1129, in solve(f, *args,
**kwds) 1126 return sympy_set_to_list(ret, sympy_vars) 1128 if algorithm ==
'giac': -> 1129 return _giac_solver(f, x, solution_dict) 1131 from
sage.calculus.calculus import maxima 1132 m = maxima(f) File
/usr/local/sage-10/src/sage/symbolic/relation.py:1455, in _giac_solver(f,
x, solution_dict) 1453 giac_f = libgiac(f) 1454 giac_vars = libgiac(x) ->
1455 ret = giac_f.solve(giac_vars) 1456 sols = ret.sage() 1457 if
solution_dict: File
/usr/local/sage-10/src/sage/libs/giac/auto-methods.pxi:14802, in
sage.libs.giac.giac.GiacMethods_base.solve() 14800
Ex4:solve([x^2-y^2=0,x^2-z^2=0],[x,y,z]) 14801 ''' > 14802 return
GiacMethods['solve'](self,*args) 14803 14804 def somme(self,*args): File
/usr/local/sage-10/src/sage/libs/giac/giac.pyx:1934, in
sage.libs.giac.giac.GiacFunction.__call__() 1932 if n == 1: 1933 args =
(Pygen(args[0]).eval(),) -> 1934 return Pygen.__call__(self, *args) 1935
1936 File /usr/local/sage-10/src/sage/libs/giac/giac.pyx:1109, in
sage.libs.giac.giac.Pygen.__call__() 1107 pari_unlock_result =
GIAC_eval(pari_unlock.gptr[0], <int> 1, context_ptr) 1108 tmp =
_wrap_gen(result) -> 1109 raise 1110 else: 1111 result =
GIAC_eval(right.gptr[0], <int> 1, context_ptr) File
/usr/local/sage-10/src/sage/libs/giac/giac.pyx:1099, in
sage.libs.giac.giac.Pygen.__call__() 1097 sig_on() 1098 try: -> 1099 result
= self.gptr[0](right.gptr[0], context_ptr) 1100 except RuntimeError: 1101 #
The previous computation might have failed due to a pari_lock RuntimeError:
Error: Invalid dimension
As far as I can remember, I didn’t (yet) see this.
It is reproducible in Maxima 5.47.0 :
Maxima 5.47.0 https://maxima.sourceforge.io using Lisp GNU Common Lisp
(GCL) GCL 2.6.14 git tag Version_2_6_15pre8 Distributed under the GNU
Public License. See the file COPYING. Dedicated to the memory of William
Schelter. The function bug_report() provides bug reporting information.
(%i1) declare(x, real, y, real, rho, real, theta, real); (%o1) done (%i2)
solve([tan(theta)=y/x, rho^2=x^2+y^2], [rho, theta]); (%o2) [] (%i3)
load("to_poly_solve"); (%o3)
/usr/share/maxima/5.47.0/share/to_poly_solve/to_poly_solve.mac (%i4)
%solve([tan(theta)=y/x, rho^2=x^2+y^2], [rho, theta]); y - %i x (%o4)
%union(%if((x # 0) %and (1 - -------- # 0), y + %i x 2 2 [rho = - sqrt(y +
x ), theta = 2 2 y + x %i log(- ------------------) - 2 %pi %z21938 2 2 y +
2 %i x y - x - --------------------------------------------], %union()), 2
y - %i x 2 2 %if((x # 0) %and (1 - -------- # 0), [rho = sqrt(y + x ), y +
%i x 2 2 y + x %i log(- ------------------) - 2 %pi %z27138 2 2 y + 2 %i x
y - x theta = - --------------------------------------------], %union())) 2
and is also reproducible in Sagecell
<https://sagecell.sagemath.org/?z=eJxFzEEKxCAMQNF9Ye4QXEUaWnCfk5QKgREqVB1SEb19Szezf___NOaKSXpMsrSgVywZrf1MTRRNJxgEehSCeoQqhuBbksTMRoOc5nFXOVvArUrGl1jmsfY38o65ezcP73aC7b_Z7Q0yWCaq&lang=sage&interacts=eJyLjgUAARUAuQ==>,
which still uses Maxima 5.46.0.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/7b504480-e5a3-4072-ae13-d3a867af1cd8n%40googlegroups.com.