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

See also PositiveInteger

spad
)abbrev domain NNI NonNegativeInteger
++ Author:
++ Date Created:
++ Change History:
++ Basic Operations:
++ Related Constructors:
++ Keywords: integer
++ Description: \spadtype{NonNegativeInteger} provides functions for non
++   negative integers.
NonNegativeInteger: Join(OrderedAbelianMonoidSup,Monoid) with
            _quo : (%,%) -> %
              ++ a quo b returns the quotient of \spad{a} and b, forgetting
              ++ the remainder.
            _rem : (%,%) -> %
              ++ a rem b returns the remainder of \spad{a} and b.
            gcd  : (%,%) -> %
              ++ gcd(a,b) computes the greatest common divisor of two
              ++ non negative integers \spad{a} and b.
            divide: (%,%) -> Record(quotient:%,remainder:%)
              ++ divide(a,b) returns a record containing both
              ++ remainder and quotient.
            _exquo: (%,%) -> Union(%,"failed")
              ++ exquo(a,b) returns the quotient of \spad{a} and b, or "failed"
              ++ if b is zero or \spad{a} rem b is zero.
            shift: (%, Integer) -> %
              ++ shift(a,i) shift \spad{a} by i bits.
            random   : % -> %
              ++ random(n) returns a random integer from 0 to \spad{n-1}.
            CommutativeStar
              ++ CommutativeStar means multiplication is commutative : \spad{x*y = y*x}.
== SubDomain(Integer,x+->(x >= 0)) add x,y:% sup(x,y) == MAX(x,y)$Lisp shift(x:%, n:Integer):% == ASH(x,n)$Lisp subtractIfCan(x, y) == c:Integer := (x pretend Integer) - (y pretend Integer) c < 0 => "failed" c pretend %
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8904197052945586210-25px001.spad
      using old system compiler.
   NNI abbreviates domain NonNegativeInteger 
------------------------------------------------------------------------
   initializing NRLIB NNI for NonNegativeInteger 
   compiling into NRLIB NNI 
****** comp fails at level 1 with expression: ******
((+-> |x| (>= |x| 0)))
****** level 1  ******
$x:= (+-> x (>= x (Zero)))
$m:= (Boolean)
$f:=
((((|#1| #) (* #) (+ #) (- #) ...)))
>> Apparent user error: compLambda: signature needed (+-> x (>= x (Zero)))

fricas
)show NonNegativeInteger
NonNegativeInteger is a domain constructor Abbreviation for NonNegativeInteger is NNI This constructor is exposed in this frame. ------------------------------- Operations -------------------------------- ?*? : (%,%) -> % ?*? : (PositiveInteger,%) -> % ?+? : (%,%) -> % ?<? : (%,%) -> Boolean ?<=? : (%,%) -> Boolean ?=? : (%,%) -> Boolean ?>? : (%,%) -> Boolean ?>=? : (%,%) -> Boolean 1 : () -> % 0 : () -> % ?^? : (%,PositiveInteger) -> % coerce : % -> OutputForm gcd : (%,%) -> % hash : % -> SingleInteger latex : % -> String max : (%,%) -> % min : (%,%) -> % one? : % -> Boolean opposite? : (%,%) -> Boolean qcoerce : Integer -> % ?quo? : (%,%) -> % random : % -> % recip : % -> Union(%,"failed") ?rem? : (%,%) -> % sample : () -> % shift : (%,Integer) -> % smaller? : (%,%) -> Boolean sup : (%,%) -> % zero? : % -> Boolean ?~=? : (%,%) -> Boolean ?*? : (NonNegativeInteger,%) -> % ?^? : (%,NonNegativeInteger) -> % divide : (%,%) -> Record(quotient: %,remainder: %) exquo : (%,%) -> Union(%,"failed") hashUpdate! : (HashState,%) -> HashState subtractIfCan : (%,%) -> Union(%,"failed")




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