123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
- % Test file for i_solve and r_solve operators.
- % Author: F.J.Wright@Maths.QMW.ac.uk
- % Version 1.051, 16 Jan 1995
- i_solve((x - 10)*(x + 20)*(x - 30)*(x + 40)*(x - 50));
- {x=-20,x=-40,x=50,x=30,x=10}
- % {x=-20,x=-40,x=50,x=30,x=10}
- i_solve(x^4 - 1, x);
- {x=1,x=-1}
- % {x=1,x=-1}
- i_solve(x^4 + 1);
- {}
- % {}
- r_solve((x^2 - 1)*(x^2 - 9));
- {x=1,x=-3,x=3,x=-1}
- % {x=1,x=-3,x=3,x=-1}
- r_solve(9x^2 - 1);
- 1 - 1
- {x=---,x=------}
- 3 3
- % 1 - 1
- % {x=---,x=------}
- % 3 3
- r_solve(9x^2 - 4, x);
- - 2 2
- {x=------,x=---}
- 3 3
- % - 2 2
- % {x=------,x=---}
- % 3 3
- r_solve(9x^2 + 16, x);
- {}
- % {}
- r_solve((9x^2 - 16)*(x^2 - 9), x);
- - 4 4
- {x=------,x=3,x=-3,x=---}
- 3 3
- % - 4 4
- % {x=------,x=3,x=-3,x=---}
- % 3 3
- % First two examples from Loos' paper:
- % ===================================
- r_solve(6x^4 - 11x^3 - x^2 - 4);
- - 2
- {x=------,x=2}
- 3
- % - 2
- % {x=------,x=2}
- % 3
- r_solve(2x^3 + 12x^2 + 13x + 15);
- {x=-5}
- % {x=-5}
- % Remaining four CORRECTED examples from Loos' paper:
- % ==================================================
- r_solve(2x^4 - 4x^3 + 3x^2 - 5x - 2);
- {x=2}
- % {x=2}
- r_solve(6x^5 + 11x^4 - x^3 + 5x - 6);
- - 3 2
- {x=------,x=---}
- 2 3
- % - 3 2
- % {x=------,x=---}
- % 2 3
- r_solve(x^5 - 5x^4 + 2x^3 - 25x^2 + 21x + 270);
- {x=3,x=5,x=-2}
- % {x=3,x=5,x=-2}
- r_solve(2x^6 + x^5 - 9x^4 - 6x^3 - 5x^2 - 7x + 6);
- 1
- {x=---,x=-2}
- 2
- % 1
- % {x=---,x=-2}
- % 2
- % Degenerate equations:
- % ====================
- i_solve 0;
- {}
- % {}
- i_solve(0, x);
- {x=arbint(1)}
- % {x=arbint(1)}
- r_solve(a = a, x);
- {x=arbrat(2)}
- % {x=arbrat(2)}
- r_solve(x^2 - 1, y);
- {}
- % {}
- % Test of options and multiplicity:
- % ================================
- i_solve(x^4 - 1, x, noeqs);
- {1,-1}
- % {1,-1}
- i_solve((x^4 - 1)^3, x);
- {x=1,x=-1}
- % {x=1,x=-1}
- root_multiplicities;
- {3,3}
- % {3,3}
- on multiplicities;
- i_solve((x^4 - 1)^3, x);
- {x=1,x=1,x=1,x=-1,x=-1,x=-1}
- % {x=1,x=1,x=1,x=-1,x=-1,x=-1}
- root_multiplicities;
- {}
- % {}
- i_solve((x^4 - 1)^3, x, separate);
- {x=1,x=-1}
- % {x=1,x=-1}
- root_multiplicities;
- {3,3}
- % {3,3}
- off multiplicities;
- i_solve((x^4 - 1)^3, x, multiplicities);
- {x=1,x=1,x=1,x=-1,x=-1,x=-1}
- % {x=1,x=1,x=1,x=-1,x=-1,x=-1}
- root_multiplicities;
- {}
- % {}
- i_solve((x^4 - 1)^3, x, expand, noeqs);
- {1,1,1,-1,-1,-1}
- % {1,1,1,-1,-1,-1}
- root_multiplicities;
- {}
- % {}
- i_solve((x^4 - 1)^3, x, together);
- {{x=1,3},{x=-1,3}}
- % {{x=1,3},{x=-1,3}}
- root_multiplicities;
- {}
- % {}
- i_solve((x^4 - 1)^3, x, together, noeqs);
- {{1,3},{-1,3}}
- % {{1,3},{-1,3}}
- root_multiplicities;
- {}
- % {}
- i_solve((x^4 - 1)^3, x, nomul);
- {x=-1,x=1}
- % {x=-1,x=1}
- root_multiplicities;
- {}
- % {}
- % Test of error handling:
- % ======================
- on errcont;
- r_solve();
- ***** r/i_solve called with no equations
- % ***** r/i_solve called with no equations
- r_solve(x^2 - a, x);
- 2
- ***** - a + x invalid as univariate polynomial over Z
- % 2
- % ***** - a + x invalid as univariate polynomial over Z
- r_solve(x^2 - 1, x, foo);
- ***** foo invalid as optional r/i_solve argument
- % ***** foo invalid as optional r/i_solve argument
- r_solve({x^2 - 1}, x);
- 2
- ***** {x - 1} invalid as univariate polynomial over Z
- % 2
- % ***** {x - 1} invalid as univariate polynomial over Z
- on complex;
- i_solve((x-1)*(x-i), x);
- 2
- ***** - i*x + i + x - x invalid as univariate polynomial over Z
- % 2
- % ***** - i*x + i + x - x invalid as univariate polynomial over Z
- end$
- (TIME: rsolve 290 320)
|