\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.8 - Number Types

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Functions
Relates Algebraic Extensions
Number Types Reference

##

## Classes
class | CGAL::Root_of_traits< RT >
| For a `RealEmbeddable` `IntegralDomain` `RT`, the class template `Root_of_traits<RT>` associates a type `Root_of_2`, which represents algebraic numbers of degree 2 over `RT`. More...
class | CGAL::Sqrt_extension< NT, ROOT, DifferentExtensionComparable, FilterPredicates >
| An instance of this class represents an extension of the type `NT` by one square root of the type `ROOT`. More...

## Functions
template<typename RT , typename OutputIterator >
OutputIterator | CGAL::compute_roots_of_2 (const RT &a, const RT &b, const RT &c, OutputIterator oit)
| The function `compute_roots_of_2()` solves a univariate polynomial as it is defined by the coefficients given to the function. More...
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_root_of_2 (const RT &a, const RT &b, const RT &c, bool s)
| The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type. More...
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_root_of_2 (RT alpha, RT beta, RT gamma)
| The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type. More...
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_sqrt (const RT &x)
| The function `make_sqrt()` constructs a square root of a given value of type \( RT\). More...

## Function Documentation

template<typename RT , typename OutputIterator >

OutputIterator CGAL::compute_roots_of_2 | ( | const RT & | a,
|  | const RT & | b,
|  | const RT & | c,
|  | OutputIterator | oit
| ) |  |

The function `compute_roots_of_2()` solves a univariate polynomial as it is defined by the coefficients given to the function.

The solutions are written into the given `OutputIterator`. Writes the real roots of the polynomial \( aX^2+bX+c\) into \( oit\) in ascending order.

`OutputIterator` is required to accept `Root_of_traits<RT>::Root_of_2`.

Multiplicities are not reported.

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  \( a\neq0\) or \( b\neq0\).

See Also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_root_of_2()`
  `CGAL::make_sqrt()`
  `CGAL::Sqrt_extension<NT,ROOT>`

`#include <CGAL/Root_of_traits.h>`

template<typename RT >

Root_of_traits<RT>::Root_of_2 CGAL::make_root_of_2 | ( | const RT & | a,
|  | const RT & | b,
|  | const RT & | c,
|  | bool | s
| ) |  |

The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.

Returns the smallest real root of the polynomial \( aX^2+bX+c\) if \( s\) is true, and the largest root is \( s\) is false.

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  The polynomial has at least one real root.

See Also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_sqrt()`
  `CGAL::compute_roots_of_2()`
  `CGAL::Sqrt_extension<NT,ROOT>`

`#include <CGAL/Root_of_traits.h>`

template<typename RT >

Root_of_traits<RT>::Root_of_2 CGAL::make_root_of_2 | ( | RT | alpha,
|  | RT | beta,
|  | RT | gamma
| ) |  |

The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.

Constructs the number \( \alpha+ \beta\sqrt{\gamma}\).

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  \( \gamma\geq0\)

See Also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_sqrt()`
  `CGAL::compute_roots_of_2()`
  `CGAL::Sqrt_extension<NT,ROOT>`

`#include <CGAL/Root_of_traits.h>`

template<typename RT >

Root_of_traits<RT>::Root_of_2 CGAL::make_sqrt | ( | const RT & | x) |  |

The function `make_sqrt()` constructs a square root of a given value of type \( RT\).

Depending on the type \( RT\) the square root may be returned in a new type that can represent algebraic extensions of degree \( 2\).

Returns
  \( \sqrt{x}.\)

Precondition
  `RT` is a `RealEmbeddable` `IntegralDomain`.
  \( x \leq0 \)

See Also
  `RootOf_2`
  `CGAL::make_root_of_2()`
  `CGAL::Root_of_traits<RT>`

`#include <CGAL/Root_of_traits.h>`