**HP Prime: Basic CAS Commands for Polynomials and Rational Expressions**

Define the following variables:

poly: a polynomial of
the form a_n*x^n + a_n-1*x^(n-1) + …. + a_1*x + a_0

rat: a rational
function consisting of the polynomials p(x)/q(x)

var: variable

**Simplification Modes**

Before we start, I want to comment on simplification modes.

Simplification Modes:

None: No
simplification is executed

Minimum: Simple simplification
of results. Additional simplification
may be desired.

Maximum: Full
simplification of results

Below is a comparison between Minimum and Maximum modes.

To change Simplification mode, press [Shift], [CAS] (CAS
Settings), and select a Simplification settings. Select the Simplification drop down box and
select the desired mode.

Note: The following
examples are executed in Maximum simplification mode.

**Part Extraction: Coefficients, Numerator, Denominator**

**Coefficients**

coef: [Toolbox],
(CAS), 6. Polynomial, 2. Coefficients

Syntax:

coef(poly, var):
returns all the coefficients of a polynomial in a vector

coef(poly, var, n): return the coefficient of a polynomial
in a vector of the specific power x^n

Examples:

coef(2x^2 + 3x – 1, x) returns [2, 3, -1]

coef(2x^2 + 3x – 1, x, 2) returns 2

coef(2x^2 + 3x – 1, x, 1) returns 3

coef(2x^2 + 3x – 1, x, 0) returns -1

Numerator and Denominator

numer: [Toolbox], (CAS), 1. Algebra, 8. Extract, 1. Numerator

denom: [Toolbox], (CAS), 1. Algebra, 8. Extract, 2.
Denominator

Syntax:

numer(rat)

denom(rat)

Example:

f≔(2x^2-3)/(x^2+1)

numer(f) returns 2*x^2 – 3

denom(f) returns x^2 + 1

purge(f) \\ this is to erase f

**Polynomial Creation**

Create a symbolic polynomial with a list of coefficients

poly2symb: [Toolbox], (CAS), 6. Polynomial, 7. Create, 2. Coefs→Poly

Syntax:

poly2symb(vector of coefficients, var)

Example:

poly2symb( [8, -1, 0, 6], t) returns 8*t^3 – t^2 + 6

The inverse operation is the symb2poly(poly), which can be
accessed by [Toolbox], (CAS), 6. Polynomial, 7. Create, 1. Poly→Create.

Create a polynomial from a list of roots

This involves a two-step processes:

1. pcoeff( vector of roots )

2. poly2symb( result from step 1, var )

Access pcoeff: [Toolbox], (CAS), 6. Polynomial, 7. Create,
3. Roots → Coef

You can combine the two steps by typing: poly2symb(pcoeff( vector of roots), var). Simplification may be required

Example:

pcoeff([-2, 5, 0, 6]) returns [1, -9, 8, 60, 0]

poly2symb([1, -9, 8, 60, 0],t) returns t^4 – 9*t^3 +8*t^2 +
60*t

poly2symb( pcoeff([2, -5, 0, 6]), t) returns

t^4 – 9*t^3 +
8*t^2 + 60*t

**Degree of a Polynomial**

degree: [Toolbox], (CAS), 6, Polynomial, 8. Algebra, 3.
Degree

Syntax:

degree(poly)

Example:

f: = 4*x^3 – 2*x^2 + 8*x – 8

degree(f) returns 3

You can factor a polynomial by x^n where n is the degree of
the polynomial by using factor_xn.

factor_xn: [Toolbox],
(CAS), 6. Polynomial, 8. Algebra, 4. Factor By Degree

Caution: This command
works when the Simplification mode is turned to Minimum or Off.

Example:

(after turning Simplification to Minimum)

factor_xn(f) returns x^3 * (4 – 2/x + 8/x^2 – 8/x^3)

purge(f)

**Partial Fraction of Rational Functions**

partfrac: [Toolbox], (CAS), 1. Algebra, 7. Partial Fraction

Syntax:

partfrac(rat)

Example:

partfrac( (x^4 – 3*x^3)/(x^2 -1) ) returns

x^2
-3*x + 1 - 1/(x-1) - 2/(x+1)

**Determining the Number of Zeros (Roots)**

The sturmab command determines the number of zeros giving an
interval.

sturmab: [Toolbox],
(CAS), 6. Polynomial, 8. Algebra, 6.
Zero Count

Syntax:

sturmab(poly, var, min, max)

The min and max can be complex numbers.

Examples:

sturmab(x^3 – 4*x^2 + 6*x – 4, x, -5, 5) returns 1 \\ 1 real root

sturmab(x^3 – 4*x^2 + 6*x – 4, x, -5-5*i, 5+5*i) returns 3 \\ 1 real, 2 complex roots

Polynomial Functions

Path: [Toolbox], (CAS), 6, Polynomial, 9. Special, then:

4. Hermite \\
Syntax: hermite(n)

7. Legendre \\
Syntax: legendre(n)

8. Chebyshev Tn (1

^{st}Kind) \\ Syntax: tchebyshev1(n)
9. Chebyshev Un (2

^{nd}Kind) \\ Syntax: tchebyshev2(n)
Where n is an integer.
You can specify a variable by adding var as a second argument. (x is the
default variable)

Examples:

hermite(4) returns 16*x^4 – 48*x^2 + 12

legendre(4) returns (35*x^4 – 30*x^3 + 3)/8

tchebyshev1(4) returns 8*x^4 – 8*x^2 + 1

tchebyshev2(4) returns 16*x^4 – 12*x^2 + 1

This covers some of the basic CAS commands for polynomials
and rational functions. Hope you find
this helpful,

Eddie

This blog is property of Edward Shore, 2016.

‘

Really i am impressed from this post....the person who created this post is a genius and knows how to keep the readers connected..

ReplyDeleteHP Printer Phone Number

Thank you. It is very useful.

ReplyDeleteThank you!

ReplyDelete