source: git/factory/examples/application.cc @ 362fc67

spielwiese
Last change on this file since 362fc67 was 362fc67, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3//{{{ docu
4//
5// application.cc - sample Factory application.
6//
7//}}}
8
9#include <factory.h>
10#include <iostream.h>
11
12int
13main()
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    // set our ring
24    setCharacteristic( 0 );
25    On( SW_RATIONAL );
26
27    cout << "Simple polynomial operations in characteristic 0." << endl;
28    cout << "Please enter two multivariate polynomials over Q." << endl;
29    cout << "f(x, y, z) = ";
30    cin >> f;
31    cout << "g(x, y, z) = ";
32    cin >> g;
33    cout << "f                = " << f << endl;
34    cout << "g                = " << g << endl;
35
36    // call some of Factory's functions and methods and print
37    // their results
38    cout << "Polynomial information on f:" << endl;
39    cout << "mvar(f)          = " << mvar( f ) << endl;
40    cout << "degree(f)        = " << degree( f ) << endl;
41    cout << "degree(f, x)     = " << degree( f, x ) << endl;
42    cout << "degree(f, y)     = " << degree( f, y ) << endl;
43    cout << "degree(f, z)     = " << degree( f, z ) << endl;
44    cout << "LC(f, x)         = " << LC( f, x ) << endl;
45    cout << "LC(f, y)         = " << LC( f, y ) << endl;
46    cout << "LC(f, z)         = " << LC( f, z ) << endl;
47
48    cout << "Arithmetic operators:" << endl;
49    cout << "f+g              = " << f + g << endl;
50    cout << "f-g              = " << f - g << endl;
51    cout << "f*g              = " << f * g << endl;
52    cout << "f/g              = " << f / g << endl;
53    cout << "f%g              = " << f % g << endl;
54    cout << "f(g, x)          = " << f(g, x) << endl;
55}
Note: See TracBrowser for help on using the repository browser.