Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well... Run :

reset()
var("x, y, z, a")
Eqs=[x-y+a*z==a, a+a*y-z==-1, x+y+z==2]
S1=solve(Eqs, (x, y, z))

Then :

sage: S1
[[x == (2*a - 1)/(a - 2), y == -(a^2 - a + 1)/(a^2 - a - 2), z == (a^2 - 4*a - 2)/(a^2 - a - 2)]]

The problem arises from the presence of the parameter $a$ in the denominator of the elements of the solution(s). Collect them :

sage: Dens=set(flatten([[u.rhs().denominator() for u in s] for s in S1])) ; Dens
{a^2 - a - 2, a - 2}

We can now solve for $a$ each of these denominators, giving us a list of problematic values :

sage: PV=set(flatten([u.solve(a) for u in Dens])) ; PV
{a == 2, a == -1}

(Note : your "resolution by hand" seems to be erroneous...)

We can substitute each of these problematic values for a in the system :

sage: {u: [v.subs(u) for v in Eqs] for u in PV}
{a == 2: [x - y + 2*z == 2, 2*y - z + 2 == -1, x + y + z == 2],
 a == -1: [x - y - z == -1, -y - z - 1 == -1, x + y + z == 2]}

and try to solve the substituted system in each case :

sage: {u: solve([v.subs(u) for v in Eqs], (x, y, z)) for u in PV}
{a == 2: [], a == -1: []}

In both cases, the system is impossible...

Neither Sympy, Giac, Fricas nor Mathematica seem to check the validity of the solution of this system ; it seems to be a general weakness of CASes, which do not check the conditions of existence of the expressions...

HTH,

Well... Run :

reset()
var("x, y, z, a")
Eqs=[x-y+a*z==a, a+a*y-z==-1, x+y+z==2]
S1=solve(Eqs, (x, y, z))

Then :

sage: S1
[[x == (2*a - 1)/(a - 2), y == -(a^2 - a + 1)/(a^2 - a - 2), z == (a^2 - 4*a - 2)/(a^2 - a - 2)]]

The problem arises from the presence of the parameter $a$ in the denominator of the elements of the solution(s). Collect them :

sage: Dens=set(flatten([[u.rhs().denominator() for u in s] for s in S1])) ; Dens
{a^2 - a - 2, a - 2}

We can now solve for $a$ each of these denominators, giving us a list of problematic values :

sage: PV=set(flatten([u.solve(a) for u in Dens])) ; PV
{a == 2, a == -1}

(Note : your "resolution by hand" seems to be erroneous...)

Check :

sage: [[bool(u.subs(s)) for u in Eqs] for s in S1]
[[True, True, True]]

The problem arises from the presence of the parameter $a$ in the denominator of the elements of the solution(s). Collect these denominators :

sage: Dens=set(flatten([[u.rhs().denominator() for u in s] for s in S1])) ; Dens
{a^2 - a - 2, a - 2}

We can now solve for $a$ each of these denominators, giving us a list of problematic values :

sage: PV=set(flatten([u.solve(a) for u in Dens])) ; PV
{a == 2, a == -1}

We can substitute each of these problematic values for a in the system :

sage: {u: [v.subs(u) for v in Eqs] for u in PV}
{a == 2: [x - y + 2*z == 2, 2*y - z + 2 == -1, x + y + z == 2],
 a == -1: [x - y - z == -1, -y - z - 1 == -1, x + y + z == 2]}

and try to solve the substituted system in each case :

sage: {u: solve([v.subs(u) for v in Eqs], (x, y, z)) for u in PV}
{a == 2: [], a == -1: []}

In both cases, the system is impossible...

Neither Sympy, Giac, Fricas nor Mathematica seem to check the validity of the solution of this system ; it seems to be a general weakness of CASes, which do not check the conditions of existence of the expressions...

HTH,