Opened 5 years ago

Closed 5 years ago

# Sage unable to make sense of Maxima expression when solving a system involving square roots

Reported by: Owned by: Thierry Monteil major sage-duplicate/invalid/wontfix symbolics N/A

### Description

As reported on his ask question, trying to solve the following equation leads to an error:

```var('r2 si co r12 r22 r32 d32')
eq1 = r12==r2*d32*(1-si*(co+sqrt(3*(1-co*co)))/2)/2
eq2 = r22==r2*d32*(1-si*(co-sqrt(3*(1-co*co)))/2)/2
eq3 = r32==r2*d32*(1+si*co)/2
solve([eq1,eq2,eq3],r2,si,co)
```

```TypeError: unable to make sense of Maxima expression '[if((-pi/2<parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2)))and(parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2))<==pi/2),[_SAGE_VAR_co==-((2*_SAGE_VAR_r32-_SAGE_VAR_r22-_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VA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_r32-_SAGE_VAR_r22-_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2),_SAGE_VAR_r2==(2*_SAGE_VAR_r32+2*_SAGE_VAR_r22+2*_SAGE_VAR_r12)/(3*_SAGE_VAR_d32),_SAGE_VAR_si==(2*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(_SAGE_VAR_r32+_SAGE_VAR_r22+_SAGE_VAR_r12)],union())]' in Sage
```

I am not familiar with the interface between Sage and Maxima, but it seems that Sage is not able to handle the conditional answers (`if ... and ...`)

### comment:1 Changed 5 years ago by Ralf Stephan

Duplicate of #13773. Unfortunately SymPy takes forever in this case.

### comment:2 Changed 5 years ago by Ralf Stephan

Milestone: sage-8.2 → sage-duplicate/invalid/wontfix new → needs_review

### comment:3 Changed 5 years ago by Karl-Dieter Crisman

Status: needs_review → positive_review

### comment:4 Changed 5 years ago by Vincent Delecroix

Resolution: → wontfix positive_review → closed

closing positively reviewed duplicates

Note: See TracTickets for help on using tickets.