|
|
last edited 10 years ago by test1 |
1 2 3 | ||
Editor: test1
Time: 2014/04/15 18:22:27 GMT+0 |
||
Note: |
added: )set output algebra on )set output tex off added: Note that solution should satisfy _all_ equations. Quantities which are not variables are treated as parameters and solution is valid for generic parameters. There are no values of X and V which solve the last two equations: generically C is different than 2*U+V
Some examples:
)set output algebra on
)set output tex off
L := [ A = 2*X+Y,B = 2*Y+X, C = 2*U+V, D = 2*V+U];
solve(L,[X, Y])
(2) []
However:
solve(L,[X, Y, U, V])
- B + 2A 2B - A - D + 2C 2D - C (3) [[X= --------,Y= ------, U= --------, V= ------]] 3 3 3 3
Note that solution should satisfy all equations. Quantities which are not variables are treated as parameters and solution is valid for generic parameters. There are no values of X and V which solve the last two equations: generically C is different than 2*U+V
Simpler:
solve([a - b = 0,c - d = 0], [b])
(4) []
linSolve([a - b,c - d], [b])
(5) [particular= "failed",basis= []]
The operation solve
calls linSolve
, which sets up the corresponding matrix
and vector and solves it using solve$LinearSystemMatrixPackage
. This in turn
returns "failed"
, since the last columns of the matrix contain zeros, the
vector does not. In the example above, the matrix and vector are:
+- 1+ [mat= | |,vec= [- a,d - c]] + 0 +
Note that
linSolve([a - b,0], [b])
(6) [particular= [a],basis= []]
works. The same happens, if the equation is not linear:
L := [ A = 2*X^2+Y,B = 2*Y+X, C = 2*U+V, D = 2*V+U];
solve(L,[X, Y])
(8) [[]]
)set output algebra on
)set output tex off
solve(L,[X, Y, U, V])
2 2 - D + 2C 2D - C (9) [[X= - 2Y + B,8Y + (- 8B + 1)Y + 2B - A= 0, U= --------, V= ------]] 3 3
)set output algebra off
)set output tex on
So, very probably, a fix would need to do two things:
The second point is necessary, since
L := [ A = P+Q,B = P-Q, C = 1, C = -1];
solve(L,[P, Q])
(1) |
solve(L,[P, Q, C])
(2) |
really has no solution. As far as I know, this would have to be done in the very last function defined in syssolp.spad
, which is:
-- general solver. Input in polynomial style -- solve(lr:L F,vl:L SE) == empty? vl => empty() checkLinear(lr,vl) => -- linear system -- soln := linSolve(lr, vl) soln case "failed" => [] eqns: L EQ F := [] for i in 1..#vl repeat lhs := (vl.i::(P R))::F rhs := rhs soln.i eqns := append(eqns, [lhs = rhs]) [eqns] -- polynomial system -- if R has GcdDomain then parRes:=triangularSystems(lr,vl) [[makeEq(map(makeR2F,f)$PP2,vl) for f in pr] for pr in parRes] else [[]]
The letter F
is a macro for FRAC POLY R
here. To check whether an equation contains a variable we have to check numerator and denominator of both sides of the equation with variables$POLY R
. I do not know however, how to find out whether the equations independent of vl
are contradicting.