Sponsored links: Algebra eBooks
 

Related

lmin

/* QUESTION VARIABLES...

d1:d/1000;

g:50;

Calculate

lmin-map

liste1 : [1, 4, 6...

liste2 : [ [3, 5]...

lmin (liste1);

Calculate

lmin-min

lmin([2,3]);

Calculate

lmin

/* QUESTION VARIABLES...

d1:d/1000;

g:50;

Calculate

lmin

/* QUESTION VARIABLES...

d1:d/1000;

g:50;

Calculate

lmin-map

liste1 : [1, 4, 6...

liste2 : [ [3, 5]...

lmin (liste1);

Calculate

lmin-min

lmin([2,3]);

Calculate

lmin

/* QUESTION VARIABLES...

d1:d/1000;

g:50;

Calculate

lmin

Run Example
(%i1)deg: %pi/180;
                                      %pi
(%o1)                                 ---
                                      180
(%i2) L1:Rax-F2*cos(30*deg)+F4*cos(45*deg)=0;
                          F4      sqrt(3) F2
(%o2)                   ------- - ---------- + Rax = 0
                        sqrt(2)       2
(%i3) L2:-Rcc1*cos(30*deg)-F4*cos(45*deg)+Ray+Rby=0;
                       F4      sqrt(3) Rcc1
(%o3)              - ------- - ------------ + Rby + Ray = 0
                     sqrt(2)        2
(%i4) L3:Raz+Rbz+F2*sin(30*deg)+Rcc1*sin(30*deg)-Gmin-Gmax=0;
                    F2   Rcc1
(%o4)               -- + ---- + Rbz + Raz - Gmin - Gmax = 0
                    2     2
(%i5) L4:Rcc1*sin(30*deg)*3*a+F2*cos(60*deg)*3*a-F4*sin(45*deg)*a-Gmax*1.5*a-Gmin*3*a=0;
              a F4     3 a F2   3 a Rcc1
(%o5)      - ------- + ------ + -------- - 3 a Gmin - 1.5 a Gmax = 0
             sqrt(2)     2         2
(%i6) L5:-F2*cos(60*deg)*2*a+F2*sin(60*deg)*0.5*a-F4*cos(45*deg)*a-Rbz*2*a+Gmax*a+Gmin*a=0;
         a F4
(%o6) - ------- + 0.25 sqrt(3) a F2 - a F2 - 2 a Rbz + a Gmin + a Gmax = 0
        sqrt(2)
(%i7) L6:-M+F2*sin(60*deg)*3*a-F4*sin(45*deg)*a-F4*cos(45*deg)*3*a+Rby*2*a=0;
                                      3/2
                          3/2        3    a F2
(%o7)              - M - 2    a F4 + --------- + 2 a Rby = 0
                                         2
(%i8) Gmax:12.0;
(%o8)                                12.0
(%i9) Gmin:4.00;
(%o9)                                 4.0
(%i10) a:0.5;
(%o10)                                0.5
(%i11) M:6.0;
(%o11)                                6.0
(%i12) F2:11.0;
(%o12)                               11.0
(%i13) F4:11.0;
(%o13)                               11.0
(%i14) ats:solve([L1,L2,L3,L4,L5,L6],[Rax,Ray,Raz,Rby,Rbz,Rcc1]);

rat: replaced 11.0 by 11/1 = 11.0

rat: replaced -5.5 by -11/2 = -5.5

rat: replaced -11.0 by -11/1 = -11.0

rat: replaced -10.5 by -21/2 = -10.5

rat: replaced -6.75 by -27/4 = -6.75

rat: replaced -5.5 by -11/2 = -5.5

rat: replaced 0.75 by 3/4 = 0.75

rat: replaced 2.5 by 5/2 = 2.5

rat: replaced -5.5 by -11/2 = -5.5

rat: replaced 1.375 by 11/8 = 1.375

rat: replaced -1.0 by -1/1 = -1.0

rat: replaced -6.0 by -6/1 = -6.0

rat: replaced -5.5 by -11/2 = -5.5

rat: replaced 2.75 by 11/4 = 2.75

rat: replaced 1.0 by 1/1 = 1.0
               11 sqrt(3) - 11 sqrt(2)
(%o14) [[Rax = -----------------------, 
                          2
           3/2                      3/2                   3/2       3/2
      (11 2    + 153) sqrt(3) - 33 2    - 72          11 3    - 11 2    - 84
Ray = --------------------------------------, Raz = - ----------------------, 
                        12                                      24
            3/2       5/2                              3/2
        11 3    - 11 2    - 24        11 sqrt(3) - 11 2    + 20
Rby = - ----------------------, Rbz = -------------------------, 
                  4                               8
       11 sqrt(2) + 27
Rcc1 = ---------------]]
              3
(%i15) float(ats);
(%o15) [[Rax = 1.748104848576801, Ray = 12.79620439855365, 
Raz = 2.414792571768131, Rby = 7.266930023660818, Rbz = 0.99248256388119, 
Rcc1 = 14.18544972870135]]
(%i16) /*suprastiname rezutatus*/deg: %pi/180;
                                      %pi
(%o16)                                ---
                                      180
(%i17) Rcc1:14.2;
(%o17)                               14.2
(%i18) Rax:1.748;
(%o18)                               1.748
(%i19) Ray:12.796;
(%o19)                              12.796
(%i20) Raz:2.41;
(%o20)                               2.41
(%i21) Rby:7.27;
(%o21)                               7.27
(%i22) Rbz:1;
(%o22)                                 1
(%i23) delta:-Ray+Rax+Rcc1*cos(30*deg)+F2*sin(60*deg)*0.5+F4*sin(45*deg)*0.5-F4*cos(45*deg)*a-M;
(%o23)                       9.85 sqrt(3) - 17.048
(%i24) float(delta);
(%o24)                         0.012700454553439
(%i25) Mmin:lmin(abs([-Ray,+Rax,+Rcc1*cos(30*deg),+F2*sin(60*deg)*0.5,+F4*sin(45*deg)*0.5,-F4*cos(45*deg)*a,-M]));

rat: replaced 1.748 by 437/250 = 1.748

rat: replaced -2.75 by -11/4 = -2.75

rat: replaced 1.748 by 437/250 = 1.748

rat: replaced -7.1 by -71/10 = -7.1

rat: replaced 1.748 by 437/250 = 1.748

rat: replaced -5.5 by -11/2 = -5.5
(%o25)                               1.748
(%i26) 
Run Example
nk : 2;
(%o1)                                  2
(%i2) nl : 2;
(%o2)                                  2
(%i3) N : 8;
(%o3)                                  8
(%i4) sp : 2;
(%o4)                                  2
(%i5) r[1] : matrix([0,1],[0,0]);
                                   [ 0  1 ]
(%o5)                              [      ]
                                   [ 0  0 ]
(%i6) r[2] : matrix([1,0],[1,1]);
                                   [ 1  0 ]
(%o6)                              [      ]
                                   [ 1  1 ]
(%i7) norm(M) := block(    n1 : length(M),    n2 : length(transpose(M)),    sqrt( sum(sum( M[i,j]^2, i,1,n1 ), j,1,n2) ));
(%o7) norm(M) := block(n1 : length(M), n2 : length(transpose(M)), 
                                                   2
                                     sqrt(sum(sum(M    , i, 1, n1), j, 1, n2)))
                                                   i, j
(%i8) minM(M) := lmin(makelist(lmin(M[i]),i,1,length(M)));
(%o8)        minM(M) := lmin(makelist(lmin(M ), i, 1, length(M)))
                                            i
(%i9) maxM(M) := lmax(makelist(lmax(M[i]),i,1,length(M)));
(%o9)        maxM(M) := lmax(makelist(lmax(M ), i, 1, length(M)))
                                            i
(%i10) f_randM : lambda([i,j], random(1.0));
(%o10)                    lambda([i, j], random(1.0))
(%i11) randM(n1,n2) := block(	M : genmatrix(f_randM,n1,n2),	M/norm(M));
                                                                  M
(%o11)  randM(n1, n2) := block(M : genmatrix(f_randM, n1, n2), -------)
                                                               norm(M)
(%i12) I : makelist(randM(nk,nl),j,1,N);
        [ 0.82322407301623  0.17583605613432 ]
(%o12) [[                                    ], 
        [ 0.43457137331563  0.32020544727451 ]
[ 0.21952812194026  0.36167186147605 ]
[                                    ], 
[ 0.53313429406549  0.73264499778892 ]
[ 0.48026238685182   0.64447503912071 ]
[                                     ], 
[ 0.034570224803372  0.59397379006384 ]
[ 0.7530697407959   0.031517169526439 ]
[                                     ], 
[ 0.47941627913502  0.44950268611319  ]
[ 0.81023067820622    0.58257038776883  ]
[                                       ], 
[ 0.064262670173717  0.0028810780119023 ]
[ 0.25255783446655  0.68837898710734 ]
[                                    ], 
[ 0.03366193469293  0.67912869510231 ]
[ 0.18056446560732  0.53563383884197 ]  [  0.137936134655   0.57827798704525 ]
[                                    ], [                                    ]]
[ 0.47397374812705  0.67516053686049 ]  [ 0.59860794175974  0.53687682434382 ]
(%i13) f_A[j,i] := sum(sum( r[i][k,l]*I[j][k,l], k,1,nk),l,1,nl);
(%o13)    f_A     := sum(sum((r )     (I )    , k, 1, nk), l, 1, nl)
             j, i              i        j
                                 k, l     k, l
(%i14) A : genmatrix( f_A, N, sp);
                   [ 0.17583605613432   1.578000893606369 ]
                   [                                      ]
                   [ 0.36167186147605   1.485307413794671 ]
                   [                                      ]
                   [ 0.64447503912071   1.108806401719027 ]
                   [                                      ]
                   [ 0.031517169526439  1.68198870604411  ]
(%o14)             [                                      ]
                   [ 0.58257038776883   0.87737442639184  ]
                   [                                      ]
                   [ 0.68837898710734   0.96534846426179  ]
                   [                                      ]
                   [ 0.53563383884197   1.329698750594861 ]
                   [                                      ]
                   [ 0.57827798704525   1.273420900758558 ]
(%i15) f_r[k,l,i] := 1/N * sum(A[j,i]*I[j][k,l],j,1,N) - 1/N^2 * sum(A[j,i],j,1,N) * sum(I[j][k,l],j,1,N);
                     1
(%o15) f_r        := - sum(A     (I )    , j, 1, N)
          k, l, i    N      j, i   j
                                     k, l
                                  1
                                - -- sum(A    , j, 1, N) sum((I )    , j, 1, N)
                                   2      j, i                 j
                                  N                              k, l
(%i16) f_r_1[k,l] := f_r[k,l,1];
(%o16)                      f_r_1     := f_r
                                 k, l       k, l, 1
(%i17) f_r_2[k,l] := f_r[k,l,2];
(%o17)                      f_r_2     := f_r
                                 k, l       k, l, 2
(%i18) r1[1] : genmatrix(f_r_1,nk,nl);
                  [ - 0.033164218778771  0.049262957284976  ]
(%o18)            [                                         ]
                  [ - 0.028209462239734  0.0080846687898183 ]
(%i19) r1[2] : genmatrix(f_r_2,nk,nl);
                  [ 0.010734172721221  - 0.053289012228687 ]
(%o19)            [                                        ]
                  [ 0.048629908178604   0.013765273691331  ]
(%i20) min1 : min(minM(r1[1]),minM(r1[2]));
(%o20)                        - 0.053289012228687
(%i21) max1 : max(maxM(r1[1]),minM(r1[2]));
(%o21)                         0.049262957284976
(%i22) r1[1] : (r1[1]-min1)/(max1-min1);
                    [ 0.19623995078158        1.0        ]
(%o22)              [                                    ]
                    [ 0.24455454252013  0.59846418659301 ]
(%i23) r1[2] : (r1[2]-min1)/(max1-min1);
                    [ 0.62429990621856        0.0        ]
(%o23)              [                                    ]
                    [ 0.99382704096884  0.65385663715687 ]
(%i24) abs(r1[1]-r[1]);
                 [ 0.19623995078158  1.1102230246251565E-16 ]
(%o24)           [                                          ]
                 [ 0.24455454252013     0.59846418659301    ]
(%i25) abs(r1[2]-r[2]);
                   [  0.37570009378144         0.0        ]
(%o25)             [                                      ]
                   [ 0.0061729590311589  0.34614336284313 ]
(%i26) 
Run Example
cut(l,m,k,h,[p]):=block( cut_segment(l, m, k, [p]):=block( elimn(l,index):=block([ans, indi:map("=", index, makelist(0, n, 1, length(index)))], ans:subst([0="_"], l*subst(indi, makelist(n, n, 1, length(l)))/makelist(n, n, 1, length(l))), if(not(emptyp(p))) then return(delete("_", ans)) else return(ans)), elimn(l, makelist(n, n, m, k))), cut_flanks(l, m, k, [p]):=block( elimn(l,index):=block([ans, indi:map("=", index, makelist(0, n, 1, length(index)))], ans:subst([0="_"], l*map(lambda([x], if(x=1) then 0 else 1), subst(indi, makelist(n, n, 1, length(l)))/makelist(n, n, 1, length(l)))), if(not(emptyp(p))) then return(delete("_", ans)) else return(ans)), elimn(l, makelist(n, n, m, k))), if(h=s and emptyp(p)) then return(cut_flanks(l,m,k)) else if(h=s and not(emptyp(p))) then return(cut_flanks(l,m,k,t)) else if(h=f and emptyp(p)) then return(cut_segment(l,m,k)) else if(h=f and not(emptyp(p))) then return(cut_segment(l,m,k,t)));
(%o1) cut(l, m, k, h, [p]) := block(cut_segment(l, m, k, [p]) := 
block(elimn(l, index) := block([ans, indi : 
map("=", index, makelist(0, n, 1, length(index)))], 
                       l subst(indi, makelist(n, n, 1, length(l)))
ans : subst([0 = "_"], -------------------------------------------), 
                              makelist(n, n, 1, length(l))
if not emptyp(p) then return(delete("_", ans)) else return(ans)), 
elimn(l, makelist(n, n, m, k))), cut_flanks(l, m, k, [p]) := 
block(elimn(l, index) := block([ans, indi : 
map("=", index, makelist(0, n, 1, length(index)))], 
ans : subst([0 = "_"], l map(lambda([x], if x = 1 then 0 else 1), 
subst(indi, makelist(n, n, 1, length(l)))
-----------------------------------------)), 
      makelist(n, n, 1, length(l))
if not emptyp(p) then return(delete("_", ans)) else return(ans)), 
elimn(l, makelist(n, n, m, k))), if (h = s) and emptyp(p)
 then return(cut_flanks(l, m, k)) else (if (h = s) and (not emptyp(p))
 then return(cut_flanks(l, m, k, t)) else (if (h = f) and emptyp(p)
 then return(cut_segment(l, m, k)) else (if (h = f) and (not emptyp(p))
 then return(cut_segment(l, m, k, t))))))
(%i2) find(s,l,h,[p]):=block([ans:[], rep:[], final:[], parts:makelist(part(l, makelist(n, n, 1+m, length(s)+m)), m, 0, length(l)-length(s)), res, count:0, pos:[]], for n:1 thru length(parts) do  (ans:append(ans, [map(lambda([x], if(is(x)) then lhs(x)), map("=", part(parts, n), s))])), for i in ans do (if(freeof(false, i)) then (res:i)), count:length(delete([], map(lambda([x], if(freeof(false, x)) then x else []), ans))), for i:1 thru length(ans) do (if(freeof(false, ans[i])) then pos:append(pos, [[i, i+length(ans[i])-1]])), if(h=f) then (if(not(emptyp(p))) then print(ans) else (print(res, ":", count), [pos])) else (for i in pos do (rep:append(rep, makelist(n, n, lmin(i), lmax(i)))), final:map(lambda([x], if(member(x, rep)) then l[x] else "_"), sublist_indices(l, atom)), return(final)));
(%o2) find(s, l, h, [p]) := block([ans : [], rep : [], final : [], 
parts : makelist(part(l, makelist(n, n, 1 + m, length(s) + m)), m, 0, 
length(l) - length(s)), res, count : 0, pos : []], 
for n thru length(parts) do ans : append(ans, 
[map(lambda([x], if is(x) then lhs(x)), map("=", part(parts, n), s))]), 
for i in ans do if freeof(false, i) then res : i, 
count : length(delete([], map(lambda([x], if freeof(false, x) then x else []), 
ans))), for i thru length(ans) do if freeof(false, ans )
                                                      i
 then pos : append(pos, [[i, i + length(ans ) - 1]]), 
                                           i
if h = f then (if not emptyp(p) then print(ans)
 else (print(res, ":", count), [pos])) else (for i in pos do rep : 
append(rep, makelist(n, n, lmin(i), lmax(i))), 
final : map(lambda([x], if member(x, rep) then l  else "_"), 
                                                x
sublist_indices(l, atom)), return(final)))
(%i3) M:[C,A,T,G,C,A,T,C,A];
(%o3)                     [C, A, T, G, C, A, T, C, A]
(%i4) M;
(%o4)                     [C, A, T, G, C, A, T, C, A]
(%i5) "";
(%o5) 
(%i6) find([C,A,T], M, f);
[C, A, T] : 2 
(%o6)                         [[[1, 3], [5, 7]]]
(%i7) "";
(%o7) 
(%i8) find([C,A,T], M, t);
(%o8)                     [C, A, T, _, C, A, T, _, _]
(%i9) cut(M, 1, 3, s);
(%o9)                     [C, A, T, _, _, _, _, _, _]
(%i10) cut(M, 5, 7, s);
(%o10)                    [_, _, _, _, C, A, T, _, _]
(%i11) cut(M, 8, 10, s);
(%o11)                    [_, _, _, _, _, _, _, C, A]
(%i12) find([C, A, T], M, f);
[C, A, T] : 2 
(%o12)                        [[[1, 3], [5, 7]]]
(%i13) 

Related Help

Help for Lmin