carl  24.04
Computer ARithmetic Library
ThomUtil.h
Go to the documentation of this file.
1 /*
2  * File: ThomUtil.h
3  * Author: tobias
4  *
5  * Created on 19. August 2016, 10:48
6  */
7 
8 #pragma once
9 
12 
13 namespace carl {
14 
15 // list of derivatives p^(from), ..., p^(upto) w.r.t. to var (including both from and upto)
16 template<typename Number>
17 std::list<MultivariatePolynomial<Number>> der(const MultivariatePolynomial<Number>& p, Variable::Arg var, uint from, uint upto) {
18  assert(upto <= p.degree(var));
19  std::list<MultivariatePolynomial<Number>> derivatives;
20  if(from > upto) return derivatives; // empty list
22  for(uint i = 0; i < from; i++) from_th = carl::derivative(from_th, var);
23  derivatives.push_back(from_th);
24  for(uint n = from + 1; n <= upto; n++) {
25  derivatives.push_back(carl::derivative(derivatives.back(), var));
26  }
27  return derivatives;
28 }
29 
30 } // namespace carl
31 
carl is the main namespace for the library.
const T & derivative(const T &t, Variable, std::size_t n=1)
Computes the n'th derivative of a number, which is either the number itself (for n = 0) or zero.
Definition: Derivative.h:23
std::uint64_t uint
Definition: numbers.h:16
std::list< MultivariatePolynomial< Number > > der(const MultivariatePolynomial< Number > &p, Variable::Arg var, uint from, uint upto)
Definition: ThomUtil.h:17
A Variable represents an algebraic variable that can be used throughout carl.
Definition: Variable.h:85
std::size_t degree(Variable::Arg var) const
Calculates the degree of this polynomial with respect to the given variable.