Question: How to check solutions to a first-order system of differential equations using "Equals"?

The document below is long because I go through the context of my question step-by-step. 

The context is solving a first-order system of differential equations where we have complex eigenvalues.

But essentially, my question has to do with the end of this reasoning. I find four solutions x1, x2, x3, and x4, and I would like to check whether they are indeed solutions by subbing them into the original system x'=Ax.

When we make such a substitution, we get an equation of the form yl=yr, where yl and yr are 4x1 vectors. If the equality is true then we can say we have a solution.

My question is about how to check for this equality. I amusing Maple's "Equals" but this doesn't seem to work for all four solutions.

with(LinearAlgebra)

NULL

I explain the entire reasoning that leads to the final vectors that I compare

NULL

The following matrix has complex eigenvalues 3+`&+-`(4*I), each with multiplicity 2.

 

A := `<,>`(`<|>`(3, -4, 1, 0), `<|>`(4, 3, 0, 1), `<|>`(0, 0, 3, -4), `<|>`(0, 0, 4, 3))

Matrix(%id = 36893488151974184588)

(1)

NULL

Consider the eigenvalue `&lambda;__1` = 3-4*I. The associated eigenvectors are

evec := LinearSolve(A-(3-4*I)*IdentityMatrix(4), `<,>`(0, 0, 0, 0), free = c)

Vector[column](%id = 36893488151974164828)

(2)

We see this gives us only one linearly independent eigenvector.

 

We can find another one by forming a rank 2 generalized eigenvector from one of the eigenvectors above.

 

The pair of such eigenvectors is a chain of generalized eigenvectors of length 2 and they satisfy

 

(A-I*`&lambda;__1`)*w__2 = w__1*(A-I*`&lambda;__1`)*w__1 and w__1*(A-I*`&lambda;__1`)*w__1 = 0

NULL

These equations come from trying the solution w__1*e^(`&lambda;__1`*t) and (t*w__1+w__2)*exp(`&lambda;__1`*t), where w__1 is an eigenvector for `&lambda;__1`.

The equations above lead to

 

(A-I*`&lambda;__1`)^2*w__2 = 0

 

which we can solve for the generalized eigenvector w__2 as follows

NULL

`w__2,gen` := LinearSolve((A-(3-4*I)*IdentityMatrix(4))^2, `<,>`(0, 0, 0, 0), free = c)

Vector[column](%id = 36893488151974138212)

(3)

One such generalized eigenvector is

 

w__2 := subs({c[2] = I, c[4] = I}, `w__2,gen`)

Vector[column](%id = 36893488151982985812)

(4)

which gives us

 

w__1 := (A-(3-4*I)*IdentityMatrix(4)).w__2

Vector[column](%id = 36893488151982979180)

(5)

which is indeed an eigenvector for `&lambda;__1`.

Thus, we have the two complex solutions

 

s__1 := w__1*exp((3-4*I)*t)

Vector[column](%id = 36893488151982971708)

(6)

s__2 := (t*w__1+w__2)*exp((3-4*I)*t)

Vector[column](%id = 36893488151982963516)

(7)

But we want real solutions.

NULL

x__1 := `assuming`([Re(s__1)], [t > 0])

Vector[column](%id = 36893488151974145788)

(8)

x__2 := `assuming`([Im(s__1)], [t > 0])

Vector[column](%id = 36893488151982991948)

(9)

x__3 := `assuming`([Re(s__2)], [t > 0])

Vector[column](%id = 36893488151982977980)

(10)

x__4 := `assuming`([Im(s__2)], [t > 0])

Vector[column](%id = 36893488151982967252)

(11)

Let's check that each of the vectors above (the real and imaginary parts of our complex solutions) are real solutions.

 

I would like to substitute, say, x__1 into the first order system of differential equations diff(x, x) = Ax.

 

At first I tried simply

NULL

subs({x = x__1}, diff(x, t) = A.x)

0 = Matrix(%id = 36893488151974184588).Vector[column](%id = 36893488151982948468)

(12)

This doesn't work because the diff(x, t) command evaluates to zero before we do the desired substitution.

 

Then I tried

 

subs({x = x__1}, 'diff(x, t)' = A.x)

diff(Vector[column](%id = 36893488151982948468), t) = Matrix(%id = 36893488151974184588).Vector[column](%id = 36893488151982948468)

(13)

 

   

result := eval(subs({x = x__1}, 'diff(x, t)' = A.x))

Vector[column](%id = 36893488151991655348) = Vector[column](%id = 36893488151982967612)

(14)

NULL

NULL

By inspection, it seems the two sides are equal and so x__1 indeed satisfies the system.

 

But how do I get maple to tell me this?

 

evalb(result)

false

(15)

Equal(rhs(result), lhs(result))

true

(16)

Okay, but does this use of Equals always work?

 

sols := [x__1, x__2, x__3, x__4]; for i to 4 do result := eval(subs({x = sols[i]}, 'diff(x, t)' = A.x)); print(simplify(result))*print(Equal(rhs(result), lhs(result))) end do

true

(17)

 

Apparently not.``

 

What is going on here?

It sure looks like the righthand and lefthand sides of each expression are the same.

Download evs_equal.mw

Please Wait...