jengelh-datetimespielwiese
Last change
on this file since 11b11d was
11b11d,
checked in by Jens Schmidt <schmidt@…>, 26 years ago
|
Initial revision
git-svn-id: file:///usr/local/Singular/svn/trunk@849 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id: gcd.cc,v 1.1 1997-10-27 16:41:16 schmidt Exp $ */ |
---|
3 | |
---|
4 | //{{{ docu |
---|
5 | // |
---|
6 | // gcd.cc - sample Factory application. |
---|
7 | // |
---|
8 | //}}} |
---|
9 | |
---|
10 | #include <factory.h> |
---|
11 | |
---|
12 | int |
---|
13 | main() |
---|
14 | { |
---|
15 | Variable x( 'x' ); |
---|
16 | Variable y( 'y' ); |
---|
17 | Variable z( 'z' ); |
---|
18 | CanonicalForm f; |
---|
19 | CanonicalForm g; |
---|
20 | |
---|
21 | cout << "Do not forget to terminate canonical forms with `;' in input!" << endl; |
---|
22 | |
---|
23 | setCharacteristic( 0 ); |
---|
24 | On( SW_USE_EZGCD ); |
---|
25 | On( SW_RATIONAL ); |
---|
26 | cout << "Multivariate gcd calculation in characteristic 0." << endl; |
---|
27 | cout << "Please enter two multivariate polynomials over Q." << endl; |
---|
28 | cout << "f(x, y, z) = "; |
---|
29 | cin >> f; |
---|
30 | cout << "g(x, y, z) = "; |
---|
31 | cin >> g; |
---|
32 | cout << "f = " << f << endl; |
---|
33 | cout << "g = " << g << endl; |
---|
34 | cout << "gcd(f, g) = " << gcd( f, g ) << endl << endl; |
---|
35 | |
---|
36 | setCharacteristic( 29 ); |
---|
37 | cout << "Multivariate gcd calculation in GF(29)." << endl; |
---|
38 | cout << "Please enter two multivariate polynomials over GF(29)." << endl; |
---|
39 | cout << "f(x, y, z) = "; |
---|
40 | cin >> f; |
---|
41 | cout << "g(x, y, z) = "; |
---|
42 | cin >> g; |
---|
43 | cout << "f (mod 29) = " << f << endl; |
---|
44 | cout << "g (mod 29) = " << g << endl; |
---|
45 | cout << "gcd(f, g) (mod 29) = " << gcd( f, g ) << endl; |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.