modsr.tst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. % Test series for the package MODSR: SOLVE and ROOTS for
  2. % modular polynomials and modular polynomial systems.
  3. % Moduli need not be primes.
  4. on modular;
  5. setmod 8;
  6. m_solve(2x=3); % {}
  7. m_solve(2x=4); % {{x=2},{x=6}}
  8. m_solve(x^2-1); % {{x=1},{x=3},{x=5},{x=7}}
  9. m_solve({x^2-y^3=3}); % {{x=0,y=5}, {x=2,y=1}, {x=4,y=5}, {x=6,y=1}}
  10. m_solve({x^2-y^3=3,x=2}); % {{y=1,x=2}}
  11. m_solve({x=2,x^2-y^3=3}); % {{x=2,y=1}}
  12. m_solve({x1,x2 + 6,2*x1**3 + 4*x2**4 + x3 + 6}); % {{x1=0,x2=2,x3=2}}
  13. setmod 800;
  14. m_solve(x^2-1);
  15. % {{x=1}, {x=49}, {x=351}, {x=399}, {x=401}, {x=449}, {x=751}, {x=799}}
  16. m_solve({x1 + 51,
  17. 282*x1^4 + x2 + 468,
  18. x3 + 1054,
  19. 256*x1^2 + 257*x2^4 + 197*x3 + x4 + 653,
  20. 255*x1^4 + 40*x2^2 + x5 + 868,
  21. 230*x1^4 + 670*x3 + 575*x4^4 + 373*x5^3 + x6 + 1328,
  22. 182*x4^4 + 727*x5^2 + 609*x6**4 + x7 + 1032,
  23. 623*x1^3 + 614*x2^4 + 463*x3**2 + 365*x4 + 300*x7 + x8 + 1681});
  24. % {{x1=749,x2=50,x3=546,x4=729,x5=77,x6=438,x7=419,x8=399}}
  25. m_solve{x+y=4,x^2+y^2=8};
  26. off modular;
  27. % m_roots has the modulus as its second argument.
  28. m_roots(x^2-1,8); % {1,3,5,7}
  29. m_roots(x^3-1,7); % {1,2,4}
  30. m_roots(x^3-x,7); % {0,1,6}
  31. m_roots((x-1)*(x-2)*(x-3),7); % {1,2,3}
  32. m_roots((x-1)*(x-2)*(x^3-1)*(x-5),7); % {1,2,4,5}
  33. m_roots((x-1)*(x-2)*(x^3-1)*(x-5),1009); % {1,2,5,374,634}
  34. m_roots((x-1)*(x-2)*(x^3-1)*(x-5),1000);
  35. length ws; % 35
  36. end;