﻿07.10.2012 11:34:15 [->] smath_int(cos(x)^2,x,0,Pi)
07.10.2012 11:34:15 [->] D:\tmp\tmp6311.tmp:
interface(quiet=true);
with(linalg):
writeto("D:\\tmp\\tmp6312.tmp"):
smath_line := proc() local i: for i from 1 to nargs - 2 do args[i]; od: end:
smath_int := proc() if nargs = 2 then int( args[1], args[2] ); elif nargs = 4 then int( args[1], args[2] = args[3] .. args[4] ); fi: end:
smath_diff := proc() if nargs = 2 then diff( args[1], args[2] ); elif nargs = 3 then diff( args[1], args[2] $ args[3] ); fi: end:
smath_sys := proc() { args[i] $ i = 1 .. nargs - 2 }; end:
smath_el := proc() args[1][ args[2] ]; end:
smath_mat := proc() 
local i, j, out: 
out := [ args[j] $ j = 1 .. args[ nargs ] ]: 
for i from 2 to args[ nargs - 1 ] do 
out := out, [ args[j] $ j = ( i - 1 ) * args[ nargs ] + 1 .. ( i - 1 ) * args[ nargs ] + args[ nargs ] ]: 
od: 
 convert( [ out ], array ); 
end:
smath_submatrix := proc() submatrix( args[1], args[2] .. args[3], args[4] .. args[5] ); end:
ans := \
smath_int(cos(x)^2,x,0,Pi):
if ( whattype( ans ) = `exprseq` ) then 
    convert( convert( cat( `mat(`, substring( convert( [ans], string ), 2..-2 ), `,`, nops( [ans] ), `,1)` ), string ), symbol );
elif ( whattype( ans ) = `set` ) then 
    convert( convert( cat(`mat(`,substring(convert(map2(op,2,[ans[i]$i=1..nops(ans)]),string),2..-2),`,`,nops(ans),`,1)`), string ), symbol );
elif ( whattype( ans ) = `symbol` ) then 
    convert( convert( eval( ans ), string ), symbol ); 
elif ( whattype( ans ) = `series` ) then 
    convert( convert( ans, polynom) , symbol ); 
elif ( whattype( ans ) = `string` ) then 
    convert( ans, symbol ); 
else 
    convert( convert( ans, string ), symbol ); fi;
quit:

07.10.2012 11:34:15 [<-] D:\tmp\tmp6312.tmp:
1/2*Pi
07.10.2012 11:34:15 [<-] 1/2*π

07.10.2012 11:34:15 [->] map2(diff;((x^2+y^2+z^2)-1);smath_mat(x,y,z,3,1))
07.10.2012 11:34:15 [->] D:\tmp\tmp6390.tmp:
interface(quiet=true);
with(linalg):
writeto("D:\\tmp\\tmp6391.tmp"):
smath_line := proc() local i: for i from 1 to nargs - 2 do args[i]; od: end:
smath_int := proc() if nargs = 2 then int( args[1], args[2] ); elif nargs = 4 then int( args[1], args[2] = args[3] .. args[4] ); fi: end:
smath_diff := proc() if nargs = 2 then diff( args[1], args[2] ); elif nargs = 3 then diff( args[1], args[2] $ args[3] ); fi: end:
smath_sys := proc() { args[i] $ i = 1 .. nargs - 2 }; end:
smath_el := proc() args[1][ args[2] ]; end:
smath_mat := proc() 
local i, j, out: 
out := [ args[j] $ j = 1 .. args[ nargs ] ]: 
for i from 2 to args[ nargs - 1 ] do 
out := out, [ args[j] $ j = ( i - 1 ) * args[ nargs ] + 1 .. ( i - 1 ) * args[ nargs ] + args[ nargs ] ]: 
od: 
 convert( [ out ], array ); 
end:
smath_submatrix := proc() submatrix( args[1], args[2] .. args[3], args[4] .. args[5] ); end:
ans := \
map2(diff;((x^2+y^2+z^2)-1);smath_mat(x,y,z,3,1)):
if ( whattype( ans ) = `exprseq` ) then 
    convert( convert( cat( `mat(`, substring( convert( [ans], string ), 2..-2 ), `,`, nops( [ans] ), `,1)` ), string ), symbol );
elif ( whattype( ans ) = `set` ) then 
    convert( convert( cat(`mat(`,substring(convert(map2(op,2,[ans[i]$i=1..nops(ans)]),string),2..-2),`,`,nops(ans),`,1)`), string ), symbol );
elif ( whattype( ans ) = `symbol` ) then 
    convert( convert( eval( ans ), string ), symbol ); 
elif ( whattype( ans ) = `series` ) then 
    convert( convert( ans, polynom) , symbol ); 
elif ( whattype( ans ) = `string` ) then 
    convert( ans, symbol ); 
else 
    convert( convert( ans, string ), symbol ); fi;
quit:

07.10.2012 11:34:15 [<-] D:\tmp\tmp6391.tmp:
on line 19, syntax error, `;` unexpected:
map2(diff;((x^2+y^2+z^2)-1);smath_mat(x,y,z,3,1)):
         ^
07.10.2012 11:34:15 [->] map2(diff,z,smath_mat(x,y,z,3,1))
07.10.2012 11:34:15 [->] D:\tmp\tmp63E0.tmp:
interface(quiet=true);
with(linalg):
writeto("D:\\tmp\\tmp63E1.tmp"):
smath_line := proc() local i: for i from 1 to nargs - 2 do args[i]; od: end:
smath_int := proc() if nargs = 2 then int( args[1], args[2] ); elif nargs = 4 then int( args[1], args[2] = args[3] .. args[4] ); fi: end:
smath_diff := proc() if nargs = 2 then diff( args[1], args[2] ); elif nargs = 3 then diff( args[1], args[2] $ args[3] ); fi: end:
smath_sys := proc() { args[i] $ i = 1 .. nargs - 2 }; end:
smath_el := proc() args[1][ args[2] ]; end:
smath_mat := proc() 
local i, j, out: 
out := [ args[j] $ j = 1 .. args[ nargs ] ]: 
for i from 2 to args[ nargs - 1 ] do 
out := out, [ args[j] $ j = ( i - 1 ) * args[ nargs ] + 1 .. ( i - 1 ) * args[ nargs ] + args[ nargs ] ]: 
od: 
 convert( [ out ], array ); 
end:
smath_submatrix := proc() submatrix( args[1], args[2] .. args[3], args[4] .. args[5] ); end:
ans := \
map2(diff,z,smath_mat(x,y,z,3,1)):
if ( whattype( ans ) = `exprseq` ) then 
    convert( convert( cat( `mat(`, substring( convert( [ans], string ), 2..-2 ), `,`, nops( [ans] ), `,1)` ), string ), symbol );
elif ( whattype( ans ) = `set` ) then 
    convert( convert( cat(`mat(`,substring(convert(map2(op,2,[ans[i]$i=1..nops(ans)]),string),2..-2),`,`,nops(ans),`,1)`), string ), symbol );
elif ( whattype( ans ) = `symbol` ) then 
    convert( convert( eval( ans ), string ), symbol ); 
elif ( whattype( ans ) = `series` ) then 
    convert( convert( ans, polynom) , symbol ); 
elif ( whattype( ans ) = `string` ) then 
    convert( ans, symbol ); 
else 
    convert( convert( ans, string ), symbol ); fi;
quit:

07.10.2012 11:34:15 [<-] D:\tmp\tmp63E1.tmp:
array(1 .. 3, 1 .. 1,[(3, 1)=1,(1, 1)=0,(2, 1)=0])
07.10.2012 11:34:15 [<-] mat(0;0;1;3;1)

07.10.2012 11:34:15 [->] crossprod(convert("on line 19. syntax error, `;` unexpected:|map2(diff;((x^2+y^2+z^2)-1);smath_mat(";vector);convert(smath_mat(0,0,1,3,1);vector))
07.10.2012 11:34:15 [->] D:\tmp\tmp6420.tmp:
interface(quiet=true);
with(linalg):
writeto("D:\\tmp\\tmp6421.tmp"):
smath_line := proc() local i: for i from 1 to nargs - 2 do args[i]; od: end:
smath_int := proc() if nargs = 2 then int( args[1], args[2] ); elif nargs = 4 then int( args[1], args[2] = args[3] .. args[4] ); fi: end:
smath_diff := proc() if nargs = 2 then diff( args[1], args[2] ); elif nargs = 3 then diff( args[1], args[2] $ args[3] ); fi: end:
smath_sys := proc() { args[i] $ i = 1 .. nargs - 2 }; end:
smath_el := proc() args[1][ args[2] ]; end:
smath_mat := proc() 
local i, j, out: 
out := [ args[j] $ j = 1 .. args[ nargs ] ]: 
for i from 2 to args[ nargs - 1 ] do 
out := out, [ args[j] $ j = ( i - 1 ) * args[ nargs ] + 1 .. ( i - 1 ) * args[ nargs ] + args[ nargs ] ]: 
od: 
 convert( [ out ], array ); 
end:
smath_submatrix := proc() submatrix( args[1], args[2] .. args[3], args[4] .. args[5] ); end:
ans := \
crossprod(convert("on line 19. syntax error, `;` unexpected:|map2(diff\
;((x^2+y^2+z^2)-1);smath_mat(";vector);convert(smath_mat(0,0,1,3,1);ve\
ctor)):
if ( whattype( ans ) = `exprseq` ) then 
    convert( convert( cat( `mat(`, substring( convert( [ans], string ), 2..-2 ), `,`, nops( [ans] ), `,1)` ), string ), symbol );
elif ( whattype( ans ) = `set` ) then 
    convert( convert( cat(`mat(`,substring(convert(map2(op,2,[ans[i]$i=1..nops(ans)]),string),2..-2),`,`,nops(ans),`,1)`), string ), symbol );
elif ( whattype( ans ) = `symbol` ) then 
    convert( convert( eval( ans ), string ), symbol ); 
elif ( whattype( ans ) = `series` ) then 
    convert( convert( ans, polynom) , symbol ); 
elif ( whattype( ans ) = `string` ) then 
    convert( ans, symbol ); 
else 
    convert( convert( ans, string ), symbol ); fi;
quit:

07.10.2012 11:34:15 [<-] D:\tmp\tmp6421.tmp:
on line 20, syntax error, `;` unexpected:
;((x^2+y^2+z^2)-1);smath_mat(";vector);convert(smath_mat(0,0,1,3,1);ve\
                              ^
