#include <iostream>
#include <string>
#include <sstream>
#include "DGtal/math/MPolynomial.h"
#include "DGtal/io/readers/MPolynomialReader.h"
Go to the source code of this file.
|
void | usage (int, char **argv) |
|
int | main (int argc, char **argv) |
|
- Author
- Jacques-Olivier Lachaud (
jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr
) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
- Date
- 2012/02/06
An example file named polynomial-derivative.
This file is part of the DGtal library.
Definition in file polynomial-derivative.cpp.
◆ main()
int main |
( |
int | argc, |
|
|
char ** | argv ) |
Main.
[polynomial-derivative-types]
[polynomial-derivative-types]
[polynomial-derivative-process]
[polynomial-derivative-process]
Definition at line 57 of file polynomial-derivative.cpp.
58{
59 if ( argc < 2 )
60 {
61 usage( argc, argv );
62 return 1;
63 }
64
66 typedef double Ring;
69
71 std::string polynomialString( argv[ 1 ] );
72 std::istringstream polynomialIStream( polynomialString );
73 MyPolynomial P;
74 polynomialIStream >> P;
77 std::cout << "P(X_0) = " << P << std::endl;
78 std::cout << "P'(X_0) = " << P1 << std::endl;
79 std::cout << "P''(X_0) = " << P2 << std::endl;
81 return 0;
82}
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
MPolynomial< n, Ring, Alloc > derivative(const MPolynomial< n, Ring, Alloc > &p)
References DGtal::derivative().
◆ usage()
void usage |
( |
int | , |
|
|
char ** | argv ) |
Definition at line 48 of file polynomial-derivative.cpp.
49{
50 std::cerr << "Usage: " << argv[ 0 ] << " <P>" << std::endl;
51 std::cerr << "\t - computes the first and second derivative of the given polynomial P (in one variable)." << std::endl;
52}