Post Reply 
cas-function: locuscurve
02-27-2018, 11:32 PM
Post: #2
RE: cas-function: locuscurve
Slight changes because it does not work on turning points when they are unique, i.e. independent from k. In the moment solve returns a vector containing 0 as first entry as I tried on some examples, so I made a quick and dirty fix for this. When someone encounters problems, pm me.
Another thing to be mentioned, CAS settings, Complex on and Use i on increase speed noticably.
Arno


Code:

#cas
locuscurve(f,p):=
BEGIN
LOCAL g,x,k,z;
LOCAL l1,l2,j;
purge(x);
purge(k);
IF type(f)≠DOM_FUNC THEN
f(x,k):=f;
END;

g:=diff(f(x,k),x,p);
l1:=zeros(g);
IF l1[1]==0 THEN
l1:=tail(l1);
END;


l2:=apply(z→f(z,k),l1);
l1:=x.-l1;
l1:=apply(z→solve(z=0,k),l1);
FOR j FROM 1 TO size(l1) DO
l1[j]:=l1[j][1];
l2[j]:="f"+j+"(x):="+simplify(subst(l2[j],k=l1[j]));
END;


  return convert(l2,23);
END;
#end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
cas-function: locuscurve - Arno K - 02-20-2018, 10:34 AM
RE: cas-function: locuscurve - Arno K - 02-27-2018 11:32 PM



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