Sponsored links: Algebra eBooks
 

Related

copy

m : [1,[2,3]];

mm : m;

mm[2][1] : x;

Calculate

copy

a: "xxx";

b: copy(a);

Calculate

copy

m : [1,[2,3]];

mm : m;

mm[2][1] : x;

Calculate

copy

a: "xxx";

b: copy(a);

Calculate

copy

Run Example
(%i1)a: "xxx";
(%o1)                                 xxx
(%i2) b: copy(a);
(%o2)                                 xxx
(%i3) 
Run Example
_power(obj1,exp1):=block(	[lobj1,lobj2,lexp],	if nonegintegerp(exp1)=false then (		error("cannot compute without nonnegative integral exponent")	),	if exp1=0 then (		if _print(obj1)#0 then (			return(_build(1))		),		error("cannot compute 0^0")	),	lexp: exp1,	lobj1: _copy(obj1),	lobj2: _copy(obj1),	while lexp>
1 do (		if mod(lexp,2)=1 then (			lexp: lexp-1,			lobj2: lobj1*lobj2		),		lexp: lexp/2,		lobj1: lobj1^2	),	return(lobj1*lobj2));
(%o1) _power(obj1, exp1) := block([lobj1, lobj2, lexp], 
if nonegintegerp(exp1) = false
 then error("cannot compute without nonnegative integral exponent"), 
if exp1 = 0 then (if _print(obj1) # 0 then return(_build(1)), 
error("cannot compute 0^0")), lexp : exp1, lobj1 : _copy(obj1), 
lobj2 : _copy(obj1), while lexp > 1 do (if mod(lexp, 2) = 1
                                                     lexp               2
 then (lexp : lexp - 1, lobj2 : lobj1 lobj2), lexp : ----, lobj1 : lobj1 ), 
                                                      2
return(lobj1 lobj2))
(%i2) _power(a,-1);
                                        2
(%o2)                              _copy (a)
(%i3) 
Run Example
a1 : matrix([3,-4, 5, 0], [2,-3, 1, 1], [3,-5,-1, 2], [3,-1, 4, 1]);
                              [ 3  - 4   5   0 ]
                              [                ]
                              [ 2  - 3   1   1 ]
(%o1)                         [                ]
                              [ 3  - 5  - 1  2 ]
                              [                ]
                              [ 3  - 1   4   1 ]
(%i2) a : copy(a1);
                              [ 3  - 4   5   0 ]
                              [                ]
                              [ 2  - 3   1   1 ]
(%o2)                         [                ]
                              [ 3  - 5  - 1  2 ]
                              [                ]
                              [ 3  - 1   4   1 ]
(%i3) n : length(a);
(%o3)                                  4
(%i4) A : id : ident(n);
                                [ 1  0  0  0 ]
                                [            ]
                                [ 0  1  0  0 ]
(%o4)                           [            ]
                                [ 0  0  1  0 ]
                                [            ]
                                [ 0  0  0  1 ]
(%i5) for k : 1 thru n do(u : col(id, k),v : row(a, k),v[1, k] : v[1, k]-1,w : A.u,gamma : 1 + v.w,A : A-(1/gamma)*w.v.A);
(%o5)                                done
(%i6) A;
                           [  3     17   11    7   ]
                           [  -   - --   --    --  ]
                           [  4     4    6     12  ]
                           [                       ]
                           [             1     1   ]
                           [  0   - 1    -     -   ]
                           [             3     3   ]
(%o6)                      [                       ]
                           [   1   7      5     1  ]
                           [ - -   -    - -   - -- ]
                           [   4   4      6     12 ]
                           [                       ]
                           [   5   19     11    1  ]
                           [ - -   --   - --  - -- ]
                           [   4   4      6     12 ]
(%i7) a1.A;
                                [ 1  0  0  0 ]
                                [            ]
                                [ 0  1  0  0 ]
(%o7)                           [            ]
                                [ 0  0  1  0 ]
                                [            ]
                                [ 0  0  0  1 ]
(%i8) 

Related Help

Help for Copy