Sponsored links: Algebra eBooks
 

Related

block-charlist-length-load-makelist-map-string

f(x):=block(z:x,z:cha...

ergebnisse:makelist(f...

load(descriptive);

Calculate

block

complex_SU(z):=block(...

angle(z,w):=block([],...

z:[2,1];

Calculate

block-load-mod-power_mod-primep-totient

p:1111111111111111111;

nod(a, b):=block(load...

primep(p);

Calculate

block-do-fix-if-mod-while

block(n: 9999,n1:n,r:...

Calculate

block

complex_S(z):=block([...

angle(z,w):=block([],...

z:[1,0.5];

Calculate

block-do-echelon-matrix_size-min-return-rowop

rref(a):=block([p,q,k...

M:Matrix ([2,1,1,1],[...

Calculate

block-return

xxx(a,b):=block(retur...

xxx(x,[1]);

xxx(b,[1]);

Calculate

block-expand-hipow-listofvars-makelist-part-print-sum

diffetak(n,eta,[idx])...

diffetak(3,eta,1);

Calculate

block-do-float-round

a:75.47;

b:321227;

hbtssn(n):=block([p, ...

Calculate

block-modulus-submatrix

modulus:2;

N:2;

block( P:0, for i: ...

Calculate

block

Run Example
(%i1)rat(0.1234);

rat: replaced 0.1234 by 617/5000 = 0.1234
                                     617
(%o1)/R/                             ----
                                     5000
(%i2) rat(0.12345);

rat: replaced 0.12345 by 2469/20000 = 0.12345
                                     2469
(%o2)/R/                             -----
                                     20000
(%i3) rat(0.12345);

rat: replaced 0.12345 by 2469/20000 = 0.12345
                                     2469
(%o3)/R/                             -----
                                     20000
(%i4) mod(12345, 1000)/100000, numer;
(%o4)                               0.00345
(%i5) lastdigits(fnum, lastn):=block([m:10*fnum, ans, n:lastn], /* it doesn't help when lastn is bigger than the total digits in fnum it returns the whole digits in fnum anyway without erroring! and fnum=%pi stuff works only upto 8 digits cause num(rat(fnum)) has somuch only! */ratprint:false, k:rat(fnum), ans:mod(m, (10^-n))/(mod(m, 10)*denom(k)), return(float(ans)));
(%o5) lastdigits(fnum, lastn) := block([m : 10 fnum, ans, n : lastn], 
                                                   - n
                                          mod(m, 10   )
ratprint : false, k : rat(fnum), ans : -------------------, return(float(ans)))
                                       mod(m, 10) denom(k)
(%i6) lastdigits(0.12345, 3);
(%o6)                        2.0251113811259619E-8
(%i7) 
Run Example
intervals(items):=block([result],  result: if (emptyp(items)) then [] else           if(listp(items)) then          if(emptyp(rest(items))) then [] else          cons(cons(first(items),  [second(items)]),          intervals(rest(items))));
(%o1) intervals(items) := block([result], 
result : if emptyp(items) then [] else (if listp(items)
 then (if emptyp(rest(items)) then [] else cons(cons(first(items), 
[second(items)]), intervals(rest(items))))))
(%i2) intervals(makelist(n, n, 1, 10));
(%o2) [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]
(%i3) intervals(makelist(n, n, 1, 11));
(%o3) [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], 
                                                             [9, 10], [10, 11]]
(%i4) ans:errcatch(find_root(sin(x), x, 2, 3));

find_root: function has same sign at endpoints: f(2.0) = 0.90929742682568, 
                                                      f(3.0) = 0.14112000805987
(%o4)                                 []
(%i5) ans;
(%o5)                                 []
(%i6) 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([])));
(%o6) 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([])))
(%i7) intervals(seq(0,7,1));
(%o7) [[0.0, 1.0], [1.0, 2.0], [2.0, 3.0], [3.0, 4.0], [4.0, 5.0], [5.0, 6.0], 
                                                                    [6.0, 7.0]]
(%i8) ans:[];
(%o8)                                 []
(%i9) %pi;
(%o9)                                 %pi
(%i10) %pi, numer;
(%o10)                         3.141592653589793
(%i11) 2*3.14159/%pi;
                                    6.28318
(%o11)                              -------
                                      %pi
(%i12) block([ans:[]], errormsg:false, for i in intervals(seq(0, 7, 1)) do ans:(append(ans, errcatch(find_root(sin(x), x, first(i), second(i))))), errormsg:true, return(ans));
(%o12)            [0.0, 3.141592653589793, 6.283185307179586]
(%i13) 
Run Example
umrechnung:[];
(%o1)                                 []
(%i2) basis:8;
(%o2)                                  8
(%i3) x[0]:119.0625;
(%o3)                              119.0625
(%i4) x[n]:=block(q:[floor(x[n-1]/basis),mod(x[n-1],basis)],umrechnung:append(umrechnung,[q[2]]),x[n-1]: q[1]);
                             x
                              n - 1
(%o4) x  := block(q : [floor(------), mod(x     , basis)], 
       n                     basis         n - 1
                            umrechnung : append(umrechnung, [q ]), x      : q )
                                                              2     n - 1    1
(%i5) makelist(x[i],i,1,4);
(%o5)                            [14, 1, 0, 0]
(%i6) hexzahl:reverse(umrechnung);
(%o6)                          [0, 1, 6, 7.0625]
(%i7) konverter(x):=if x=10 then "A"else if x=11 then "B"else if x=12 then "C"else if x=13then "D"else if x=14 then "E"else if x=15 then "F"else x;
(%o7) konverter(x) := if x = 10 then "A"
 else (if x = 11 then "B" else (if x = 12 then "C"
 else (if x = 13 then "D" else (if x = 14 then "E"
 else (if x = 15 then "F" else x)))))
(%i8) map(konverter,hexzahl);
(%o8)                          [0, 1, 6, 7.0625]
(%i9) var1:hexzahl[1]*1000+hexzahl[2]*100+hexzahl[3]*10+hexzahl[4];
(%o9)                              167.0625
(%i10) 
[append,args,block,globalsolve,modulus,submatrix,xreduce] [append,ascii,block,concat,copylist,delete,divsum,first,if,make_random_state,next_prime,second,set_random_state,slength,substring,true] [append,ascii,block,concat,delete,divsum,first,if,make_random_state,next_prime,second,set_random_state,slength,substring,true] [append,ascii,block,copylist,delete,divsum,first,if,make_random_state,next_prime,print,sconcat,second,set_random_state,slength,substring,true] [append,atom,block,delete,do,emptyp,freeof,if,indices,lambda,length,lmax,lmin,makelist,map,member,not,sublist_indices,subst] [append,atom,block,delete,flatten,if,lambda,load,map,return] [append,block,buildq,emptyp,find_root,first,flatten,floor,kill,last,listp,makelist,not,rest,second,sin] [append,block,buildq,first,return,show,simp] [append,block,declare,do,factor,if,lsum] [append,block,declare,do,factor,lsum] [append,block,delete,do,emptyp,if,lambda,length,makelist,map,not,subst] [append,block,do,flatten,load,makelist,return] [append,block,emptyp,find_root,first,flatten,floor,kill,last,listp,makelist,not,rest,second,sin] [append,block,listify,makelist,primep,return,setify] [args,asin,atan2,block,cos,flatten,float,ident,length,make_random_state,makelist,matrix,set_random_state,sin,sqrt,subst,transpose] [bern,bfloat,block,fpprec,makelist,numer,return,sum] [bfloat,bftorat,block,ev,float2bf,makelist,mod,ratepsilon,ratprint,return] [bfloat,bftorat,block,float2bf,makelist,mod,ratepsilon,ratprint,return] [bfloat,binomial,block,distrib,floor,load,sum] [bfloat,block,denom,false,float,mod,ratexpand,ratprint] [bftorat,block,delete,ev,false,float,if,integerp,mod,ratdenom,ratepsilon,ratprint] [bftorat,block,delete,float,if,integerp,mod,rat,ratdenom,ratepsilon,ratprint] [bftorat,block,ev,false,float2bf,fpprec,if,integerp,kill,mod,ratdenom,ratepsilon,ratprint,return] [bftorat,block,false,float2bf,fpprec,if,integerp,kill,mod,ratdenom,ratepsilon,ratprint,return] [binomial,block,delta,determinant,do,expand,genmatrix,kron_delta,return] [block,concat,do,kill,makelist,obase,return,stringdisp,true,while] [block,cos,flatten,if,li,load,makelist,map,numer,outermap,plot2d,sin,sort,unique] [block,cos,plot2d,quad_qags,sin] [block,depends,diff,exp,first,rhs,solve,subst] [block,display,fpprec,fpprintprec,jacobi,printf,return] [block,display,fpprec,fpprintprec,return] [block,do,float,round] [block,do,if,length,while] [block,do,indices,lambda,makelist,map,mod,print,sublist_indices] [block,do,makelist,plot2d,while] [block,do,mod,return,while] [block,do,round] [block,do] [block,float] [block,if,load,primep] [block,if] [block,inv_mod,mod,print] [block,inv_mod,print,while] [block,length,ratsimp,sum,tab] [block,load,mod,power_mod,primep,totient] [block,load,primep] [block,plot2d] [block,print,random] [block,return] [block]

Related Help

Help for Block