solve8quadratic: solves a degree two polynomial

Description Usage Arguments Details Value Examples

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
2
 
  solve8quadratic(y,ky,kx2,kx,kk,dx=NULL,x0=NULL,monitor=rbsa0$monitor$v) 

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.

monitor

List of constants indicating the monitoring choices, see the rbsa0$monitor$v provided object as an example.

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) 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
 
  solve8quadratic(1:10, 1,1,0,-20); 
  solve8quadratic(   3,-1,1,1,  1); 
  solve8quadratic(   3,-1,1,1,  1,c(0.5,1.5)); 


Search within the rbsa package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.