02-20-2018, 10:34 AM
This small program provides on input of a set of function f(x,k) and an additional parameter p a list containing the equations (as strings to be easily usable in plots) of extreme points (p=1) or turning points (p=2). As I did not want to bother about used variables x and k must be used. f may also be an expression.
provides the output:
Here you must clearly see for yourself that the first part is for max-points and the second one is for mins, putting this together to only "y:=x*e^(-1/2)" would have caused a lot of different cases to be taken care of, so I omitted that.
Arno
Code:
locuscurve(x*e^(-k*x^2),1)
Code:
{"y:=x^2/(abs(x)*e^(1/2))","y:=-x^2/(abs(x)*e^(1/2))"}
Code:
// calculates the curve through locuspoints of a parametric function which must be dependent from x and k
// p=1: extreme points, p=2: turning points
// f can be function or symbolic
#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;//transform to function
END;
g:=diff(f(x,k),x,p);
l1:=zeros(g);//x-vals
l2:=apply(z→f(z,k),l1);//y-vals
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]));//string for convenience
END;
return convert(l2,23);// convert matrix to list
END;
#end