Post Reply 
Wronskian
02-23-2015, 10:24 PM (This post was last modified: 02-23-2015 10:25 PM by Han.)
Post: #6
RE: Wronskian
Try this:
Code:
#cas
wronskm(f):=
BEGIN
  local s,v,m;

  s:=SIZE(f);
  IF s==0 OR TYPE(f)<>6 THEN RETURN("wronskm([f1,f2,...,fn])"); END;
  IF TYPE(s) THEN RETURN("wronskm: expecting vector of functions"); END;
  v:=lname(f);
  IF SIZE(v)<>1 THEN RETURN("wronskm: expecting single-variable functions"); END; 
  v:=v(1);
  m:=makemat((r,c)->diff(f(c),v$(r-1)),s,s);
  return m;
END;

wronsk(f):=
BEGIN
  local m;
  m:=wronskm(f);
  IF TYPE(m)==2 THEN
    return m;
  ELSE
    return det(m);
  END;
END;
#end

Usage: wronskm([f1,f2,...,fn]) returns the matrix; wronsk([f1,f2,...,fn]) returns the determinant of the matrix

The error message regarding single-variable functions can occur when:
1) the "variable" already exists and contains a value of some sort (e.g. exported from a non-CAS program, defined by user, or exists in the CAS view); OR
2) the functions in the vector of functions are multivariate (or are all constants)

Graph 3D | QPI | SolveSys
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: 3 Guest(s)