Learn R Programming

hpa (version 1.0.1)

printPolynomial: Print polynomial given it's degrees and coefficients

Description

This function prints polynomial given it's degrees and coefficients.

Usage

printPolynomial(pol_degrees, pol_coefficients)

Arguments

pol_degrees

non-negative integer vector of polynomial degrees.

pol_coefficients

numeric vector of polynomial coefficients.

Value

This function returns the string which contains polynomial symbolic representation.

Details

Function automatically removes polynomial elements which coefficient are zero and variables which power is zero. Output may contain long coefficients representation as they are not rounded.

Examples

Run this code
# NOT RUN {
##Let's represent polynomial 0.3+0.5x2-x2^2+2x1+1.5x1x2+x1x2^2

pol_degrees <- c(1, 2)
pol_coefficients <- c(0.3, 0.5, -1, 2, 1.5, 1)

printPolynomial(pol_degrees, pol_coefficients)
# }

Run the code above in your browser using DataLab