Ask Your Question

Revision history [back]

In the error traceback, it says there is a syntax error saying "Mismatched parentheses" when sage tries to parse the answer from Maxima.

For example, the simplified command:

sage: var('n k x h y')
sage: eq1 = (-4-n^2+9*187+24*k*187-16*x-16*x^2+4*(h+2*h*x)^2+n*(2-4*y))/8 == 0
sage: eq2 = -4*sqrt(-(187*(9+24*k)-3)/48) - h == 0
sage: eq4 = x+h/4 == 0
sage: solutions = solve([eq1,eq2,eq4],n,k,x,h,y)

outputs:

...
SyntaxError: Mismatched parentheses
...
TypeError: unable to make sense of Maxima expression '[if((-pi/2 < parg(c3812)) and (parg(c3812) <== pi/2),[_SAGE_VAR_h == -4*c3812,_SAGE_VAR_k == ((-2*c3812^2)-70)/187,_SAGE_VAR_n == 2*sqrt(c3814^2-c3814+64*c3812^4+64*c3812^3-4*c3812)-2*c3814+1,_SAGE_VAR_x == c3812,_SAGE_VAR_y == c3814],union()),if((-pi/2 < parg(c3815)) and (parg(c3815) <== pi/2),[_SAGE_VAR_h == -4*c3815,_SAGE_VAR_k == ((-2*c3815^2)-70)/187,_SAGE_VAR_n == (-2*sqrt(c3816^2-c3816+64*c3815^4+64*c3815^3-4*c3815))-2*c3816+1,_SAGE_VAR_x == c3815,_SAGE_VAR_y == c3816],union()),[_SAGE_VAR_h == -1,_SAGE_VAR_k == -3/8,_SAGE_VAR_n == (-2*sqrt(c3813^2-c3813+1/4))-2*c3813+1,_SAGE_VAR_x == 1/4,_SAGE_VAR_y == c3813],[_SAGE_VAR_h == -1,_SAGE_VAR_k == -3/8,_SAGE_VAR_n == 2*sqrt(c3819^2-c3819+1/4)-2*c3819+1,_SAGE_VAR_x == 1/4,_SAGE_VAR_y == c3819]]' in Sage

After editing the output result from Maxima, I don't see the "mismatches parenthesis", can you? :

[if((-pi/2 < parg(c3812)) and (parg(c3812) <== pi/2),
 [_SAGE_VAR_h == -4*c3812,
  _SAGE_VAR_k == ((-2*c3812^2)-70)/187,
  _SAGE_VAR_n == 2*sqrt(c3814^2-c3814+64*c3812^4+64*c3812^3-4*c3812)-2*c3814+1,
  _SAGE_VAR_x == c3812,
  _SAGE_VAR_y == c3814],
  union()),
 if((-pi/2 < parg(c3815)) and (parg(c3815) <== pi/2),
 [_SAGE_VAR_h == -4*c3815,
  _SAGE_VAR_k == ((-2*c3815^2)-70)/187,
  _SAGE_VAR_n == (-2*sqrt(c3816^2-c3816+64*c3815^4+64*c3815^3-4*c3815))-2*c3816+1,
  _SAGE_VAR_x == c3815,
  _SAGE_VAR_y == c3816],
  union()),
 [_SAGE_VAR_h == -1,
  _SAGE_VAR_k == -3/8,
  _SAGE_VAR_n == (-2*sqrt(c3813^2-c3813+1/4))-2*c3813+1,
  _SAGE_VAR_x == 1/4,
  _SAGE_VAR_y == c3813],
 [_SAGE_VAR_h == -1,
  _SAGE_VAR_k == -3/8,
  _SAGE_VAR_n == 2*sqrt(c3819^2-c3819+1/4)-2*c3819+1,
  _SAGE_VAR_x == 1/4,
  _SAGE_VAR_y == c3819]
]

If there are no mismatches parenthesis, it means sage needs to improve the way it parses the maxima output.