Post Reply 
Help: Port prg to Home Mode( Minor linear_algebra)
02-03-2014, 03:06 PM (This post was last modified: 02-03-2014 03:44 PM by compsystems.)
Post: #3
RE: Help HOME PRG (Minor linear_algebra)
sorry for my bad English

The version in CAS mode works fine, but not in HOME mode =(, but as there is not a program editor for cas mode my calculator this underutilized.


Han: Why are you defining j and ii as strings?
I try to do the trick you discussed in another topic.

http://www.hpmuseum.org/forum/thread-538.html

Code:
export convolution1(v1,v2)
begin 
  local p1,p2,c,var:="x_";
  purge(var);
  p1:=poly2symb(v1,var); 
  p2:=poly2symb(v2,var); 
  c:=symb2poly(simplify(p1*p2),var);
  return(c); 
end


Han: Just don't confuse a sequence with a matrix even if they both use the same delimiters.

the seq command generates a one-dimensional array, and seq (seq generates a two-dimensional array

seq(x²,x,1,3); enter returns
[1,4,9]; TYPE(Ans); returns 4 (Matrix 1x3) best vector =)

seq(seq(x²,x,1,3),x,1,2); enter returns
[[1,1,1],
[4,4,4]]; TYPE(Ans); returns 4 (Matrix 2x3)

Using the seq cmd, number of instructions is reduced =)

Code:
minorCAS2(m1):=
BEGIN  
RETURN(seq(seq(det(delRow(delCol(m1,j),I)),j,1,colDim(m1)),I,1,rowDim(m1)));  // i == unit imaginary =(
END;

minorCAS2([[1,2,3],[4,5,6],[7,8,9]]); [enter] returns
[[-3,-6, -3]
[-6,-12,-6]
[-3,-6, -3]] OK Smile

versus your code

Code:
EXPORT MINOR(m)
BEGIN
  LOCAL n:=dim(m),s;
  s:=n(1)*n(2);
  n:=n(1);
  MAKELIST(det(delcols(delrows(m,((I-1) MOD n)+1),IP((I-1)/n)+1)),I,1,s);
END;

MINOR([[1,2,3],[4,5,6],[7,8,9]]); [enter] returns {-3,-6,-3,-6,-12,-6,-3,-6,-3} LIST

http://www.maplesoft.com/support/help/Ma...ebra/Minor
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-03-2014 03:06 PM



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