Learn R Programming

cwhmisc (version 3.0)

solveQeq: Solve linear and quadratic equations.

Description

Compute the solution(s) avoiding cancellation in the real case.

Usage

solveQeq(A, B, C)

Arguments

A, B, C
coefficients in Ax^2 + Bx + C = 0.

Value

  • The solution(s)

Examples

Run this code
solveQeq(0,-1,-1) # -1
  solveQeq(0,-1,0)  # 0
  solveQeq(0,0,0)   # NaN
  solveQeq(1,1,1)   # -0.5-0.866025i, -0.5+0.866025i
  solveQeq(1,-1,1)  #  0.5+0.866025i,  0.5-0.866025i

Run the code above in your browser using DataLab