Sponsored links: Algebra eBooks
 

Related

rem

Run Example
(%i1)intervals(items, [granul]):=block([ start:first(items), stop:last(items), ans:[], granul:(if(length(granul)>
0) then first(granul) else 1),rem: (if (length(granul)>
1) then second(granul) else []) ], ratprint:false, if (emptyp(items)) then [] elseif(listp(items)) then    if(emptyp(rest(items))) then []     else     while(float(rat(start))<
float(rat(stop))) do    (ans:delete([],             delete([float(rat(stop)), float(rat(stop+granul))],             if(float(rat(start+granul))>
float(rat(stop)))            then return() else            append(ans, [cons(float(rat(start)),  [float(rat(start+granul))])]))),      start:float(rat(start+granul))),     if(not(emptyp(rem))) then return(delete(rem, ans))    else return(ans));
(%o1) intervals(items, [granul]) := block([start : first(items), 
stop : last(items), ans : [], granul : 
if length(granul) > 0 then first(granul) else 1, 
rem : if length(granul) > 1 then second(granul) else []], ratprint : false, 
if emptyp(items) then [] elseif listp(items)
 then (if emptyp(rest(items)) then [] else (while float(rat(start)) < 
float(rat(stop)) do (ans : delete([], delete([float(rat(stop)), 
float(rat(stop + granul))], if float(rat(start + granul)) > float(rat(stop))
 then return() else append(ans, [cons(float(rat(start)), 
[float(rat(start + granul))])]))), start : float(rat(start + granul))))), 
if not emptyp(rem) then return(delete(rem, ans)) else return(ans))
(%i2) intervals([0, 6], 1);
(%o2) [[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0]]
(%i3) intervals([0, 2*%pi], 1);
(%o3) [[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0]]
(%i4) intervals([0, 2*%pi], %pi);
(%o4) [[0.0, 3.141592653589793], [3.141592653011903, 6.283185306601696]]
(%i5)  length([]);
(%o5)                                  0
(%i6) 
Run Example
intervals(items, [granul]):=block([ start:first(items), stop:last(items), ans:[], gran:(if(length(granul)>
0) then first(granul) else 1),rem: (if (length(granul)>
1) then second(granul) else []) ], ratprint:false, if (emptyp(items)) then [] elseif(listp(items)) then    if(emptyp(rest(items))) then []     else     while(float(rat(start))<
float(rat(stop))) do    (ans:delete([],             delete([float(rat(stop)), float(rat(stop+gran))],             if(float(rat(start+gran))>
float(rat(stop)))            then return() else            append(ans, [cons(float(rat(start)),  [float(rat(start+gran))])]))),      start:float(rat(start+gran))),     if(maybe(rem)) then return(delete(rem, ans))    else return(ans));
(%o1) intervals(items, [granul]) := block([start : first(items), 
stop : last(items), ans : [], gran : if length(granul) > 0 then first(granul)
 else 1, rem : if length(granul) > 1 then second(granul) else []], 
ratprint : false, if emptyp(items) then [] elseif listp(items)
 then (if emptyp(rest(items)) then [] else (while float(rat(start)) < 
float(rat(stop)) do (ans : delete([], delete([float(rat(stop)), 
float(rat(stop + gran))], if float(rat(start + gran)) > float(rat(stop))
 then return() else append(ans, [cons(float(rat(start)), 
[float(rat(start + gran))])]))), start : float(rat(start + gran))))), 
if maybe(rem) then return(delete(rem, ans)) else return(ans))
(%i2) intervals([0, 6], 1);
(%o2) if unknown then return(delete([], 
[[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0]]))
 else return([[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], 
[5.0, 6.0]])
(%i3) intervals([0, 2*%pi], 1);
(%o3) if unknown then return(delete([], 
[[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0]]))
 else return([[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], 
[5.0, 6.0]])
(%i4) intervals([0, 2*%pi], %pi);
(%o4) if unknown then return(delete([], 
[[0.0, 3.141592653589793], [3.141592653011903, 6.283185306601696]]))
 else return([[0.0, 3.141592653589793], 
[3.141592653011903, 6.283185306601696]])
(%i5) intervals([0, 2*%pi], %pi, %pi);
(%o5) if unknown then return(delete(%pi, 
[[0.0, 3.141592653589793], [3.141592653011903, 6.283185306601696]]))
 else return([[0.0, 3.141592653589793], 
[3.141592653011903, 6.283185306601696]])
(%i6) 
Run Example
? rem;

 -- Function: rem (<atom>, <indicator>)
     Removes the property indicated by <indicator> from <atom>.


  There are also some inexact matches for `rem'.
  Try `?? rem' to see them.

(%o1)                                true
(%i2) 

Related Help

Help for Rem