Learn R Programming

SimEvolEnzCons (version 2.0.0)

solv.2dg.polynom: Real solutions of quadratic equation

Description

Computes real solutions of quadratic equation

Usage

solv.2dg.polynom(a_fun,b_fun,c_fun)

Arguments

a_fun

Numeric. The quadratic coefficient applied to x^2

b_fun

Numeric. The linear coefficient applied to x

c_fun

Numeric. The free term

Value

Three possible vectors:

  • Numeric vector of length 2 if there is two real roots

  • Numeric value if there is a double-root

  • NULL if there is no real solution

Details

Quadratic equation is a second-degree polynomial equation of type \(a x^2 + b x + c = 0\), where a is the quadratic coefficient, b the linear coefficient and c the free term.

Examples

Run this code
# NOT RUN {
solv.2dg.polynom(3,2,1)
#result : NULL

solv.2dg.polynom(1,2,1)
#result : -1

solv.2dg.polynom(1,0,-1)
#result : c(1,-1)

# }

Run the code above in your browser using DataLab