## 40 Reputation

8 years, 111 days

## How to solve matrix equation (Lyapunov E...

Maple

Let us assume we have a square matrix \$A\$ with known entries. We know the system is asymptotically stable by inspection of the eigenvalues, hence we know that the Lyapunov equation

A^TP+PA=-Id

will have a symmetric matrix P as a solution with Id being the identity matrix. How can I obtain the entries of the P matrix? I have tried the following code but was not able to solve for the entires of the P matrix.

I would be happy if someone could share a solution to this problem.

```gc();
restart:

with(LinearAlgebra):

A := <<a__11|a__12>,<a__21|a__22>>;
P := <<p__11|p__12>,<p__12|p__22>>;
Id := <<1|0>,<0|1>>;
eqn := Transpose(A).P+P.A = -Id;```

## Transform arbitrary ODE system into firs...

Maple 2015

Imagine we have an ODE system

odeSys := {diff(x(t),t\$2)+diff(x(t),t)+x(t)=f(t),diff(y(t),t\$2)+2*diff(y(t),t)+3*y(t)=g(t)};

It is easy to transform this system into a first order form by hand. But for larger systems, the procedure by hand becomes very error prone. Is there an intelligent way to transform a system of n scalar ODEs (order m) into a first order system? I know that the first order form is not unique. It is only important to reduce the system to a system of first order equations.

## Decompose a given vector x into a produc...

Maple

I have a vector x of this type:

x :=Vector[column]([A__11*u__1+A__12*u__2+...+A__1m*u__m,

A__21*u__1+A__22*u__2+...+A__2m*u__m,

...,

A__n1*u__1+A__n2*u__2+...+A__nm*u__m]);

If I define u:=Vector[column]([u__1,u__2,...,u__m]), then it is clear that the equation has the form x=A*u.

I want to extract the matrix A, for the given vectors x and u.

IMPORTANT: I know I could create a loop (i=1 to m) and set u__i=1 and all other u__j=0 (for all j not equal i) and then reconstruct each column by this method, but it seems to be a overkill for such an easy problem.

I would be glad, if someone could show me a method how one can achive this in maple.

## Implicit differentiation for matrices...

Maple

I am trying to reproduce some systems for multibody systems by using maple.

I want to define a rotation matrix

Rot__alpha:=Matrix([[ cos(alpha) , -sin(alpha) , 0 ], [ sin(alpha) , cos(alpha) , 0 ], [ 0 , 0 , 1 ]]);

Now I want to differentiate this matrix with respect to time t. I have tried the following but it does not work:

map(implicitdiff, Rot__alpha,alpha);

I actually want something like this:

d/dt (Rot(alpha))=Matrix([[ -sin(alpha)*a , -cos(alpha)*a , 0 ], [ cos(alpha)*a , -sin(alpha)*a , 0 ], [ 0 , 0 , 0 ]]);

where a is d(alpha)/dt. So alpha is not an explicit function of t.

It would be great if someone could provide me a method for performing these kind of calculations.

## How to check if a vector is in a subspac...

Maple

Lets say we have to vectors u := Vector(3,[0,a_2,a_3]) and v :=Vector(3,[a_1,a_2,a_3]), in which a_1, a_2 and a_3 are arbitrary constants. It is clear that if we set a_1=0 we could see that u is contained in the vector space of v. Is there a function in Maple like isSubspace(u,v) which returns a boolean true or false?

An alternative interpretation could be that the image of u is a subset of the image of v.

Thank you alot for reading my question.

 1 2 3 Page 1 of 3
﻿