# solve2degree: solves a 'generalized' degree two polynomial In rbsb: set of ancillary functions

## Description

This function returns the root (or two roots) of the equation `ky*y + kx2*x^2 + kx*x + kk = 0`. When `dx` is not null, it is supposed to give the interval where the root lies, in that case only one root is returned.
The first parameter can be a vector of any length and all computations are vectorized.
Only real roots are considered.

## Usage

 `1` ```solve2degree(y, ky, kx2, kx, kk, dx=NULL, x0=NULL) ```

## Arguments

 `y` Vector of values for which the equation must be satisfied. `ky` Coefficient for `y`. `kx2` Coefficient for `x^2`. `kx` Coefficient for `x`. `kk` Constant coefficient. `dx` `NULL` or the interval (`numeric(2)`) for the roots. `x0` `NULL` or a proposal in case of indetermination.

## Details

When `dx` is defined only one root is returned, belonging to the interval; if it is not possible (root(s) exist(s) and do(es) not comply, then a fatal error is issued.
When every real number complies with the equation, according to available arguments, the returning value is `x0`, `mean(dx)` or `0`. When `is.null(dx)` either one or two roots is returned with `NA` when the solution is complex.

## Value

A matrix having one or two columns according to the values of `ky,kx2,kx,kk,dx`.

## Examples

 ```1 2 3 4``` ``` rbsb3k("RESET"); # for R checking compliance (useless) solve2degree(1:10, 1, 1, 0, -20); solve2degree( 3, -1, 1, 1, 1); solve2degree( 3, -1, 1, 1, 1, c(0.5, 1.5)); ```

rbsb documentation built on May 31, 2017, 1:45 a.m.