Sponsored links: Algebra eBooks
 

Related

charfun

charfun (x < 1);

Calculate

charfun-integrate-sin

f(x):=charfun(x<0)...

integrate(f(x),x);

Calculate

charfun-integrate-sin

f(x):=charfun(x<0)...

integrate(f(x),x);

Calculate

charfun

charfun (x < 1);

Calculate

charfun

charfun (2 < 1);

Calculate

charfun

f(n):=2+charfun(n>...

f(37);

f(62);

Calculate

charfun

charfun (x < 1);

Calculate

charfun

charfun (x < 1);

Calculate

charfun

charfun (2 < 1);

Calculate

charfun-integrate-sin

f(x):=charfun(x<0)...

integrate(f(x),x);

Calculate

charfun

Run Example
(%i1)charfun (x <
 1);
(%o1)                           charfun(x < 1)
(%i2)  subst (x = -1, %);
(%o2)              e : charfun ('"and" (-1 <
 x, x <
 1));
 [subst (x = -1, e), subst (x = 0, e), subst (x = 1, e)];
(%o3)                    charfun(mand(- 1 < x, x < 1))
(%i4) 
Run Example
display2d;
(%o1)                                true
(%i2) gradef(charfun(dummy),0);
(%o2)                           charfun(dummy)
(%i3) /* piecewise function definition */itv: [[x<
0],[x>
=0,x<
1], [x>
=1]];
(%o3)                [[x < 0], [x >= 0, x < 1], [x >= 1]]
(%i4)  /* intervals */fi:  [ 1,    x^2+1,      2*x  ];
                                    2
(%o4)                          [1, x  + 1, 2 x]
(%i5)  /* local functions *//* creation of global function f and its derivative */f:0;
(%o5)                                  0
(%i6) for i: 1 thru 3 do f:f+charfun(apply("and",itv[i]))*fi[i];
(%o6)                                done
(%i7) df:diff(f,x);
(%o7)        2 x charfun((x >= 0) and (x < 1)) + 2 charfun(x >= 1)
(%i8) /* display local functions and derivatives */for i: 1 thru 3 do (  apply(assume,itv[i]),  newline(),  print(itv[i]),  print("f = ",ev(f)),  print("df = ",ev(df)),  apply(forget,itv[i])  );

[x < 0] 
f =  1 
df =  0 

[x >= 0, x < 1] 
      2
f =  x  + 1 
df =  2 x 

[x >= 1] 
f =  2 x 
df =  2 
(%o8)                                done
(%i9) plot2d([f,df],[x,-2,3],[y,-1,5],[style, [lines,4,3],[lines,2,2]]);
plotplot2d([f,df],[x,-2,3],[y,-1,5],[style, [lines,4,3],[lines,2,2]]);
Run Example
gradef(charfun(dummy),0);
(%o1)                           charfun(dummy)
(%i2) /* piecewise function definition */itv: [[x<
0],[x>
=0,x<
1], [x>
=1]];
(%o2)                [[x < 0], [x >= 0, x < 1], [x >= 1]]
(%i3)  /* intervals */fi:  [ 1,    x^2+1,      2*x  ];
                                    2
(%o3)                          [1, x  + 1, 2 x]
(%i4)  /* local functions *//* creation of global function f and its derivative */f:0;
(%o4)                                  0
(%i5) for i: 1 thru 3 do f:f+charfun(apply("and",itv[i]))*fi[i];
(%o5)                                done
(%i6) df:diff(f,x);
(%o6)        2 x charfun((x >= 0) and (x < 1)) + 2 charfun(x >= 1)
(%i7) /* display local functions and derivatives */for i: 1 thru 3 do (  apply(assume,itv[i]),  newline(),  print(itv[i]),  print("f = ",ev(f)),  print("df = ",ev(df)),  apply(forget,itv[i])  );

[x < 0] 
f =  1 
df =  0 

[x >= 0, x < 1] 
      2
f =  x  + 1 
df =  2 x 

[x >= 1] 
f =  2 x 
df =  2 
(%o7)                                done
(%i8) plot2d([f,df],['x,-2,3],['x,-2,3],[style, [lines,5,5],[lines,5,2]]);
plotplot2d([f,df],[

Related Help

Help for Charfun