Exemple #1
0
        /// <summary>
        /// Gets the root value of a nonlinear equation.
        /// </summary>
        /// <param name="function">Continuous function delegate</param>
        /// <param name="a">Start of line</param>
        /// <param name="b">End of line</param>
        /// <returns>float precision floating point number</returns>
        public Complex32 Compute(IComplex function, Complex32 a, Complex32 b)
        {
            // chose method of nonlinear
            switch (method)
            {
            case Method.Chord:
                return(Nonlinear.chord(function, a, b, this.eps));

            case Method.FalsePosition:
                return(Nonlinear.falpo(function, a, b, this.eps));

            default:
                return(Nonlinear.secan(function, a, b, this.eps));
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets the root value of a nonlinear equation.
        /// </summary>
        /// <param name="function">Continuous function delegate</param>
        /// <param name="a">Start of line</param>
        /// <param name="b">End of line</param>
        /// <returns>float precision floating point number</returns>
        public float Compute(IFloat function, float a, float b)
        {
            // chose method of nonlinear
            switch (method)
            {
            case Method.Chord:
                return(Nonlinear.chord(function, a, b, this.eps));

            case Method.FalsePosition:
                return(Nonlinear.falpo(function, a, b, this.eps));

            case Method.Secant:
                return(Nonlinear.secan(function, a, b, this.eps));

            default:
                return(Nonlinear.bisec(function, a, b, this.eps));
            }
        }