polynomial

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package polynomial provides a polynomial type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Polynomial

type Polynomial []Term

Polynomial is a single-variable polynomial. Terms are expected (but not required) to be in increasing order of exponent.

func (Polynomial) Degree

func (p Polynomial) Degree() uint

Degree returns the degree of p, namely the highest exponent.

func (Polynomial) Evaluate

func (p Polynomial) Evaluate(x *big.Int) *big.Int

Evaluate p at x.

func (Polynomial) Format

func (p Polynomial) Format(v string) string

Format polynomial as a string, using v to represent the variable.

func (Polynomial) String

func (p Polynomial) String() string

type Term

type Term struct {
	A int64
	N uint
}

Term is the term A*xᴺ in a polynomial.

func (Term) Evaluate

func (t Term) Evaluate(x *big.Int) *big.Int

Evaluate term at x.

func (Term) String

func (t Term) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL