Aufbau von einfachen Funktionen / Construction de fonctions simples

1

Remove["Global`*"]

sgn[x_] := 1 /; x > 0;
sgn[x_] := 0 /; x == 0;
sgn[x_] := -1 /; x < 0;
Plot[sgn[x], {x, -3, 3}];

Plot[Sign[x],{x,-3,3}];

abs[x_]:= x sgn[x];
{abs[4],abs[-4]}

Plot[abs[x],{x,-1,1}];

max[a_,b_]:= (a+b)/2 + abs[a-b]/2;
{max[-1,1],max[-1,-3],max[1,2],max[5,-2]}

Plot[max[2,x],{x,-1,4}];

min[a_,b_]:= (a+b)/2 - abs[a-b]/2;
{min[-1,1],min[-1,-3],min[1,2],min[5,-2]}

Plot[min[2,x],{x,-1,4}];

s1[x_]:=Floor[Sin[Pi x]/2+1];
Plot[s1[x],{x,-2,3},AspectRatio->Automatic];

s2[x_]:=x-Floor[x];
Plot[s2[x],{x,-2,3},AspectRatio->Automatic];

h[x_]:= (abs[x]+x)/2;
Plot[h[x],{x,-2,3},AspectRatio->Automatic];

v[x_]:= h[x]-h[x-1];
Plot[v[x],{x,-1,6},AspectRatio->Automatic];

v1[x_]:= v[x]+v[-x+3];
Plot[v1[x],{x,-1,4},AspectRatio->Automatic];

v2[x_]:= v[x]+v[x+3];
Plot[v2[x],{x,-3,2},AspectRatio->Automatic];

H[x_]:= sgn[abs[x]+x]/2;
Plot[H[x],{x,-1,3}, AspectRatio->Automatic];