Previous Page Next Page Contents

genpoly -- create a polynomial using the ``b''-adic expansion

Introduction

genpoly(n, b, x) creates a polynomial p in the indeterminate x such that p(b)=n.

Call(s)

genpoly(n, b, x)

Parameters

n - an integer, a polynomial of type DOM_POLY, or a polynomial expression
b - an integer greater than 1
x - the indeterminate: an identifier

Returns

a polynomial if the first argument is a polynomial or an integer. Otherwise, a polynomial expression.

Related Functions

genident, indets, int2text, mods, numlib::g_adic, numeric::lagrange, poly, text2int

Details

Example 1

We create a polynomial p in the indeterminate x such that p(7) = 15. The coefficients of p are between -3 and 3:

>> p := genpoly(15, 7, x)
                            poly(2 x + 1, [x])
>> p(7)
                                    15

Here is an example with a polynomial expression as input:

>> p := genpoly(15*y^2 - 6*y + 3*z, 7, x)
                                         2        2
                        y + 3 z - x y + y  + 2 x y

The return value has the same type as the first argument:

>> p := genpoly(poly(15*y^2 + 8*z, [y, z]), 7, x)
                            2          2
                  poly(2 x y  + x z + y  + z, [x, y, z])

We check the result:

>> p(7, y, z)
                                          2
                                8 z + 15 y

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000