How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the VBScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the VBScript programming language

Table of Contents

Problem Statement

A fast scheme for evaluating a polynomial such as: when is to arrange the computation as follows: And compute the result from the innermost brackets outwards as in this pseudocode: Task Description Cf. Formal power series

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the VBScript programming language

Source code in the vbscript programming language

Function horners_rule(coefficients,x)
	accumulator = 0
	For i = UBound(coefficients) To 0 Step -1
		accumulator = (accumulator * x) + coefficients(i)
	Next
	horners_rule = accumulator
End Function

WScript.StdOut.WriteLine horners_rule(Array(-19,7,-4,6),3)

  

You may also check:How to resolve the algorithm Kaprekar numbers step by step in the C++ programming language
You may also check:How to resolve the algorithm Program termination step by step in the REBOL programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Unicode variable names step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm DNS query step by step in the Python programming language