38#include "DGtal/math/MPolynomial.h"
39#include "DGtal/io/readers/MPolynomialReader.h"
48void usage(
int,
char** argv )
50 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <P(x,y)>" << std::endl;
51 std::cerr <<
"\t - computes the first and second derivatives of the given polynomial P (in two variables)." << std::endl;
57int main(
int argc,
char** argv )
71 std::string polynomialString( argv[ 1 ] );
72 std::istringstream polynomialIStream( polynomialString );
74 polynomialIStream >> P;
81 std::cout <<
"P(X_0,X_1) = " << P << std::endl;
82 std::cout <<
"dP/dX_0(X_0,X_1) = " << P1_0 << std::endl;
83 std::cout <<
"dP/dX_1(X_0,X_1) = " << P0_1 << std::endl;
84 std::cout <<
"d/dX_1 dP/dX_0(X_0,X_1) = " << P1_1 << std::endl;
85 std::cout <<
"d/dX_0 dP/dX_1(X_0,X_1) = " << P1_1b << std::endl;
86 std::cout <<
"d/dX_0 dP/dX_0(X_0,X_1) = " << P2_0 << std::endl;
87 std::cout <<
"d/dX_1 dP/dX_1(X_0,X_1) = " << P0_2 << std::endl;
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
DGtal is the top-level namespace which contains all DGtal functions and types.
MPolynomial< n, Ring, Alloc > derivative(const MPolynomial< n, Ring, Alloc > &p)