Related

last-matrix-ratsimp-solve-sqrt

f(x):= (1/2)*matrix([...

o: [0,0];

p: ratsimp(f(o));

Calculate

last-matrix-plot2d-ratsimp-solve-sqrt

f(x):= (1/2)*matrix([...

o: [0,0];

p: ratsimp(f(o));

Calculate

e1:z=(b2*h2^3-b1*(h2-...

s1:solve([e1],[h2]);

s2:last(s1);

Calculate

last;

Calculate

omegazero:4;

x0:1.0;

vx0:2;

Calculate

last-length

koe:[1,2,5,8];

loppukaksi(lista):=[l...

loppukaksi(koe);

Calculate

last-makelist-numer-plot2d-rk

g:10;

r0:rk([v,-g],[x,v],[0...

last(r0);

Calculate

last-length

koe:[1,2,5,8];

loppukaksi(lista):=[l...

loppukaksi(koe);

Calculate

last-numer-rk

g:10;

ro: rk([v,-g],[x,v],[...

last(ro);

Calculate

last-matrix-ratsimp-solve-sqrt

f(x):= (1/2)*matrix([...

o: [0,0];

p: ratsimp(f(o));

Calculate

last

Run Example
```(%i1)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]):=map(lambda([x], [first(x), second(x)]),list);
(%o9)    test([list]) := map(lambda([x], [first(x), second(x)]), list)
(%i10) find_root(sin(x), x, 0, %pi);
(%o10)                                0.0
(%i11) ```
Run Example
```elim(l,m,k, [p]):=block([ans], ans:subst([0="_"], l*subst([m=0, k=0], makelist(n, n, 1, length(l)))/makelist(n, n,1,length(l))), if(not(emptyp(p))) then return(delete("_", ans)) else return(ans));
(%o1) elim(l, m, k, [p]) := block([ans],
l subst([m = 0, k = 0], 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))
(%i2) elimcc(l,m,k, [p]):=block([ans], ans:subst([0="_"],l*map(lambda([x], if(x=0) then 1 else 0), subst([m=0, k=0], makelist(n, n, 1, length(l)))/makelist(n, n,1,length(l)))), if(not(emptyp(p))) then return(delete("_", ans)) else return(ans));
(%o2) elimcc(l, m, k, [p]) := block([ans],
ans : subst([0 = "_"], l map(lambda([x], if x = 0 then 1 else 0),
subst([m = 0, k = 0], makelist(n, n, 1, length(l)))
---------------------------------------------------)),
makelist(n, n, 1, length(l))
if not emptyp(p) then return(delete("_", ans)) else return(ans))
(%i3) M:[A,T,G,C,A,T,C];
(%o3)                        [A, T, G, C, A, T, C]
(%i4) elim(M, 1, 7);
(%o4)                        [_, T, G, C, A, T, _]
(%i5) elim(M, 1, 7, t);
(%o5)                           [T, G, C, A, T]
(%i6) elimcc(M, 1, 7);
(%o6)                        [A, _, _, _, _, _, C]
(%i7) elimcc(M, 1, 7, t);
(%o7)                               [A, C]
(%i8) elimn(l,[index]):=block([ans, indi:map("=", index, delete([], 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(is(last(index)=t)) then return(delete("_", ans)) else return(ans));
(%o8) elimn(l, [index]) := block([ans,
indi : map("=", index, delete([], 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 is(last(index) = t) then return(delete("_", ans)) else return(ans))
(%i9) M:[A,T,G,C,A,T,C];
(%o9)                        [A, T, G, C, A, T, C]
(%i10) elimn(M, 1, 3, 7);
(%o10)                       [_, T, _, C, A, T, _]
(%i11) elimn(M, 1, 3, 7, t);
(%o11)                           [T, C, A, T]
(%i12) elimn(l,index):=block([ans, indi:map("=", index, delete([], 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(is(last(index)=t)) then return(delete("_", ans)) else return(ans));
(%o12) elimn(l, index) := block([ans, indi :
map("=", index, delete([], 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 is(last(index) = t) then return(delete("_", ans)) else return(ans))
(%i13) segment(l,m,k):=block(elimn(l,index):=block([ans, indi:map("=", index, delete([], 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(is(last(index)=t)) then return(delete("_", ans)) else return(ans)), elimn(l, makelist(n, n, m, k)));
(%o13) segment(l, m, k) := block(elimn(l, index) :=
block([ans, indi : map("=", index, delete([],
makelist(0, n, 1, length(index))))], ans :
l subst(indi, makelist(n, n, 1, length(l)))
subst([0 = "_"], -------------------------------------------),
makelist(n, n, 1, length(l))
if is(last(index) = t) then return(delete("_", ans)) else return(ans)),
elimn(l, makelist(n, n, m, k)))
(%i14) segment(M, 2, 5);
(%o14)                       [A, _, _, _, _, T, C]
(%i15) elim_segment(l,m,k,[p]):=block(elimn(l,index):=block([ans, indi:map("=", index, delete([], 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)));
(%o15) elim_segment(l, m, k, [p]) := block(elimn(l, index) :=
block([ans, indi : map("=", index, delete([],
makelist(0, n, 1, length(index))))], ans :
l subst(indi, makelist(n, n, 1, length(l)))
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)))
(%i16) elim_segment(M, 2, 5);
(%o16)                       [A, _, _, _, _, T, C]
(%i17) elim_segment(M, 2, 5, t);
(%o17)                             [A, T, C]
(%i18) retain_segment(l,m,k,[p]):=block(elimn(l,index):=block([ans, indi:map("=", index, delete([], makelist(0, n, 1, length(index))))], ans:subst([0="_"], l*map(lambda([x], if(x=0) then 1 else 0), 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)));
(%o18) retain_segment(l, m, k, [p]) :=
block(elimn(l, index) := block([ans, indi :
map("=", index, delete([], makelist(0, n, 1, length(index))))],
ans : subst([0 = "_"], l map(lambda([x], if x = 0 then 1 else 0),
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)))
(%i19) retain_segment(M, 2, 5);
(%o19)                       [_, T, G, C, A, _, _]
(%i20) retain_segment(M, 2, 5, t);
(%o20)                           [T, G, C, A]
(%i21) 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)));
(%o21) 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))))))
(%i22) ```
Run Example
```lista:[2,5,-2,1];
(%o1)                           [2, 5, - 2, 1]
(%i2) last(lista);
(%o2)                                  1
(%i3) ```

Help for Last