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

Source code in the picolisp programming language

(de horner (Coeffs X)
   (let Res 0
      (for C (reverse Coeffs)
         (setq Res (+ C (* X Res))) ) ) )

: (horner (-19.0 7.0 -4.0 6.0) 3.0)
-> 128

  

You may also check:How to resolve the algorithm Sort numbers lexicographically step by step in the J programming language
You may also check:How to resolve the algorithm Modular inverse step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Case-sensitivity of identifiers step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Associative array/Creation step by step in the Wren programming language
You may also check:How to resolve the algorithm Copy a string step by step in the Racket programming language