Post Reply 
Wronskian
02-23-2015, 07:21 PM (This post was last modified: 02-23-2015 10:18 PM by salvomic.)
Post: #3
RE: Wronskian
A little better version:
Code:

ChooseType()
BEGIN
LOCAL choice;
CHOOSE(choice,"Matrix or Wronskian","Fundamental Matrix","Wronskian");
RETURN choice;
END;

#cas
// Wronskian - input a [vector] of functions
// i.e. W(f,g)= fg'-f'g
wronskian(flist):=
BEGIN
local mat, s, j, k, d;
s:= size(flist);

IF (  (s < 2) OR (TYPE(flist) == 2) OR (TYPE(flist(1))==2) OR (TYPE(flist(2))==2) ) THEN return "Input a [vector] of functions";
ELSE
IF (instring(string(flist),"[")==0) THEN  MSGBOX("It would be better use [vector] in []"); END;
mat:= makemat(0, s, s);
mat[1]:= flist;
FOR j FROM 2 TO s DO // diff

FOR k FROM 1 TO s DO // items
d:=diff(mat[j-1,k],x);
mat[j, k]:= d;

END; // for k
END; // for j
IF EXPR(" wronskian.ChooseType()")=1 THEN
return mat;
ELSE
return det(mat);
END; // if

END; // 1st if

END;
#end

It is not so elegant (it's perhaps "folkloristic", but with
Code:

IF (instring(string(flist),"[")==0) THEN  MSGBOX("It would be better use [vector] in []"); END;
I control if a list has [ bracket, and if not the program accepts also input with {} or simple list a,b,c..., but with a MSGBOX with a warning... better than nothing

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Wronskian - salvomic - 02-22-2015, 11:10 PM
RE: Wronskian - salvomic - 02-23-2015, 06:57 PM
RE: Wronskian - salvomic - 02-23-2015 07:21 PM
RE: Wronskian - Han - 02-23-2015, 07:29 PM
RE: Wronskian - salvomic - 02-23-2015, 09:46 PM
RE: Wronskian - Han - 02-23-2015, 10:24 PM
RE: Wronskian - salvomic - 02-23-2015, 10:51 PM
RE: Wronskian - Han - 02-23-2015, 10:53 PM
RE: Wronskian - salvomic - 02-23-2015, 11:02 PM
RE: Wronskian - Han - 02-24-2015, 12:49 AM
RE: Wronskian - salvomic - 02-24-2015, 06:32 AM



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