genfunc
rgf_simp
simplify an expression involving a rational generating function sequence
Calling Sequence
Parameters
Description
Examples
rgf_simp(expr, Fz, z, F, n, options)
expr
-
expression to simplify
Fz
rational generating function
z
name, generating function variable
F
name of function encoded by Fz
n
name, index variable of F
options
optional arguments
This function simplifies occurrences of sequence F in expr. If F is defined by an order k recurrence then all occurrences of F whose index differs from n by an integer amount are simplified to expressions involving F⁡n,...,F⁡n−k+1.
The function name argument F can have a parameter of the form a⁢n+b, where a is a positive integer and b is an integer. This pattern represents the index of the nth term in the sequence. Simplification will be done relative to the nth occurrence of this pattern. If the pattern is invalid or does not match any sequence occurrence in the expression, the unmodified expression is returned. The defaults are a=1 and b=0.
The simplified expression is expanded and the coefficients of F⁡a⁢n+b,...,Fa⁢n−k+1+b are collected.
A procedure may be passed as an optional argument and is applied to each coefficient of the collected result.
An expression may be passed as an optional argument. Occurrences of F are matched against the pattern to determine a value for n. If this value for n differs from the optional argument by an integer amount, the term is simplified relative to the expression.
The command with(genfunc,rgf_simp) allows the use of the abbreviated form of this command.
with⁡genfunc:
Fz≔z1−z−z2:
ex≔n2⁢F⁡n+1+n2+1⁢F⁡n+n2−2⁢n⁢F⁡n−1+n+32⁢F⁡n−2
rgf_simp⁡ex,Fz,z,F,n
3⁢n2+6⁢n+10⁢F⁡n+n2−8⁢n−9⁢F⁡n−1
rgf_simp⁡ex,Fz,z,F,n,n−1
3⁢n2+6⁢n+10⁢F⁡n−2+4⁢n2−2⁢n+1⁢F⁡n−1
rgf_simp⁡ex,Fz,z,F,n,n+1
n2−8⁢n−9⁢F⁡n+1+2⁢n2+14⁢n+19⁢F⁡n
rgf_simp⁡ex,Fz,z,F,n,n+1,factor
n+1⁢n−9⁢F⁡n+1+2⁢n2+14⁢n+19⁢F⁡n
Fz≔1−z+z21−4⁢z−z2:
rgf_simp⁡F⁡3⁢n−2+F⁡3⁢n−11,Fz,z,F⁡3⁢n−2,n
−3⁢F⁡3⁢n−2+17⁢F⁡3⁢n−5
rgf_simp⁡,Fz,z,F⁡3⁢n−2,n,n+1
−71⁢F⁡3⁢n−2+17⁢F⁡3⁢n+1
rgf_simp⁡F⁡3⁢k⁢m−11,Fz,z,F⁡3⁢n−2,n,k⁢m
17⁢F⁡3⁢k⁢m−5−4⁢F⁡3⁢k⁢m−2
See Also
collect
Download Help Document