Sponsored links: Algebra eBooks
 

Related

lmin-map

liste1 : [1, 4, 6...

liste2 : [ [3, 5]...

lmin (liste1);

Calculate

lmin-min

lmin([2,3]);

Calculate

lmin-map

liste1 : [1, 4, 6...

liste2 : [ [3, 5]...

lmin (liste1);

Calculate

lmin-min

lmin([2,3]);

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
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) 
Run Example
/* Enter the data */A:matrix([2,7.2],[4.5,7.1],[5.25,6],[7.81,5],[9.2,3.5],[10.6,5]);
                          [         2          7.2 ]
                          [                        ]
                          [        4.5         7.1 ]
                          [                        ]
                          [       5.25          6  ]
(%o1)                     [                        ]
                          [       7.81          5  ]
                          [                        ]
                          [ 9.199999999999999  3.5 ]
                          [                        ]
                          [       10.6          5  ]
(%i2) kmax:length(A)-1;
(%o2)                                  5
(%i3) x0:lmin(list_matrix_entries(submatrix(A,2)));
(%o3)                                  2
(%i4) x1:lmax(list_matrix_entries(submatrix(A,2)));
(%o4)                                10.6
(%i5) /* Nth order polynomial using Lagrangian interpolation */load(interpol);
(%o5)         /usr/share/maxima/5.21.1/share/numeric/interpol.mac
(%i6) f_nth: lagrange(A);
(%o6) 0.0045609540521954 (x - 9.199999999999999) (x - 7.81) (x - 5.25)
 (x - 4.5) (x - 2) - 0.013455435490014 (x - 10.6) (x - 7.81) (x - 5.25)
 (x - 4.5) (x - 2) + 0.026188275999857 (x - 10.6) (x - 9.199999999999999)
 (x - 5.25) (x - 4.5) (x - 2) - 0.045500459554642 (x - 10.6)
 (x - 9.199999999999999) (x - 7.81) (x - 4.5) (x - 2)
 + 0.039902617941917 (x - 10.6) (x - 9.199999999999999) (x - 7.81) (x - 5.25)
 (x - 2) - 0.0024632134466822 (x - 10.6) (x - 9.199999999999999) (x - 7.81)
 (x - 5.25) (x - 4.5)
(%i7) df_nth: sqrt(1+(diff(f_nth,x)^2));
(%o7) sqrt(expt(- 0.0088944814378182 (x - 7.81) (x - 5.25) (x - 4.5) (x - 2)
 + 0.030749230052053 (x - 9.199999999999999) (x - 5.25) (x - 4.5) (x - 2)
 + 0.012732840509843 (x - 10.6) (x - 5.25) (x - 4.5) (x - 2)
 - 0.040939505502446 (x - 9.199999999999999) (x - 7.81) (x - 4.5) (x - 2)
 - 0.058955895044655 (x - 10.6) (x - 7.81) (x - 4.5) (x - 2)
 - 0.019312183554784 (x - 10.6) (x - 9.199999999999999) (x - 4.5) (x - 2)
 + 0.044463571994113 (x - 9.199999999999999) (x - 7.81) (x - 5.25) (x - 2)
 + 0.026447182451904 (x - 10.6) (x - 7.81) (x - 5.25) (x - 2)
 + 0.066090893941774 (x - 10.6) (x - 9.199999999999999) (x - 5.25) (x - 2)
 - 0.0055978416127244 (x - 10.6) (x - 9.199999999999999) (x - 7.81) (x - 2)
 + 0.0020977406055132 (x - 9.199999999999999) (x - 7.81) (x - 5.25) (x - 4.5)
 - 0.015918648936696 (x - 10.6) (x - 7.81) (x - 5.25) (x - 4.5)
 + 0.023725062553175 (x - 10.6) (x - 9.199999999999999) (x - 5.25) (x - 4.5)
 - 0.047963673001324 (x - 10.6) (x - 9.199999999999999) (x - 7.81) (x - 4.5)
 + 0.037439404495235 (x - 10.6) (x - 9.199999999999999) (x - 7.81) (x - 5.25), 
2) + 1)
(%i8) L_nth:romberg(df_nth,x,x0,x1);
(%o8)                          14.91932689837202
(%i9) /* Cubic spline interpolation *//* Calculate the splines */f_cs:cspline(A);
                           3                     2
(%o9) (- 0.10128092075623 x  + 0.60768552453737 x  - 0.62236529434831 x
 + 6.824235856596975) charfun2(x, minf, 4.5)
                        3                      2
 + (- 0.32174713198646 x  + 10.23155879716957 x  - 106.7524702998754 x
 + 370.1642208786973) charfun2(x, 9.199999999999999, inf)
                      3                      2
 + (0.51190065309656 x  - 12.77712007112198 x  + 104.9273752884069 x
 - 278.9873055920348) charfun2(x, 7.81, 9.199999999999999)
                        3                      2
 + (- 0.21613033223407 x  + 4.280645915174853 x  - 28.29377706457142 x
 + 67.83176103355189) charfun2(x, 5.25, 7.81)
                      3                      2
 + (0.72720003918217 x  - 10.57680743463106 x  + 49.70785302190961 x
 - 68.67109161778993) charfun2(x, 4.5, 5.25)
(%i10) /* Pull out the cubic polynomial for each subinterval */h1[i,j]:=1;
(%o10)                            h1     := 1
                                    i, j
(%i11)  L_splines:0;
(%o11)                                 0
(%i12) f_splines: matrix([0]);
(%o12)                               [ 0 ]
(%i13) for k:1 thru kmax do    (   kill(h2,h3),        h2[i,j]:=A[k,1]+(i-1)/3*(A[k+1,1]-A[k,1]),         h3[i,j]:=ev(f_cs,x=C2[i,1]),        C1:genmatrix(h1,4,1), C2:genmatrix(h2,4,1), C3:C2^2, C4:C2^3,        C:addcol(C1,C2,C3,C4),        D:genmatrix(h3,4,1),        aCS:invert(C).D,        f_spline:matrix([1,x,x^2,x^3]).aCS,        f_splines:addrow(f_splines,[f_spline]),        df_spline:sqrt(1+(diff(f_spline,x))^2),        L_splines:L_splines+romberg(df_spline,x,A[k,1],A[k+1,1])    );
(%o13)                               done
(%i14) /* The result */f_splines:submatrix(1,f_splines);
                                   3                     2
(%o14) matrix([- 0.10128092075624 x  + 0.60768552453739 x  - 0.6223652943483 x
                                          3                      2
 + 6.824235856596928], [0.72720003918268 x  - 10.57680743463845 x
 + 49.70785302194418 x - 68.67109161785083], 
                     3                      2
[- 0.21613033223416 x  + 4.280645915174812 x  - 28.29377706457055 x
                                          3                      2
 + 67.83176103356539], [0.51190065306942 x  - 12.77712007045025 x
 + 104.9273752828524 x - 278.9873055767034], 
                     3                      2
[- 0.32174713192974 x  + 10.23155879530677 x  - 106.7524702812943 x
 + 370.164220821478])
(%i15) L_splines;
(%o15)                         11.24759514348632
(%i16) L_nth;
(%o16)                         14.91932689837202
(%i17) L_diff:(L_nth-L_splines)/L_nth * 100;
(%o17)                         24.61057244671245
(%i18) plot2d ([f_nth, f_cs], [x, x0, x1], [legend, "Nth Order Polynomial", "Cubic Splines"]);
plotplot2d ([f_nth, f_cs], [x, x0, x1], [legend, "Nth Order Polynomial", "Cubic Splines"]);

Related Help

Help for Lmin