Post Reply 
Struggling with CAS programming
09-17-2018, 01:49 PM (This post was last modified: 09-17-2018 01:58 PM by rushfan.)
Post: #6
RE: Struggling with CAS programming
I managed to get it working, though there are still some things I have to polish.
If I type "restart" to clear variable definitions, the program disappears from the cas and I have to load it again.
The Prime seems to be a very powerful tool, but there is still a lot very frustrating and unnecessary friction working between the CAS and Home, and writing programs. I still don't see why the Home exists, when the CAS is perfectly capable of making numeric calculations, and the existence of the Home places a lot of friction and restrictions.

This code is working:

Code:

#cas
tf2ss(num,den):=
BEGIN
// declare vars and allocate matrices
local ordem,a,b,c,d;

ordem := size(den)-1;
a:= identity(ordem)*0;

// fill A is in the form [0 1 0; 0 0 1; -p/m -o/m -n/m], where n m o p are from den
a:= replace(a,{ordem,1},-revlist(den[2..(ordem+1)])/den(1));
FOR lpv FROM 1 TO ordem-1 DO
a[lpv,lpv+1]:=1;
end;

// fill b 
b:= identity(ordem)*0;
b:= delrows(b,2..ordem);
b:= replace(b,{1,ordem},[1]);
b:= transpose(b);
c := revlist(num);
d:=0;
return {a,b,c,d};

END;
#end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Struggling with CAS programming - rushfan - 09-17-2018, 12:54 AM
RE: Struggling with CAS programming - rushfan - 09-17-2018 01:49 PM



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