Function Math Complex Class

CubicExpr

"Evaluate The Cubic Expression" Evaluates the expression A X^3 + B X^2 + C X + D where A, B, C, D, and X are real and/or complex numbers.

Signature (Visual Basic / VBA)

Public Function CubicExpr( _
      ByVal vA As Variant _
    , ByVal vB As Variant _
    , ByVal vC As Variant _
    , ByVal vD As Variant _
    , ByVal vX As Variant _
    ) As Variant

Code Example

    CubicExpr(-1, -2, -3, 54, 3) = 0
    CubicExpr(-1, -2, -3, 54, 0) = 54
    CubicExpr(2, -3, 4, -5, 6) = 343
    CubicExpr("-2|-1.5", -3, 4, -5, 6) = "-521|-324"

Notes & Version History

vA, vB, vC, vD, and vX The values that are substituted into the cubic expression above. Function returns Null if any of the arguments vA, vB, vC, vD, or vX are Null or cannot be fixed up to real or complex numbers (as defined by the ComplexStringToReals function). Complex numbers are represented within strings as "R|I" where R is the real part and I is the imaginary part.