login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

fricas
)lib FPROD
FreeProduct is now explicitly exposed in frame initial FreeProduct will be automatically loaded when needed from /var/aw/var/LatexWiki/FPROD.NRLIB/FPROD
fricas
)lib FSUM
FreeSum is now explicitly exposed in frame initial FreeSum will be automatically loaded when needed from /var/aw/var/LatexWiki/FSUM.NRLIB/FSUM

spad
)abbrev domain FRING FreeRing
++ Description:
++ One can construct the free algebra R<E> on any set A of generators.
++ Since rings may be regarded as Z-algebras, a free ring on A can be
++ defined as the free algebra Z<E>
++ Ref: http://en.wikipedia.org/wiki/Free_ring
FreeRing(A:SetCategory):Ring with
    if A has Comparable then Comparable
    coerce:A->%
    _-:(%,%)->%
  == add
    RepSum ==> FreeSum(FreeAbelianGroup A,FreeAbelianGroup %)
    RepPrd ==> FreeProduct(FreeMonoid A,FreeMonoid %)
    Rep ==> Union(sum:RepSum,prd:RepPrd)
    rep(x:%):Rep == x pretend Rep
    per(x:Rep):% == x pretend %
    coerce(x:%):OutputForm ==
      r:=rep(x)
      if x=0 or x=1 then return coerce(r)
      if r case sum then infix('+::OutputForm, [ _
        if is2(s) then _
          infix('+::OutputForm, [ _
           if t.exp=1 then coerce(t.gen) _
           else if t.gen=1 then coerce(t.exp)
           else coerce(t.exp)*coerce(t.gen) _
           for t in terms(retract(s)@FreeAbelianGroup(%)) ]) _
        else coerce(s)
        for s in terms(r.sum)])
      else blankSeparate [ _
        if is2(s) then _
          blankSeparate [ _
           if t.exp=1 then paren(coerce(t.gen)) _
           else paren(coerce(t.gen)^coerce(t.exp)) _
           for t in factors(retract(s)@FreeMonoid(%)) ] _
        else coerce(s)
        for s in factors(r.prd)]
--coerce(x:A):% == per [in1(coerce x)$RepSum] coerce(x:A):% == per [in1(coerce x)$RepPrd]
Zero():% == per [0$RepSum] One():% == per [1$RepPrd] (x:% = y:%):Boolean == (rep(x) = rep(y))$Rep (x1:% + x2:%):% == if x1=0 then return x2 if x2=0 then return x1 r1:=rep(x1); r2:=rep(x2) if r1 case sum then s1:=r1.sum else s1:=in2(coerce x1)$RepSum if r2 case sum then s2:=r2.sum else s2:=in2(coerce x2)$RepSum per [s1+s2] (x1:% * x2:%):% == if x1=0 then return 0 if x2=0 then return 0 if x1=1 then return x2 if x2=1 then return x1 r1:=rep(x1); r2:=rep(x2) if r1 case prd then p1:=r1.prd else p1:=in2(coerce x1)$RepPrd if r2 case prd then p2:=r2.prd else p2:=in2(coerce x2)$RepPrd per [p1*p2] _-(x:%):% == if x=0 then return 0 r:=rep(x) if r case sum then s:=r.sum else s:=in2(coerce x)$RepSum per [-s] (x:% - y:%):% == x + (-y) (n:Integer * x:%):% == if x=0 then return 0 if n>0 then return (n-1) * x + x if n<0 then return (n+1) * x - x return 0 coerce(x:Integer):% == x*1
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6698586189056097663-25px002.spad
      using old system compiler.
   FRING abbreviates domain FreeRing 
------------------------------------------------------------------------
   initializing NRLIB FRING for FreeRing 
   compiling into NRLIB FRING 
   processing macro definition RepSum ==> FreeSum(FreeAbelianGroup A,FreeAbelianGroup $) 
   processing macro definition RepPrd ==> FreeProduct(FreeMonoid A,FreeMonoid $) 
   processing macro definition Rep ==> Union(sum: FreeSum(FreeAbelianGroup A,FreeAbelianGroup $),prd: FreeProduct(FreeMonoid A,FreeMonoid $)) 
   compiling local rep : $ -> Union(sum: FreeSum(FreeAbelianGroup A,FreeAbelianGroup $),prd: FreeProduct(FreeMonoid A,FreeMonoid $))
      FRING;rep is replaced by x 
Time: 0.02 SEC.
compiling local per : Union(sum: FreeSum(FreeAbelianGroup A,FreeAbelianGroup $),prd: FreeProduct(FreeMonoid A,FreeMonoid $)) -> $ FRING;per is replaced by x Time: 0 SEC.
compiling exported coerce : $ -> OutputForm Internal Error Error while instantiating type FreeAbelianGroupA

fricas
f:=FreeRing(Symbol)
FreeRing is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: