Sponsored links: Algebra eBooks
 

Related

linear

linear(vds,vgsvth) :=...

Calculate

linear

? linear ;

Calculate

linear

linear(vds,vgsvth) :=...

Calculate

linear

? linear ;

Calculate

linear

Run Example
(%i1)remvalue(n,z);
(%o1)                           [false, false]
(%i2) matchdeclare(a,lambda([x],freeof(x,n)));
(%o2)                                done
(%i3) matchdeclare(b,lambda([x],freeof(x,n) and integerp(x) and x>
0));
(%o3)                                done
(%i4) matchdeclare(f,all);
(%o4)                                done
(%i5) matchdeclare(g,lambda([x],freeof(n-1,x)));
(%o5)                                done
(%i6) defrule(r1,zt(1,n,z),z/(z-1));
                                                 z
(%o6)                      r1 : zt(1, n, z) -> -----
                                               z - 1
(%i7) defrule(r2,zt(n,n,z),z/(z-1)^2);
                                                z
(%o7)                    r2 : zt(n, n, z) -> --------
                                                    2
                                             (z - 1)
(%i8) defrule(r3,zt(1/n,n,z),log(z/(z-1)));
                                1                 z
(%o8)                   r3 : zt(-, n, z) -> log(-----)
                                n               z - 1
(%i9) defrule(r4,zt(a^n,n,z),z/(z-a));
                                   n             z
(%o9)                     r4 : zt(a , n, z) -> -----
                                               z - a
(%i10) defrule(r5,zt(a^(n-1),n,z),1/(z-a));
                                 n - 1             1
(%o10)                  r5 : zt(a     , n, z) -> -----
                                                 z - a
(%i11) defrule(r6,zt(binomial(n,b),n,z),z/(z-1)^(b+1));
                                                       - b - 1
(%o11)         r6 : zt(binomial(n, b), n, z) -> (z - 1)        z
(%i12) defrule(r7,zt(n^b,n,z),block([tmp:z/(z-1)],  for i:1 thru b do tmp:-z*diff(tmp,z),  factor(tmp)));
                b                          z
(%o12) r7 : zt(n , n, z) -> block([tmp : -----], 
                                         z - 1
                           for i thru b do tmp : - diff(tmp, z) z, factor(tmp))
(%i13) defrule(r8,zt(sin(a*n),n,z),z*'sin(a)/((z^2-2*z*'cos(a)+1)));
                                                sin(a) z
(%o13)          r8 : zt(sin(a n), n, z) -> -------------------
                                            2
                                           z  - 2 cos(a) z + 1
(%i14) defrule(r9,zt(cos(a*n),n,z),z*(z-'cos(a))/(z^2-2*z*'cos(a)+1));
                                             z (z - cos(a))
(%o14)          r9 : zt(cos(a n), n, z) -> -------------------
                                            2
                                           z  - 2 cos(a) z + 1
(%i15) defrule(r10,zt(kron_delta(b,n),n,z),1/z^b);
                                                        1
(%o15)              r10 : zt(kron_delta(b, n), n, z) -> --
                                                         b
                                                        z
(%i16) defrule(r11,zt(a^n*f,n,z),'subst(z/a,z,ztrans(f,n,z)));
                     n                        z
(%o16)     r11 : zt(a  f, n, z) -> substitute(-, z, ztrans(f, n, z))
                                              a
(%i17) defrule(r12,zt(n^b*g,n,z),block([tmp:ztrans(g,n,z)],  for i:1 thru b do tmp:-z*'diff(tmp,z),  return(tmp)));
                   b
(%o17) r12 : zt(g n , n, z) -> block([tmp : ztrans(g, n, z)], 
                                                           dtmp
                                   for i thru b do tmp : - ---- z, return(tmp))
                                                            dz
(%i18) defrule(r13,zt(exp(-a*n),n,z),z/(z-exp(-a)));
                                - a n               z
(%o18)               r13 : zt(%e     , n, z) -> ---------
                                                      - a
                                                z - %e
(%i19) defrule(r14,zt(f(n-m),n,z),z^(-m)*ztrans(f(n),n,z));
                                            ztrans(f(n), n, z)
(%o19)          r14 : zt(f(n - m), n, z) -> ------------------
                                                     m
                                                    z
(%i20) declare(zt,linear);
(%o20)                               done
(%i21) ztrans1(e):=apply1(e,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14);
(%o21) ztrans1(e) := apply1(e, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, 
                                                                 r12, r13, r14)
(%i22) ztrans(f,n,z):=ev(ztrans1(zt(f,n,z)),diff,subst);
(%o22)     ztrans(f, n, z) := ev(ztrans1(zt(f, n, z)), diff, subst)
(%i23) defrule(ir1,izt(z/(z-a),z,n),a^n);
                                     z              n
(%o23)                   ir1 : izt(-----, z, n) -> a
                                   z - a
(%i24) defrule(ir2,izt(1/(z-a),z,n),a^(n-1));
                                   1              n - 1
(%o24)                 ir2 : izt(-----, z, n) -> a
                                 z - a
(%i25) declare(izt,linear);
(%o25)                               done
(%i26) invztrans1(e):=apply1(e,ir1,ir2);
(%o26)               invztrans1(e) := apply1(e, ir1, ir2)
(%i27) invztrans(f,z,n):=invztrans1(izt(f,z,n));
(%o27)          invztrans(f, z, n) := invztrans1(izt(f, z, n))
(%i28) ztrans(1,n,z);
                                       z
(%o28)                               -----
                                     z - 1
(%i29) ztrans(a,n,z);
                                      a z
(%o29)                               -----
                                     z - 1
(%i30) expand(ztrans((-1)^n,n,z));
                                       z
(%o30)                               -----
                                     z + 1
(%i31) ztrans(n,n,z);
                                      z
(%o31)                             --------
                                          2
                                   (z - 1)
(%i32) ztrans(n^2,n,z);
                                   z (z + 1)
(%o32)                             ---------
                                          3
                                   (z - 1)
(%i33) ztrans(a^(n-1),n,z);
                                       1
(%o33)                               -----
                                     z - a
(%i34) factor(ztrans(a^(n-1)+n^2,n,z));
                         3      2      2
                      2 z  - a z  - 2 z  - a z + 3 z - 1
(%o34)                ----------------------------------
                                      3
                               (z - 1)  (z - a)
(%i35) 
Run Example
sphere_error:(x[i]-a)^2 + (y[i]-b)^2 + (z[i]-c)^2 - r2;
                                  2           2           2
(%o1)              - r2 + (z  - c)  + (y  - b)  + (x  - a)
                            i           i           i
(%i2) sphere_error_square:sphere_error^2;
                                  2           2           2 2
(%o2)             (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
                            i           i           i
(%i3) declare(sum,linear);
(%o3)                                done
(%i4) sphere_error_sum:sum(sphere_error_square, i, 1, n);
                n
               ====
               \                     2           2           2 2
(%o4)           >    (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
               /               i           i           i
               ====
               i = 1
(%i5) sphere_da: diff(sphere_error_sum, a);
              n
             ====
             \                              2           2           2
(%o5)    - 4  >    (x  - a) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i6) sphere_db: diff(sphere_error_sum, b);
              n
             ====
             \                              2           2           2
(%o6)    - 4  >    (y  - b) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i7) sphere_dc: diff(sphere_error_sum, c);
              n
             ====
             \                              2           2           2
(%o7)    - 4  >    (z  - c) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i8) sphere_dr2: diff(sphere_error_sum, r2);
                     n                 n                 n
                    ====              ====              ====
                    \             2   \             2   \             2
(%o8) - 2 (- n r2 +  >    (z  - c)  +  >    (y  - b)  +  >    (x  - a) )
                    /       i         /       i         /       i
                    ====              ====              ====
                    i = 1             i = 1             i = 1
(%i9) sphere_da_exp: expand(sphere_da=0);
                       n
                      ====
                      \                   2          2        3
(%o9) - 4 a n r2 + 4 ( >    x ) r2 + 4 a c  n + 4 a b  n + 4 a  n
                      /      i
                      ====
                      i = 1
      n                 n              n                   n
     ====              ====           ====                ====
     \         2       \      2       \                   \
 - 4  >    x  z  + 4 a  >    z  + 8 c  >    x  z  - 8 a c  >    z
     /      i  i       /      i       /      i  i         /      i
     ====              ====           ====                ====
     i = 1             i = 1          i = 1               i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    x  y  + 4 a  >    y  + 8 b  >    x  y  - 8 a b  >    y  - 4  >    x
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n               n               n                n
        ====            ====            ====             ====
        \      2      2 \             2 \              2 \
 + 12 a  >    x  - 4 c   >    x  - 4 b   >    x  - 12 a   >    x  = 0
        /      i        /      i        /      i         /      i
        ====            ====            ====             ====
        i = 1           i = 1           i = 1            i = 1
(%i10) sphere_db_exp: expand(sphere_db=0);
                        n
                       ====
                       \                   2        3        2
(%o10) - 4 b n r2 + 4 ( >    y ) r2 + 4 b c  n + 4 b  n + 4 a  b n
                       /      i
                       ====
                       i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    y  z  + 4 b  >    z  + 8 c  >    y  z  - 8 b c  >    z  - 4  >    y
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n            n                 n                  n
        ====         ====              ====               ====
        \      2     \      2          \                2 \
 + 12 b  >    y  - 4  >    x  y  + 8 a  >    x  y  - 4 c   >    y
        /      i     /      i  i       /      i  i        /      i
        ====         ====              ====               ====
        i = 1        i = 1             i = 1              i = 1
          n               n              n                n
         ====            ====           ====             ====
       2 \             2 \              \      2         \
 - 12 b   >    y  - 4 a   >    y  + 4 b  >    x  - 8 a b  >    x  = 0
         /      i        /      i       /      i         /      i
         ====            ====           ====             ====
         i = 1           i = 1          i = 1            i = 1
(%i11) sphere_dc_exp: expand(sphere_dc=0);
                        n                                               n
                       ====                                            ====
                       \                 3        2          2         \      3
(%o11) - 4 c n r2 + 4 ( >    z ) r2 + 4 c  n + 4 b  c n + 4 a  c n - 4  >    z
                       /      i                                        /      i
                       ====                                            ====
                       i = 1                                           i = 1
         n            n                 n               n
        ====         ====              ====            ====
        \      2     \      2          \               \      2
 + 12 c  >    z  - 4  >    y  z  + 8 b  >    y  z  - 4  >    x  z
        /      i     /      i  i       /      i  i     /      i  i
        ====         ====              ====            ====
        i = 1        i = 1             i = 1           i = 1
        n                   n               n               n
       ====                ====            ====            ====
       \                 2 \             2 \             2 \
 + 8 a  >    x  z  - 12 c   >    z  - 4 b   >    z  - 4 a   >    z
       /      i  i         /      i        /      i        /      i
       ====                ====            ====            ====
       i = 1               i = 1           i = 1           i = 1
        n                n              n                n
       ====             ====           ====             ====
       \      2         \              \      2         \
 + 4 c  >    y  - 8 b c  >    y  + 4 c  >    x  - 8 a c  >    x  = 0
       /      i         /      i       /      i         /      i
       ====             ====           ====             ====
       i = 1            i = 1          i = 1            i = 1
(%i12) augcoefmatrix([sphere_da_subst, sphere_db_subst, sphere_dc_subst], [a, b, c]);
                         [ 0  0  0  sphere_da_subst ]
                         [                          ]
(%o12)                   [ 0  0  0  sphere_db_subst ]
                         [                          ]
                         [ 0  0  0  sphere_dc_subst ]
(%i13) 
Run Example
sphere_error:(x[i]-a)^2 + (y[i]-b)^2 + (z[i]-c)^2 - r2;
                                  2           2           2
(%o1)              - r2 + (z  - c)  + (y  - b)  + (x  - a)
                            i           i           i
(%i2) sphere_error_square:sphere_error^2;
                                  2           2           2 2
(%o2)             (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
                            i           i           i
(%i3) declare(sum,linear);
(%o3)                                done
(%i4) sphere_error_sum:sum(sphere_error_square, i, 1, n);
                n
               ====
               \                     2           2           2 2
(%o4)           >    (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
               /               i           i           i
               ====
               i = 1
(%i5) sphere_da: diff(sphere_error_sum, a);
              n
             ====
             \                              2           2           2
(%o5)    - 4  >    (x  - a) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i6) sphere_db: diff(sphere_error_sum, b);
              n
             ====
             \                              2           2           2
(%o6)    - 4  >    (y  - b) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i7) sphere_dc: diff(sphere_error_sum, c);
              n
             ====
             \                              2           2           2
(%o7)    - 4  >    (z  - c) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i8) sphere_dr2: diff(sphere_error_sum, r2);
                     n                 n                 n
                    ====              ====              ====
                    \             2   \             2   \             2
(%o8) - 2 (- n r2 +  >    (z  - c)  +  >    (y  - b)  +  >    (x  - a) )
                    /       i         /       i         /       i
                    ====              ====              ====
                    i = 1             i = 1             i = 1
(%i9) sphere_da_exp: expand(sphere_da=0);
                       n
                      ====
                      \                   2          2        3
(%o9) - 4 a n r2 + 4 ( >    x ) r2 + 4 a c  n + 4 a b  n + 4 a  n
                      /      i
                      ====
                      i = 1
      n                 n              n                   n
     ====              ====           ====                ====
     \         2       \      2       \                   \
 - 4  >    x  z  + 4 a  >    z  + 8 c  >    x  z  - 8 a c  >    z
     /      i  i       /      i       /      i  i         /      i
     ====              ====           ====                ====
     i = 1             i = 1          i = 1               i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    x  y  + 4 a  >    y  + 8 b  >    x  y  - 8 a b  >    y  - 4  >    x
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n               n               n                n
        ====            ====            ====             ====
        \      2      2 \             2 \              2 \
 + 12 a  >    x  - 4 c   >    x  - 4 b   >    x  - 12 a   >    x  = 0
        /      i        /      i        /      i         /      i
        ====            ====            ====             ====
        i = 1           i = 1           i = 1            i = 1
(%i10) sphere_db_exp: expand(sphere_db=0);
                        n
                       ====
                       \                   2        3        2
(%o10) - 4 b n r2 + 4 ( >    y ) r2 + 4 b c  n + 4 b  n + 4 a  b n
                       /      i
                       ====
                       i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    y  z  + 4 b  >    z  + 8 c  >    y  z  - 8 b c  >    z  - 4  >    y
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n            n                 n                  n
        ====         ====              ====               ====
        \      2     \      2          \                2 \
 + 12 b  >    y  - 4  >    x  y  + 8 a  >    x  y  - 4 c   >    y
        /      i     /      i  i       /      i  i        /      i
        ====         ====              ====               ====
        i = 1        i = 1             i = 1              i = 1
          n               n              n                n
         ====            ====           ====             ====
       2 \             2 \              \      2         \
 - 12 b   >    y  - 4 a   >    y  + 4 b  >    x  - 8 a b  >    x  = 0
         /      i        /      i       /      i         /      i
         ====            ====           ====             ====
         i = 1           i = 1          i = 1            i = 1
(%i11) sphere_dc_exp: expand(sphere_dc=0);
                        n                                               n
                       ====                                            ====
                       \                 3        2          2         \      3
(%o11) - 4 c n r2 + 4 ( >    z ) r2 + 4 c  n + 4 b  c n + 4 a  c n - 4  >    z
                       /      i                                        /      i
                       ====                                            ====
                       i = 1                                           i = 1
         n            n                 n               n
        ====         ====              ====            ====
        \      2     \      2          \               \      2
 + 12 c  >    z  - 4  >    y  z  + 8 b  >    y  z  - 4  >    x  z
        /      i     /      i  i       /      i  i     /      i  i
        ====         ====              ====            ====
        i = 1        i = 1             i = 1           i = 1
        n                   n               n               n
       ====                ====            ====            ====
       \                 2 \             2 \             2 \
 + 8 a  >    x  z  - 12 c   >    z  - 4 b   >    z  - 4 a   >    z
       /      i  i         /      i        /      i        /      i
       ====                ====            ====            ====
       i = 1               i = 1           i = 1           i = 1
        n                n              n                n
       ====             ====           ====             ====
       \      2         \              \      2         \
 + 4 c  >    y  - 8 b c  >    y  + 4 c  >    x  - 8 a c  >    x  = 0
       /      i         /      i       /      i         /      i
       ====             ====           ====             ====
       i = 1            i = 1          i = 1            i = 1
(%i12) sphere_dr2_exp: expand(sphere_dr2=0);
                                              n              n
                                             ====           ====
                   2        2        2       \      2       \
(%o12) 2 n r2 - 2 c  n - 2 b  n - 2 a  n - 2  >    z  + 4 c  >    z
                                             /      i       /      i
                                             ====           ====
                                             i = 1          i = 1
                         n              n            n              n
                        ====           ====         ====           ====
                        \      2       \            \      2       \
                    - 2  >    y  + 4 b  >    y  - 2  >    x  + 4 a  >    x  = 0
                        /      i       /      i     /      i       /      i
                        ====           ====         ====           ====
                        i = 1          i = 1        i = 1          i = 1
(%i13) sphere_dr2_solve: solve(sphere_dr2_exp, r2);
                                  n              n          n
                                 ====           ====       ====
                2    2    2      \      2       \          \      2
(%o13) [r2 = ((c  + b  + a ) n +  >    z  - 2 c  >    z  +  >    y
                                 /      i       /      i   /      i
                                 ====           ====       ====
                                 i = 1          i = 1      i = 1
                                          n          n              n
                                         ====       ====           ====
                                         \          \      2       \
                                   - 2 b  >    y  +  >    x  - 2 a  >    x )/n]
                                         /      i   /      i       /      i
                                         ====       ====           ====
                                         i = 1      i = 1          i = 1
(%i14) sphere_da_subst: subst(sphere_dr2_solve, sphere_da_exp);
            n                             n              n          n
           ====                          ====           ====       ====
           \            2    2    2      \      2       \          \      2
(%o14) (4 ( >    x ) ((c  + b  + a ) n +  >    z  - 2 c  >    z  +  >    y
           /      i                      /      i       /      i   /      i
           ====                          ====           ====       ====
           i = 1                         i = 1          i = 1      i = 1
        n          n              n
       ====       ====           ====
       \          \      2       \
 - 2 b  >    y  +  >    x  - 2 a  >    x ))/n
       /      i   /      i       /      i
       ====       ====           ====
       i = 1      i = 1          i = 1
                            n              n          n              n
                           ====           ====       ====           ====
          2    2    2      \      2       \          \      2       \
 - 4 a ((c  + b  + a ) n +  >    z  - 2 c  >    z  +  >    y  - 2 b  >    y
                           /      i       /      i   /      i       /      i
                           ====           ====       ====           ====
                           i = 1          i = 1      i = 1          i = 1
    n              n                                            n
   ====           ====                                         ====
   \      2       \                2          2        3       \         2
 +  >    x  - 2 a  >    x ) + 4 a c  n + 4 a b  n + 4 a  n - 4  >    x  z
   /      i       /      i                                     /      i  i
   ====           ====                                         ====
   i = 1          i = 1                                        i = 1
        n              n                   n            n
       ====           ====                ====         ====
       \      2       \                   \            \         2
 + 4 a  >    z  + 8 c  >    x  z  - 8 a c  >    z  - 4  >    x  y
       /      i       /      i  i         /      i     /      i  i
       ====           ====                ====         ====
       i = 1          i = 1               i = 1        i = 1
        n              n                   n            n               n
       ====           ====                ====         ====            ====
       \      2       \                   \            \      3        \      2
 + 4 a  >    y  + 8 b  >    x  y  - 8 a b  >    y  - 4  >    x  + 12 a  >    x
       /      i       /      i  i         /      i     /      i        /      i
       ====           ====                ====         ====            ====
       i = 1          i = 1               i = 1        i = 1           i = 1
         n               n                n
        ====            ====             ====
      2 \             2 \              2 \
 - 4 c   >    x  - 4 b   >    x  - 12 a   >    x  = 0
        /      i        /      i         /      i
        ====            ====             ====
        i = 1           i = 1            i = 1
(%i15) 

Related Help

Help for Linear