source: git/factory/ftest/deriv.m4 @ b1dfaf

spielwiese
Last change on this file since b1dfaf 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.2 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4ftestSetNameOfGame( deriv, `"
5Usage: deriv [<options>] [<envSpec>] <f> [<x>]
6  calculates df/dx or derivation of canonical form <f> with
7  respect to main variable if variable <x> is not specified.
8"'`' )
9
10//{{{ docu
11//
12// ftestAlgorithm.m4 - ftestAlgorithm test program.
13//
14// To create ftestAlgorithm.cc, run m4 using the ftest_util.m4 library in
15// the following way:
16//
17// m4 ftest_util.m4 ftestAlgorithm.m4 > ftestAlgorithm.cc
18//
19//}}}
20
21ftestPreprocInit();
22
23ftestGlobalInit();
24
25//
26// - main program.
27//
28int
29main ( int argc, char ** argv )
30{
31    // initialization
32    ftestMainInit();
33
34    // declare input and output variables
35    ftestOutVar( CanonicalForm, result );
36    ftestInVar( CanonicalForm, f );
37    ftestInVar( Variable, x );
38
39    // process argument list and set environment
40    ftestGetOpts();
41    ftestGetEnv();
42    ftestGetInVar( f );
43    ftestGetInVar( x, Variable() );
44
45    // do the test!
46    if ( ftestArgGiven( x ) ) {
47        ftestRun( result = f.deriv( x ); );
48    } else {
49        ftestRun( result = f.deriv(); );
50    }
51
52    // print results
53    if ( ftestArgGiven( x ) ) {
54        ftestOutput( "df/dx", result );
55    } else {
56        ftestOutput( "df", result );
57    }
58
59    // clean up
60    ftestMainExit();
61}
Note: See TracBrowser for help on using the repository browser.