| |
 |
|
|
Science Groups Forum Index » Math - Symbolic Math » System of recurrence relations
Page 1 of 1
|
| Author |
Message |
| Guest |
Posted: Sat Mar 24, 2007 10:44 pm |
|
|
|
|
I'm trying to figure out how to make a computer reduce a system of
recurrence relations. I've been looking at maxima because that's all I
have, but I haven't figured it out yet. If someone knows how to do
this with Mathmatica, Maple or anything else I would appreciate that
as well. For example given:
a[n] = 2a[n-1] + 3b[n-1], a[0] = 1
b[n] = a[n-1] + 3b[n-1], a[0] = 0
I want it to give me (solved by hand):
a[n] = 5a[n-1] - 3a[n-2], a[0] = 1, a[1] = 2
I just want to reduce it to one function. Yes, it is easy to do this
example by hand, but for larger systems it becomes tedious and error-
prone to keep track of all the details. I've solved a couple largish
ones by hand, but I'd prefer not to do it again. Thanks for the help!
-----Jay |
|
|
| Back to top |
|
| G. A. Edgar |
Posted: Sun Mar 25, 2007 12:05 am |
|
|
|
Guest
|
In article <1174771192.340805.25020@l77g2000hsb.googlegroups.com>,
<horndude77@gmail.com> wrote:
Quote: I'm trying to figure out how to make a computer reduce a system of
recurrence relations. I've been looking at maxima because that's all I
have, but I haven't figured it out yet. If someone knows how to do
this with Mathmatica, Maple or anything else I would appreciate that
as well. For example given:
a[n] = 2a[n-1] + 3b[n-1], a[0] = 1
b[n] = a[n-1] + 3b[n-1], a[0] = 0
I want it to give me (solved by hand):
a[n] = 5a[n-1] - 3a[n-2], a[0] = 1, a[1] = 2
I just want to reduce it to one function. Yes, it is easy to do this
example by hand, but for larger systems it becomes tedious and error-
prone to keep track of all the details. I've solved a couple largish
ones by hand, but I'd prefer not to do it again. Thanks for the help!
-----Jay
You can use matrices for this. If A(n) is the column matrix
[a[n];b[n]] and T is the matrix [2,3;1,3],
then your two equations become the one matrix equation
A(n) = T A(n-1) .
The result you want to get is basically the characteristic
equation for the matrix T.
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/ |
|
|
| Back to top |
|
| Nasser Abbasi |
Posted: Sun Mar 25, 2007 4:08 am |
|
|
|
Guest
|
<horndude77@gmail.com> wrote in message
news:1174781627.191102.113370@n76g2000hsh.googlegroups.com...
Quote: Thanks you so much. That is exactly what I've been looking for. This
may sound dumb, but I hadn't heard of a characteristic equation of a
matrix before so thanks. It worked perfectly for some bigger systems.
I have more stuff to read about now. Thanks!
The charaterstic equation of a matrix is a very importrant object.
By taking the determinant of A-x*I where I is the unit matrix, and x is
parameter (usually written as lambda, but here it is easier to write x), and
setting this determinant to zero, you will get a polynomial or an equation
in x. This polynomial is called the Charaterstic equation (or polynomial)
of the matrix A. It is a poly in lambda.
The roots of this polynomial are the eigenvalues of the matrix.
In Maple, you can see this polynomial using the command
CharatersticPolynomial
Quote: with(LinearAlgebra):
A:=Matrix([[1,2],[3,4]]);
[1 2]
A := [ ]
[3 4]
Quote: CharacteristicPolynomial(A,x);
2
-2 + x - 5 x
Quote: solve(%=0,x);
1/2 1/2
33 33
5/2 + -----, 5/2 - -----
2 2
Quote: Eigenvalues(A);
[ 1/2]
[ 33 ]
[5/2 + -----]
[ 2 ]
[ ]
[ 1/2]
[ 33 ]
[5/2 - -----]
[ 2 ]
you see they are the same.
knowing how to find eigenvalues and corresponding eigenvectors of a matrix,
and most importantly, what they really mean physically and geometrically is
one of the corner stones of linear algebra.
hth
Nasser |
|
|
| Back to top |
|
| Guest |
Posted: Sun Mar 25, 2007 4:08 am |
|
|
|
|
Thanks you so much. That is exactly what I've been looking for. This
may sound dumb, but I hadn't heard of a characteristic equation of a
matrix before so thanks. It worked perfectly for some bigger systems.
I have more stuff to read about now. Thanks!
-----Jay
On Mar 24, 4:12 pm, "G. A. Edgar" <e...@math.ohio-state.edu.invalid>
wrote:
Quote: In article <1174771192.340805.25...@l77g2000hsb.googlegroups.com>,
horndud...@gmail.com> wrote:
I'm trying to figure out how to make a computer reduce a system of
recurrence relations. I've been looking at maxima because that's all I
have, but I haven't figured it out yet. If someone knows how to do
this with Mathmatica, Maple or anything else I would appreciate that
as well. For example given:
a[n] = 2a[n-1] + 3b[n-1], a[0] = 1
b[n] = a[n-1] + 3b[n-1], a[0] = 0
I want it to give me (solved by hand):
a[n] = 5a[n-1] - 3a[n-2], a[0] = 1, a[1] = 2
I just want to reduce it to one function. Yes, it is easy to do this
example by hand, but for larger systems it becomes tedious and error-
prone to keep track of all the details. I've solved a couple largish
ones by hand, but I'd prefer not to do it again. Thanks for the help!
-----Jay
You can use matrices for this. If A(n) is the column matrix
[a[n];b[n]] and T is the matrix [2,3;1,3],
then your two equations become the one matrix equation
A(n) = T A(n-1) .
The result you want to get is basically the characteristic
equation for the matrix T.
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/ |
|
|
| Back to top |
|
| Guest |
Posted: Sun Mar 25, 2007 8:07 am |
|
|
|
|
Thanks for this explanation. I have another question about the
characteristic equation. How do you know if it is minimal? let me
explain. Here is a system of recurrence relations:
a[n] = b[n-1] + c[n-1]
b[n] = d[n-1] + e[n-1]
c[n] = f[n-1] + a[n-1]
d[n] = g[n-1] + c[n-1]
e[n] = h[n-1]
f[n] = c[n-1]
g[n] = a[n-1]
h[n] = i[n-1] + a[n-1]
i[n] = j[n-1]
j[n] = e[n-1]
Here is its associated matrix:
[
[0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0,
0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
]
I solve for the characteristic equation and get this:
x^10 - 2x^8 - 4x^6 + 4x^4 +2x^2 - 1 = 0
which I can change back into a recurrence relation:
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
When I solved this by hand I got this answer:
a[n] = a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
These two equations are equivalent (but one is longer):
a[n] - a[n-2] =
a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
- a[n-4] - 5a[n-6] - a[n-8] + a[n-10]
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
So my question is how do I know if the characteristic equation is
minimal (sorry if I'm not using the correct terminology)? How to I
make sure I get the minimal characteristic equation? If these are
simple questions just tell me to go read a linear algebra book (which
I plan to do anyways). Thanks again!
-----Jay
On Mar 24, 7:47 pm, "Nasser Abbasi" <n...@12000.org> wrote:
Quote: horndud...@gmail.com> wrote in message
news:1174781627.191102.113370@n76g2000hsh.googlegroups.com...
Thanks you so much. That is exactly what I've been looking for. This
may sound dumb, but I hadn't heard of a characteristic equation of a
matrix before so thanks. It worked perfectly for some bigger systems.
I have more stuff to read about now. Thanks!
The charaterstic equation of a matrix is a very importrant object.
By taking the determinant of A-x*I where I is the unit matrix, and x is
parameter (usually written as lambda, but here it is easier to write x), and
setting this determinant to zero, you will get a polynomial or an equation
in x. This polynomial is called the Charaterstic equation (or polynomial)
of the matrix A. It is a poly in lambda.
The roots of this polynomial are the eigenvalues of the matrix.
In Maple, you can see this polynomial using the command
CharatersticPolynomial
with(LinearAlgebra):
A:=Matrix([[1,2],[3,4]]);
[1 2]
A := [ ]
[3 4]
CharacteristicPolynomial(A,x);
2
-2 + x - 5 x> solve(%=0,x);
1/2 1/2
33 33
5/2 + -----, 5/2 - -----
2 2
Eigenvalues(A);
[ 1/2]
[ 33 ]
[5/2 + -----]
[ 2 ]
[ ]
[ 1/2]
[ 33 ]
[5/2 - -----]
[ 2 ]
you see they are the same.
knowing how to find eigenvalues and corresponding eigenvectors of a matrix,
and most importantly, what they really mean physically and geometrically is
one of the corner stones of linear algebra.
hth
Nasser |
|
|
| Back to top |
|
| Peter Pein |
Posted: Sun Mar 25, 2007 8:07 am |
|
|
|
Guest
|
horndude77@gmail.com schrieb:
Quote: Thanks for this explanation. I have another question about the
characteristic equation. How do you know if it is minimal? let me
explain. Here is a system of recurrence relations:
a[n] = b[n-1] + c[n-1]
b[n] = d[n-1] + e[n-1]
c[n] = f[n-1] + a[n-1]
d[n] = g[n-1] + c[n-1]
e[n] = h[n-1]
f[n] = c[n-1]
g[n] = a[n-1]
h[n] = i[n-1] + a[n-1]
i[n] = j[n-1]
j[n] = e[n-1]
Here is its associated matrix:
[
[0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0,
0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
]
I solve for the characteristic equation and get this:
x^10 - 2x^8 - 4x^6 + 4x^4 +2x^2 - 1 = 0
which I can change back into a recurrence relation:
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
When I solved this by hand I got this answer:
a[n] = a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
These two equations are equivalent (but one is longer):
a[n] - a[n-2] =
a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
- a[n-4] - 5a[n-6] - a[n-8] + a[n-10]
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
So my question is how do I know if the characteristic equation is
minimal (sorry if I'm not using the correct terminology)? How to I
make sure I get the minimal characteristic equation? If these are
simple questions just tell me to go read a linear algebra book (which
I plan to do anyways). Thanks again!
-----Jay
does
factor(x^10-2*x^8-4*x^6+4*x^4+2*x^2-1);
(x - 1) (x + 1) (x^8 - x^6 - 5 x^2 - x + 1)
ring a bell ?  |
|
|
| Back to top |
|
| Nasser Abbasi |
Posted: Sun Mar 25, 2007 8:08 am |
|
|
|
Guest
|
<horndude77@gmail.com> wrote in message
news:1174798757.480169.12590@n76g2000hsh.googlegroups.com...
Quote: Thanks for this explanation. I have another question about the
characteristic equation. How do you know if it is minimal?
CharacteristicPolynomial(A,x);
2
-2 + x - 5 x
Quote: MinimalPolynomial(A,x);
2
-2 + x - 5 x
so it is minimal, easy with Maple, right? :)
Nasser
Quote: let me
explain. Here is a system of recurrence relations:
a[n] = b[n-1] + c[n-1]
b[n] = d[n-1] + e[n-1]
c[n] = f[n-1] + a[n-1]
d[n] = g[n-1] + c[n-1]
e[n] = h[n-1]
f[n] = c[n-1]
g[n] = a[n-1]
h[n] = i[n-1] + a[n-1]
i[n] = j[n-1]
j[n] = e[n-1]
Here is its associated matrix:
[
[0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0,
0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
]
I solve for the characteristic equation and get this:
x^10 - 2x^8 - 4x^6 + 4x^4 +2x^2 - 1 = 0
which I can change back into a recurrence relation:
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
When I solved this by hand I got this answer:
a[n] = a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
These two equations are equivalent (but one is longer):
a[n] - a[n-2] =
a[n-2] + 5a[n-4] + a[n-6] - a[n-8]
- a[n-4] - 5a[n-6] - a[n-8] + a[n-10]
a[n] = 2a[n-2] + 4a[n-4] - 4a[n-6] - 2a[n-8] + a[n-10]
So my question is how do I know if the characteristic equation is
minimal (sorry if I'm not using the correct terminology)? How to I
make sure I get the minimal characteristic equation? If these are
simple questions just tell me to go read a linear algebra book (which
I plan to do anyways). Thanks again!
-----Jay
MinimalPolynomial(A,x);
2
-2 + x - 5 x
Quote: On Mar 24, 7:47 pm, "Nasser Abbasi" <n...@12000.org> wrote:
horndud...@gmail.com> wrote in message
news:1174781627.191102.113370@n76g2000hsh.googlegroups.com...
Thanks you so much. That is exactly what I've been looking for. This
may sound dumb, but I hadn't heard of a characteristic equation of a
matrix before so thanks. It worked perfectly for some bigger systems.
I have more stuff to read about now. Thanks!
The charaterstic equation of a matrix is a very importrant object.
By taking the determinant of A-x*I where I is the unit matrix, and x
is
parameter (usually written as lambda, but here it is easier to write x),
and
setting this determinant to zero, you will get a polynomial or an
equation
in x. This polynomial is called the Charaterstic equation (or
polynomial)
of the matrix A. It is a poly in lambda.
The roots of this polynomial are the eigenvalues of the matrix.
In Maple, you can see this polynomial using the command
CharatersticPolynomial
with(LinearAlgebra):
A:=Matrix([[1,2],[3,4]]);
[1 2]
A := [ ]
[3 4]
CharacteristicPolynomial(A,x);
2
-2 + x - 5 x> solve(%=0,x);
1/2 1/2
33 33
5/2 + -----, 5/2 - -----
2 2
Eigenvalues(A);
[ 1/2]
[ 33 ]
[5/2 + -----]
[ 2 ]
[ ]
[ 1/2]
[ 33 ]
[5/2 - -----]
[ 2 ]
you see they are the same.
knowing how to find eigenvalues and corresponding eigenvectors of a
matrix,
and most importantly, what they really mean physically and geometrically
is
one of the corner stones of linear algebra.
hth
Nasser
|
|
|
| Back to top |
|
| Dana |
Posted: Sun Mar 25, 2007 4:06 pm |
|
|
|
Guest
|
Quote: a[n] = 2a[n-1] + 3b[n-1], a[0] = 1
b[n] = a[n-1] + 3b[n-1], a[0] = 0
...how to do this with Mathmatica
Hi. I will assume that a[0] can't be both 1 & 0, and that it was a typo.
Perhaps you meant b[0] = 0 for the second one.
In Mathematica (5.2)
equ =
{
a[n] == 2*a[n - 1] + 3*b[n - 1],
b[n] == a[n - 1] + 3*b[n - 1],
a[0] == 1,
b[0] == 0
};
RSolve[equ, {a[n], b[n]}, n]
a[n] -> (2^(-1 - 2*n)*((10 - 2*Sqrt[13])^n*
(1 + Sqrt[13]) + (-1 + Sqrt[13])*
(2*(5 + Sqrt[13]))^n))/Sqrt[13],
b[n] -> (-((1/2)*(5 - Sqrt[13]))^n +
((1/2)*(5 + Sqrt[13]))^n)/Sqrt[13]}
--
HTH
Dana DeLouis
<horndude77@gmail.com> wrote in message
news:1174771192.340805.25020@l77g2000hsb.googlegroups.com...
Quote: I'm trying to figure out how to make a computer reduce a system of
recurrence relations. I've been looking at maxima because that's all I
have, but I haven't figured it out yet. If someone knows how to do
this with Mathmatica, Maple or anything else I would appreciate that
as well. For example given:
a[n] = 2a[n-1] + 3b[n-1], a[0] = 1
b[n] = a[n-1] + 3b[n-1], a[0] = 0
I want it to give me (solved by hand):
a[n] = 5a[n-1] - 3a[n-2], a[0] = 1, a[1] = 2
I just want to reduce it to one function. Yes, it is easy to do this
example by hand, but for larger systems it becomes tedious and error-
prone to keep track of all the details. I've solved a couple largish
ones by hand, but I'd prefer not to do it again. Thanks for the help!
-----Jay
|
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT
The time now is Fri Mar 12, 2010 11:50 pm
|
|
|