Post Reply 
Help: Port prg to Home Mode( Minor linear_algebra)
02-09-2014, 03:55 PM (This post was last modified: 02-09-2014 09:25 PM by compsystems.)
Post: #7
RE: Help HOME PRG (Minor linear_algebra)
now with MAKEMAT on CAS MODE fail Why?

Code:

MINOR_CAS2(m):=
 begin
    local n;
    n:=dim(m);
    return(MAKEMAT(det(delcols(delrows(m,I),J)),n(1),n(2)));
 end

MINOR_CAS2([[1,2,3],[4,5,6],[7,8,9]]); [enter] returns

"Error: Bad Argument Type ??


Quote:Han: MAKEMAT() and makemat() are two different commands.

>> On HOME mode MAKEMAT() and makemat() are equal

I: HOME MODE

INDEX = (1,1) for MAKEMAT or makemat or makeMat or or any combination of uppercase and lowercase

MAKEMAT(I^2+J,3,5); // HOME MODE =>

[[2,3,4,5,6],
[5,6,7,8,9],
[10,11,12,13,14]] OK

makemat(I^2+J,3,5); makeMat(I^2+J,3,5); => MAKEMAT(I^2+J,3,5); // HOME MODE =>

[[2,3,4,5,6],
[5,6,7,8,9],
[10,11,12,13,14]] OK

INDEX = (1,1)

step1: I=1, J=1,..,5
1^2+1=2, 1^2+2=3, 1^2+3=4, 1^2+4=5, 1^2+5=6 // ok

step2: I=2, J=1,..,5
2^2+1=5, 2^2+2=6, 2^2+3=7, 2^2+4=8, 2^2+5=9 // ok

step3: I=3, J=1,..,5
3^2+1=10, 3^2+2=11, 3^2+3=12, 3^2+4=13, 3^2+5=14 // ok

MAKEMAT((I,J)->I²+J,3,5); or makemat((I,J)->I²+J,3,5); "Error: Syntax Error"


///////////////

On CAS mode MAKEMAT() and makemat() are not equal =) Support catalog says nothing about this =(
Quote:Han: Is there any reason to insist on using a CAS program instead of a regular program?

Muchas, una de ellas es que algunos comandos se comportan diferente. entonces se puede aprovechar esta característica dentro de un programa, otra permite una mas fácil manipulación de expresiones simbolicas

MAKEMAT en CAS MODE opera en índice (0,0) =)

INDEX = (0,0) for makemat and INDEX = (1,1) for MAKEMAT

makemat( (I,J)->I²+J, 3,5); // CAS MODE

=>

[[0,1,2,3,4],
[1,2,3,4,5],
[4,5,6,7,8]] OK

step1: I=0 J=0,..,4
0^2+0=0, 0^2+1=1, 0^2+2=2, 0^2+3=3, 0^2+4=4 // ok

step2: I=1, J=0,..,4
1^2+0=1, 1^2+1=2, 1^2+2=3, 1^2+3=4, 1^2+5=6 // ok

step3: I=2, J=0,..,4
2^2+0=4, 2^2+1=5, 2^2+2=6, 2^2+3=7, 2^2+4=8 // ok


INDEX = (1,1) for MAKEMAT

MAKEMAT(I²+J,3,5); // CAS MODE

=>

[[2,3,4,5,6],
[5,6,7,8,9],
[10,11,12,13,14]] OK

BUT

MAKEMAT((I,J)->I²+J,3,5); // CAS MODE

=>

Bug because should return only the right evaluation of the function

[[(1,1)->1²+1,(1,2)->1²+2,(1,3)->1²+3,(1,4)->1²+4,(1,5)->1²+5],
[(2,1)->2²+1,(2,2)->2²+2,(2,3)->2²+3,(2,4)->2²+4,(2,5)->2²+5],
[(3,1)->3²+1,(3,2)->3²+2,(3,3)->3²+3,(3,4)->3²+4,(3,5)->3²+5]] =(


F1(I,J):=I^2+J; returns F1:=(I,J)->I²+J => (I,J)->I²+J

makemat(F1(I,J),3,5) // CAS MODE

or MAKEMAT(F1(I,J),3,5) // CAS MODE

=>

Not operate, why? BUG?

"makemat(F1(I,J),3,5) Error: Bad Argument Value" ...


makeMat(I²+J,3,5);

[[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0]] ???

makeMat((I,J)->I²+J,3,5);

"Error: Unmatch control word" ??

///
Han can you port the following code to HOME MODE

Code:
 // Code on CAS MODE OK, HOME MODE =(
collectPolTerms_CAS0( Poly, Var ):=
BEGIN
    RETURN( sum( coeff( Poly, Var ) .* seq( Var^k, k, degree( Poly, Var ), 0, 1 ) ));
END;

with simplify NONE (CAS Settings),

collectPolTerms_CAS0(((-3*a*x²+7*a*x^1-2*a-3*b*x²+7*b*x^1-2*b+3*x^3-7*x²+2*x^1)/3),x); [ENTER} returns

x^3+((-3*a-3*b-7)/3)*x²+((7*a+7*b+2)/3)*x+(-2*a-2*b)/3 OK


Thanks
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Help HOME PRG (Minor linear_algebra) - compsystems - 02-09-2014 03:55 PM



User(s) browsing this thread: 1 Guest(s)