List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Re: How to force a common factor from a simbolic matrix
| [MUG] Re: How to force a common factor from a simbolic matrix |
|
Author: Edwin Clark
Posted: Mon, 05 Aug 2002 15:09:50 -0400
|
>> From: Edwin Clark "eclark"
On Sun, 28 Jul 2002, Nicolai Sirbu wrote:
> I performe several matrix simbolic computations and the result is a matrix.
> Analysing the result matrix there are obvious terms that can be put in the
> front of the matrix as common factors. How can i do that (what's the maple's
> command to do such thing)?
Here's a procedure that ought to do what you want:
> factor_out:=proc(A)
> local g,i,x;
> x:=ListTools[Flatten](convert(A,listlist));
> g:=gcd(x[1],x[2]):
> for i from 3 to nops(x) do
> g:=gcd(g,x[i]);
> end do:
> g*map(x->x/g,evalm(A));
> end proc:
Example:
> A:=matrix([[sin(2)*a,sin(2)*2*a],[sin(2)*3*a,sin(2)*4*a]]);
> factor_out(A);
[1 2]
sin(2) a [ ]
[3 4]
>
------------------------------------------------------------
W. Edwin Clark, Math Dept, University of South Florida,
http://www.math.usf.edu/~eclark/
------------------------------------------------------------
|
[View Complete Thread]
Previous by date: [MUG] Creating combinations of normal 3D surfdata and contours, Jens Ernst
Next by date: [MUG] Re: Solving equations with radicals, Rafael Espericueta
Previous thread: [MUG] Bug in print(), Helmut Kahovec
Next thread: [MUG] Solving equations with radicals, PierLuigi Zezza
|