source: git/factory/examples/application.cc @ 341696

spielwiese
Last change on this file since 341696 was 341696, checked in by Hans Schönemann <hannes@…>, 14 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4//{{{ docu
5//
6// application.cc - sample Factory application.
7//
8//}}}
9
10#include <factory.h>
11#include <iostream.h>
12
13int
14main()
15{
16    Variable x( 'x' );
17    Variable y( 'y' );
18    Variable z( 'z' );
19    CanonicalForm f;
20    CanonicalForm g;
21
22    cout << "Do not forget to terminate canonical forms with `;' in input!" << endl;
23
24    // set our ring
25    setCharacteristic( 0 );
26    On( SW_RATIONAL );
27
28    cout << "Simple polynomial operations in characteristic 0." << endl;
29    cout << "Please enter two multivariate polynomials over Q." << endl;
30    cout << "f(x, y, z) = ";
31    cin >> f;
32    cout << "g(x, y, z) = ";
33    cin >> g;
34    cout << "f                = " << f << endl;
35    cout << "g                = " << g << endl;
36
37    // call some of Factory's functions and methods and print
38    // their results
39    cout << "Polynomial information on f:" << endl;
40    cout << "mvar(f)          = " << mvar( f ) << endl;
41    cout << "degree(f)        = " << degree( f ) << endl;
42    cout << "degree(f, x)     = " << degree( f, x ) << endl;
43    cout << "degree(f, y)     = " << degree( f, y ) << endl;
44    cout << "degree(f, z)     = " << degree( f, z ) << endl;
45    cout << "LC(f, x)         = " << LC( f, x ) << endl;
46    cout << "LC(f, y)         = " << LC( f, y ) << endl;
47    cout << "LC(f, z)         = " << LC( f, z ) << endl;
48
49    cout << "Arithmetic operators:" << 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              = " << f % g << endl;
55    cout << "f(g, x)          = " << f(g, x) << endl;
56}
Note: See TracBrowser for help on using the repository browser.