# Singular

#### D.11.3.3 divideUnits

Procedure from library `jacobson.lib` (see jacobson_lib).

Usage:
divideUnits(L); list L

Return:
matrix or list of matrices

Assume:
L is an output of `smith` or a `jacobson` procedures, that is
either L contains one rectangular matrix with elements only on the main diagonal
or L consists of three matrices, where L[1] and L[3] are square invertible matrices
while L[2] is a rectangular matrix with elements only on the main diagonal

Purpose:
divide out units from the diagonal and reflect this in transformation matrices

Example:
 ```LIB "jacobson.lib"; ring R=(0,m,M,L1,L2,m1,m2,g), D, lp; // two pendula example matrix P[3][4]=m1*L1*D^2,m2*L2*D^2,(M+m1+m2)*D^2,-1, m1*L1^2*D^2-m1*L1*g,0,m1*L1*D^2,0,0, m2*L2^2*D^2-m2*L2*g,m2*L2*D^2,0; list s=smith(P,1); // returns a list with 3 entries print(s[2]); // a diagonal form, close to the Smith form ==> (L1*L2*m2*g^2-L2^2*m2*g^2),0, 0, 0, ==> 0, (L2),0, 0, ==> 0, 0, (g^2),0 print(s[1]); // U, left transformation matrix ==> 0, (-L2*m2)/(L1*m1), 1, ==> (-L2),(M*L2+L2*m1)/(L1*m1),1, ==> 0, 1/(L1*m1), 0 list t = divideUnits(s); print(t[2]); // the Smith form of the matrix P ==> 1,0,0,0, ==> 0,1,0,0, ==> 0,0,1,0 print(t[1]); // U', modified left transformation matrix ==> 0, -1/(L1^2*m1*g^2-L1*L2*m1*g^2),1/(L1*L2*m2*g^2-L2^2*m2*g^2), ==> -1,(M+m1)/(L1*m1), 1/(L2), ==> 0, 1/(L1*m1*g^2), 0 ```