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

Source code in the potion programming language

horner = (x, coef) :
   result = 0
   coef reverse each (a) :
      result = (result * x) + a
   .
   result
.

horner(3, (-19, 7, -4, 6)) print

  

You may also check:How to resolve the algorithm Empty program step by step in the Oforth programming language
You may also check:How to resolve the algorithm Semordnilap step by step in the Go programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Sort three variables step by step in the Elena programming language
You may also check:How to resolve the algorithm Reverse a string step by step in the Jsish programming language