Sponsored links: Algebra eBooks
 

Related

buildq

a:[1, 2, 3, 4];

for m in a do print(m);

for m in a do for l i...

Calculate

buildq-indices-lambda-macroexpand-sublist_indices

gensym();

f(l, x) ::= buildq([l...

macroexpand(f([x,y,z]...

Calculate

buildq

a:[1, 2, 3, 4];

buildq([x:a], x);

Calculate

buildq-exp-freeof-lambda-polynomialp

f:buildq([bb:x],lambd...

f(bb*x^2);

polynomialp(a*x^2+b*x...

Calculate

buildq

a:[1, 2, 3, 4];

for m in a do print(m);

for m in a do for l i...

Calculate

buildq-exp-freeof-lambda-polynomialp

f:buildq([bb:x],lambd...

f(bb*x^2);

polynomialp(a*x^2+b*x...

Calculate

buildq-freeof-lambda-polynomialp-var

polyp(expr,var):=poly...

polyp(a*x+b(x),x);

Calculate

buildq

a:[1, 2, 3, 4];

for m in a do print(m);

for m in a do list(bu...

Calculate

buildq

Run Example
(%i1)show(L)::=block([simp:false], simp:false, buildq([L], first([L[1]/L[2]])));
                                                                         L
                                                                          1
(%o1) show(L) ::= block([simp : false], simp : false, buildq([L], first([--])))
                                                                         L
                                                                          2
(%i2) show([0, 1]), simp:false;
                                       0
(%o2)                                  -
                                       1
(%i3) L:[0, 1];
(%o3)                               [0, 1]
(%i4)  R:[1, 0];
(%o4)                               [1, 0]
(%i5) k:[L, L+R, R];
(%o5)                      [[0, 1], [1, 1], [1, 0]]
(%i6) show(L), simp:false;
                                       0
(%o6)                                  -
                                       1
(%i7) show(R), simp:false;
                                       1
(%o7)                                  -
                                       0
(%i8) show(L+R), simp:false;
                                       1
(%o8)                                  -
                                       1
(%i9) h:[];
(%o9)                                 []
(%i10) block([m:[]], for i in k do (append(m, [show(i)]), return(m))), simp:false;
(%o10)                                []
(%i11) 
Run Example
seq(start,stop,stepping,[shift]) := block([                                            n, y:[],                                             shift: (if (not(emptyp(shift)))                                                         then float(first(shift))                                                            else (0.0))                                            ],            (n:floor((float(stop-start)/float(stepping)))),            (if (start <
 stop)            then            (y:flatten(append([y],                                         makelist(float(start+shift+(stepping*(i-start))),                                         i, start, n+start))))            else            (y:flatten(append([y],                                         makelist(-(float(stop-shift-(stepping*(i-stop)))),                                         i, -(n+stop), stop)))))            (if (n>
1.0)                then return(y)                else return([])));
(%o1) seq(start, stop, stepping, [shift]) := 
block([n, y : [], shift : if not emptyp(shift) then float(first(shift))
                      float(stop - start)
 else 0.0], n : floor(-------------------), 
                        float(stepping)
if start < stop then y : flatten(append([y], 
makelist(float(start + shift + stepping (i - start)), i, start, n + start)))
 else y : flatten(append([y], makelist(- float(stop - shift
 - stepping (i - stop)), i, - (n + stop), stop)))(if n > 1.0 then return(y)
 else return([])))
(%i2) kill(pairs);
(%o2)                                done
(%i3) pairs(items):=block([result],result:if (emptyp(items)) then [] elseif (listp(items)) then     if(emptyp(rest(items))) then cons(last(items), []) else    cons(cons(first(items),  [second(items)]),                     [pairs(rest(rest(items)))]));
(%o3) pairs(items) := block([result], result : 
if emptyp(items) then [] elseif listp(items)
 then (if emptyp(rest(items)) then cons(last(items), [])
 else cons(cons(first(items), [second(items)]), [pairs(rest(rest(items)))])))
(%i4) pairs([1, 2, 3, 4, 5]);
(%o4)                       [[1, 2], [[3, 4], [5]]]
(%i5) kill(pairs);
(%o5)                                done
(%i6) pairs(items):=block([result],result:if (emptyp(items)) then [] elseif (listp(items)) then     if(emptyp(rest(items))) then [last(items), []] else    cons(cons(first(items),  [second(items)]),                     [pairs(rest(rest(items)))]));
(%o6) pairs(items) := block([result], result : 
if emptyp(items) then [] elseif listp(items)
 then (if emptyp(rest(items)) then [last(items), []]
 else cons(cons(first(items), [second(items)]), [pairs(rest(rest(items)))])))
(%i7) pairs([1, 2, 3, 4, 5]);
(%o7)                     [[1, 2], [[3, 4], [5, []]]]
(%i8) first(pairs(seq(1, 10, 1)));
(%o8)                             [1.0, 2.0]
(%i9) test(list):=buildq([m: first(list), n:second(list)],            find_root(sin(x), x, m, n));
(%o9) test(list) := buildq([m : first(list), n : second(list)], 
                                                    find_root(sin(x), x, m, n))
(%i10) test(first(pairs(seq(1, 10, 1)))), ev;
(%o10)                  find_root(sin(x), x, 1.0, 2.0)
(%i11) find_root(sin(x), x, 0, %pi);
(%o11)                                0.0
(%i12) 
Run Example
show(L)::=block(simp:false, block(buildq([L], first([L[1]/L[2]]))));
                                                                L
                                                                 1
(%o1)  show(L) ::= block(simp : false, block(buildq([L], first([--]))))
                                                                L
                                                                 2
(%i2) L:[0, 1];
(%o2)                               [0, 1]
(%i3) R:[1, 0];
(%o3)                               [1, 0]
(%i4) k:[L, L+R, R];
(%o4)                      [[0, 1], [1, 1], [1, 0]]
(%i5) h:[L, 2*L+R, L+R, L+2*R, R];
(%o5)              [[0, 1], [1, 2], [1, 1], [2, 1], [1, 0]]
(%i6) n:[L, 3*L+R, 2*L+R, L+R, L+2*R, L+3*R, R];
(%o6)      [[0, 1], [1, 3], [1, 2], [1, 1], [2, 1], [3, 1], [1, 0]]
(%i7) show(L);
                                       0
(%o7)                                  -
                                       1
(%i8) show(R);
                                       1
(%o8)                                  -
                                       0
(%i9) map(showm, (L+R));
(%o9)                    showm([0, 1]) + showm([1, 0])
(%i10) block([m:[]], for i in k do (m:append(m, [show(i)])), return(m));
                                    0  1  1
(%o10)                             [-, -, -]
                                    1  1  0
(%i11) block([m:[]], for i in h do (m:append(m, [show(i)])), return(m));
                                 0  1  1  2  1
(%o11)                          [-, -, -, -, -]
                                 1  2  1  1  0
(%i12) block([m:[]], for i in n do (m:append(m, [show(i)])), return(m));
                              0  1  1  1  2  3  1
(%o12)                       [-, -, -, -, -, -, -]
                              1  3  2  1  1  1  0
(%i13) 
[append,block,buildq,declare,delete,do,false,first,floor,if,last,length,map,not,return,show,simp,true,while] [append,block,buildq,do,first,last,length,map,return,show,simp,true] [append,block,buildq,emptyp,ev,find_root,first,flatten,floor,kill,last,listp,makelist,not,rest,second,sin] [append,block,buildq,emptyp,find_root,first,flatten,floor,kill,lambda,last,listp,makelist,not,rest,second,sin] [append,block,buildq,emptyp,find_root,first,flatten,floor,kill,last,listp,makelist,not,rest,second,sin] [append,block,buildq,first,local,map,return,show,simp,true] [append,block,buildq,first,map,return,show,simp,true] [append,block,buildq,first,map,return,show,simp] [append,block,buildq,first,return,show,simp,true] [append,block,buildq,first,return,show,simp] [binomial,buildq,delta,determinant,expand,genmatrix,kron_delta] [binomial,buildq,delta,kron_delta,lambda] [binomial,buildq,delta,kron_delta] [block,buildq,first,show,simp,true] [block,buildq,first,show,simp] [block,buildq,indices,lambda,macroexpand,map,sublist_indices] [block,buildq,indices,lambda,macroexpand,sublist_indices] [block,buildq,lambda,macroexpand,map,sublist_indices] [block,buildq,show,simp] [buildq,exp,freeof,lambda,polynomialp] [buildq,first,lambda,map,second] [buildq,first,lambda,map] [buildq,freeof,lambda,polynomialp,var] [buildq,freeof,lambda,polynomialp] [buildq,freeof,lambda] [buildq,indices,lambda,macroexpand,sublist_indices] [buildq,indices,lambda,makelist,sublist_indices] [buildq,lambda,makelist] [buildq,map,values] [buildq,return] [buildq]

Related Help

Help for Buildq