User Tools

Site Tools


prime:programming:cas-algebra_commands

CAS-Algebra Commands

Return to the Prime Programming Page: Prime Programming Language (PPL)

This section will cover the Algebra commands of the HP Prime. Unless noted, the commands are practically useful only in CAS Mode and in CAS programs. RPN Entry will not be covered in this section.

Examples given in this section is with the CAS Simplify setting set to Maximum. The “Include complex results in variables” option is turned off.

simplify

Simplifies an algebraic or mathematical expression. Useful if the CAS Simplify setting is set to None or Minimum. The simplify command aims for an exact answer.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

simplify(algebraic or mathematical expression)

Examples:

In Radians Mode: simplify( π/6 + ASIN(1/2) ) returns π/3

Simplifying an Algebraic Expression: simplify( x/3 - 3*x/4 + x/2 ) returns x/12

Simplify won't give approximates: simplify( Zeta(3) ) returns Zeta(3)

Access: Toolbox, CAS, 1. Algebra, 1. simplify

See Also: collect, expand, factor, subst, partfrac

collect

Collects like terms in an algebraic expression. A list of algebraic expressions can be included.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

colllect(algebraic expression)

Examples:

A polynomial: collect( (x+1)²+3*x-x² ) returns 2*x²-x+1

Collecting like terms: collect( 2*a+3*b-4*a+5*b ) returns -2*a+8*b

More than one expression: collect( {5*x+3*a-x, 2*(a+x)²-a*x} ) returns [ 3*a+4*x, 2*a²+3*a*x+2*x²]

Access: Toolbox, CAS, 1. Algebra, 2. collect

See Also: simplify, expand, factor

expand

Expands an algebraic expression. Products and powers are expanded, and multiplication and division are distributed.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

expand(algebraic expression)

Examples:

expand( (x+1)^3 ) returns x^3 + 3*x^2 + 3*x + 1

expand( (LN(x)-3*x)² ) returns -6*x*LN(x)+(-3*x)²+LN(x)²

Access: Toolbox, CAS, 1. Algebra, 3. expand

See Also: simplify, collect, factor  

factor

Attempts to factorize an polynomial. If the polynomial cannot be factorized, the original polynomial is returned.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

factor(polynomial)

Examples:

factor( x²+4*x-5 ) returns (x-1)*(x+5)

factor( x²+8*x+5 ) returns (x + -√11 + 4)*(x + √11 + 4)

factor( x²+4*x+5 ) returns x²+4*x+5

Access: Toolbox, CAS, 1. Algebra, 4. factor

See Also: simplify, collect, factor  

subst

Makes a substitution a value for a variable in an algebraic expression. The substitution does not have to be a numerical constant.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

subst(algebraic expression, variable = expression)

Examples:

subst( x^3 - 1, x = 4 ) returns 63

subst( x²-1,x=1/2+a ) returns (4*a²+4*a-3)/4

subst( COS(x)+3,x=ACOS(x) ) returns x+3

Access: Toolbox, CAS, 1. Algebra, 5. subst

See Also: simplify, partfrac  

partfrac

Given a fraction, the partfrac performs partial fraction operation on the fraction. If the fraction is numerical, parfrac simplifies the fraction.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

partfrac(algebraic expression or fraction)

Examples:

partfrac( 15/60 ) returns 1/4

partfrac( (x+2)^3/(x-2) ) returns x²+8*x+28+64/(x-2)

partfrac( (2*x+3)/(a+x) ) returns 2+(-2*x+3)/(x+a)

Access: Toolbox, CAS, 1. Algebra, 6. partfrac

See Also: simplify, subst

Extracting Commands

numer

Returns the numerator of a fraction.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

numer(fraction)

Examples:

numer(8/9) returns 8

numer( x²/LN(x) ) returns x²

Access: Toolbox, CAS, 1. Algebra, 7. Extract, 1. numer

See Also: denom

denom

Returns the denominator of a fraction.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

denom(fraction)

Examples:

denom(8/9) returns 9

denom( x²/LN(x) ) returns LN(x)

Access: Toolbox, CAS, 1. Algebra, 7. Extract, 2. denom

See Also: numer

left and LEFT

There are three uses:

left(equation) returns the left side of the equation.

LEFT(list or vector, number of elements) returns the leftmost elements.

LEFT(string, number of characters) returns the leftmost part of the string.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

Equations: left(equation)

Lists, Vectors, or Strings: LEFT(list or vector or string, number of elements)

Home Mode

Home Mode - Textbook and Algebraic Entry Normal Program Editor

Lists and Vectors: CAS.LEFT(list of vector, number of elements)

String: LEFT(string, number of characters)

Examples: CAS Mode:

left(8+3*x = 1) returns 3*x+8

LEFT({7,8,9}, 2) returns {7, 8}

LEFT([8, 9, 2], 2) returns [8, 9]

LEFT(“abc”, 2) returns “ab”

Access: Toolbox, CAS, 1. Algebra, 7. Extract, 3. left

See Also: right

right and RIGHT

There are three uses:

right(equation) returns the right side of the equation.

RIGHT(list or vector, number of elements) returns the rightmost elements.

RIGHT(string, number of characters) returns the rightmost part of the string.

Syntax

Input:

CAS Mode Program Editor - CAS Programs

Equations: right(equation)

Lists, Vectors, or Strings: RIGHT(list or vector or string, number of elements)

Home Mode

Home Mode - Textbook and Algebraic Entry Normal Program Editor

Lists and Vectors: CAS.right(list of vector, number of elements)

String: RIGHT(string, number of characters)

Examples: CAS Mode:

right(8+3*x = 1) returns 1

RIGHT({7,8,9}, 2) returns {8, 9}

RIGHT([8, 9, 2], 2) returns [9, 2]

RIGHT(“abc”, 2) returns “bc”

Access: Toolbox, CAS, 1. Algebra, 7. Extract, 4. right

See Also: left

Return to the Prime Programming Page: Prime Programming Language (PPL)

prime/programming/cas-algebra_commands.txt · Last modified: 2013/10/30 05:07 by ed314