1 | initial version |

Here's a way to see why the explicit split into real and imaginary parts is necessary. If the variables are given to `solve`

as a list,

```
var('x, y')
z = 1/(i*x + 1/(i*y + 1))
Equation = z == 2
solve(Equation, [x, y])
[[x == (-I*r1 + 1)/(2*r1 - 2*I), y == r1]]
```

then it's clear that `solve`

is returning a fully complex answer with a dummy variable `r1`

. With references to this dummy variable and the result of solve, one can then find solutions that make the imaginary part of `x`

zero:

```
var('x, y, r1')
z = 1/(i*x + 1/(i*y + 1))
Equation = z == 2
f = solve(Equation, [x, y])
solve( imaginary(f[0][0].rhs()), r1 )
[r1 == -1, r1 == 1]
```

With an additional reference to this second result, the desired solution form can be achieved with nested lists:

```
var('x, y, r1')
z = 1/(i*x + 1/(i*y + 1))
Equation = z == 2
f = solve(Equation, [x, y])
g = solve( imaginary(f[0][0].rhs()), r1 )
[[f[0][i].subs(g[j]) for i in (0,1)] for j in (0,1)]
[[x == (-1/2), y == -1], [x == (1/2), y == 1]]
```

Here's a link to a live example.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.