How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the BBC BASIC 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 BBC BASIC 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 BBC BASIC programming language

Source code in the bbc programming language

      DIM coefficients(3)
      coefficients() = -19, 7, -4, 6
      PRINT FNhorner(coefficients(), 3)
      END
      
      DEF FNhorner(coeffs(), x)
      LOCAL i%, v
      FOR i% = DIM(coeffs(), 1) TO 0 STEP -1
        v = v * x + coeffs(i%)
      NEXT
      = v


  

You may also check:How to resolve the algorithm Sum and product of an array step by step in the GAP programming language
You may also check:How to resolve the algorithm GUI/Maximum window dimensions step by step in the Java programming language
You may also check:How to resolve the algorithm Longest string challenge step by step in the C programming language
You may also check:How to resolve the algorithm CSV data manipulation step by step in the Ursa programming language
You may also check:How to resolve the algorithm Draw a sphere step by step in the Scala programming language