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

Algebra

SandBoxNonZeroInteger is an attempt to define the domain of Integers without 0 as a SubDomain.

\begin{spad} )abbrev domain NZINT NonZeroInteger NonZeroInteger: Join(OrderedAbelianSemiGroup, Monoid --,CoercibleTo(Integer) ) with commutative("*") gcd: (%,%) -> % ++ gcd(a,b) computes the greatest common divisor of two ++ positive integers \spad{a} and b. _-: % -> % --retract:Integer->% --retractIfCan:Integer->Union(%,"failed") --retract:NonNegativeInteger->% --retractIfCan:NonNegativeInteger->Union(%,"failed") --convert:NonNegativeInteger->% == SubDomain(Integer,not(#1 = 0)) add Rep == Integer x:% y:% z:Integer nz:NonNegativeInteger -x == (-(x pretend Integer)) pretend % x+y == (z:=(x pretend Integer)+(y pretend Integer)) = 0 => error "zero" z pretend %

--coerce(x):Integer == x pretend Integer --retract(z)== z pretend % --convert(nz):% == retract(nz) --retractIfCan(z) == -- zero?(z) => "failed" -- retract(z) --retract(nz)== nz pretend % --retractIfCan(nz) == -- zero?(nz) => "failed" -- retract(nz) \end{spad}

\begin{axiom} )show NZINT \end{axiom}

\begin{axiom} i:NZINT := 1$NZINT i:NZINT := (1::Integer) i:NZINT := 1 \end{axiom} \begin{axiom} j:NZINT := -1 \end{axiom} \begin{axiom} j:NZINT:=-i i+1 j+1 i+j \end{axiom}

\begin{axiom} i-j retractIfCan(0)$NZINT \end{axiom}

Can we define NonZero as a functor? \begin{spad} )abbrev domain NZ NonZero NonZero(T:Ring): Join(OrderedAbelianSemiGroup, Monoid) with Commutative("*") _-: % -> % == SubDomain(T,not(#1 = 0)) add Rep == T x:% y:% z:T -x == (-(x pretend T)) pretend % x+y == (z:=(x pretend T)+(y pretend T)) = 0 => error "zero" z pretend % \end{spad}

\begin{axiom} )show NonZero(Float) \end{axiom}

\begin{axiom} f:NonZero(Float):=1 g:NonZero(Float):=-f f+(1.1::NonZero(Float)) f + -g f+g \end{axiom}


Some or all expressions may not have rendered properly, because Axiom returned the following error:
Error: export HOME=/var/zope2/var/LatexWiki; ulimit -t 600; export LD_LIBRARY_PATH=/usr/local/lib/fricas/target/x86_64-linux-gnu/lib; LANG=en_US.UTF-8 /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/fricas -nosman < /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3437484353503122027-25px.axm

debugger invoked on a SIMPLE-CONDITION in thread #<THREAD "main thread" RUNNING {1001C48003}>: break

Checking for foreign routines FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu" spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so" foreign routines found openServer result -2 FriCAS Computer Algebra System Version: FriCAS 1.3.10 built with sbcl 2.2.9.debian Timestamp: Wed 10 Jan 02:19:45 CET 2024 ----------------------------------------------------------------------------- Issue )copyright to view copyright notices. Issue )summary for a summary of useful system commands. Issue )quit to leave FriCAS and return to shell. -----------------------------------------------------------------------------

(1) -> (1) -> (1) -> (1) -> (1) -> (1) -> <spad> )abbrev domain NZINT NonZeroInteger NonZeroInteger: Join(OrderedAbelianSemiGroup, Monoid --,CoercibleTo(Integer) ) with commutative("*") gcd: (%,%) -> % ++ gcd(a,b) computes the greatest common divisor of two ++ positive integers \spad{a} and b. _-: % -> % --retract:Integer->% --retractIfCan:Integer->Union(%,"failed") --retract:NonNegativeInteger->% --retractIfCan:NonNegativeInteger->Union(%,"failed") --convert:NonNegativeInteger->% == SubDomain(Integer,not(#1 = 0)) add Rep == Integer x:% y:% z:Integer nz:NonNegativeInteger -x == (-(x pretend Integer)) pretend % x+y == (z:=(x pretend Integer)+(y pretend Integer)) = 0 => error "zero" z pretend %

--coerce(x):Integer == x pretend Integer --retract(z)== z pretend % --convert(nz):% == retract(nz) --retractIfCan(z) == -- zero?(z) => "failed" -- retract(z) --retract(nz)== nz pretend % --retractIfCan(nz) == -- zero?(nz) => "failed" -- retract(nz)</spad> Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5347600158247770088-25px001.spad using old system compiler. NZINT abbreviates domain NonZeroInteger ------------------------------------------------------------------------ initializing NRLIB NZINT for NonZeroInteger compiling into NRLIB NZINT

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from BREAK. 1: [ABORT ] Exit from the current thread.

(|JoinInner| (#(NIL (((|gcd| #) T (ELT % 6)) ((- #) T (ELT % 6))) (((|commutative| "*") T)) (|Category|) (NIL NIL NIL) NIL))) error finding frame source: Bogus form-number: the source file has probably changed too much to cope with. source: NIL 0]


Some or all expressions may not have rendered properly, because Latex returned the following error:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./2513162191742468216-16.0px.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-01-16>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def))
(/usr/share/texlive/texmf-dist/tex/latex/bbm-macros/bbm.sty)
(/usr/share/texlive/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/pstricks/pstricks.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/mathcolor.ltx)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvipsnam.def))
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex)))))
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.06, 2020/11/20 (hv))
(/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered
.code.tex))) (/usr/share/texlive/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code
.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonomet
ric.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.cod
e.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison
.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.
tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code
.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.
tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerari
thmetics.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)))
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex))
`PSTricks' v3.18  <2022/11/28> (tvz,hv)
--- We are running latex or xelatex ---
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks.con)
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks-color.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks-arrows.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks-dots.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks.con))
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.06, 2020/11/20 (hv)))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg))))
(/usr/share/texlive/texmf-dist/tex/latex/pst-grad/pst-grad.sty
(/usr/share/texlive/texmf-dist/tex/generic/pst-grad/pst-grad.tex
`pst-grad' v1.06, 2006/11/27 (tvz,dg,hv)))
(/usr/share/texlive/texmf-dist/tex/latex/pst-plot/pst-plot.sty
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/pst-xkey.sty)
(/usr/share/texlive/texmf-dist/tex/latex/multido/multido.sty
(/usr/share/texlive/texmf-dist/tex/generic/multido/multido.tex
 v1.42, 2010/05/14 <tvz>))
(/usr/share/texlive/texmf-dist/tex/generic/pst-plot/pst-plot.tex
(/usr/share/texlive/texmf-dist/tex/generic/pst-tools/pst-tools.tex
`PST-tools' v0.12, 2021/09/23 (hv))
(/usr/share/texlive/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex
(/usr/share/texlive/texmf-dist/tex/generic/pst-node/pst-node.tex
 v1.43, 2022/01/31)
(/usr/share/texlive/texmf-dist/tex/generic/pst-arrow/pst-arrow.tex
`pst-arrow' v0.05, 2021/11/16 (dr,hv))
(/usr/share/texlive/texmf-dist/tex/generic/pst-3d/pst-3d.tex
`PST-3d' v1.11, 2010/02/14 (tvz))
(/usr/share/texlive/texmf-dist/tex/generic/pst-math/pst-math.tex
`pst-math' v0.66 , (CJ,hv)) `pstricks-add' v3.93, 2022/11/21 (dr,hv))
 v1.94, 2022/11/21 (tvz,hv)))
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifvtex.sty)

Package geometry Warning: `lmargin' and `rmargin' result in NEGATIVE (-108.405p t). `width' should be shortened in length.

) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/setspace/setspace.sty) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xy.sty (/usr/share/texlive/texmf-dist/tex/generic/xypic/xy.tex Bootstrap'ing: catcodes, docmode, (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyrecat.tex ) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyidioms.tex)

Xy-pic version 3.8.9 <2013/10/06> Copyright (c) 1991-2013 by Kristoffer H. Rose <krisrose@tug.org> and others Xy-pic is free software: see the User's Guide for details.

Loading kernel: messages; fonts; allocations: state, direction, utility macros; pictures: \xy, positions, objects, decorations; kernel objects: directionals, circles, text; options; algorithms: directions, edges, connections; Xy-pic loaded) (/usr/share/texlive/texmf-dist/tex/generic/iftex/ifpdf.sty)) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyall.tex Xy-pic option: All features v.3.8 (/usr/share/texlive/texmf-dist/tex/generic/xypic/xycurve.tex Xy-pic option: Curve and Spline extension v.3.12 curve, circles, loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyframe.tex Xy-pic option: Frame and Bracket extension v.3.14 loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xycmtip.tex Xy-pic option: Computer Modern tip extension v.3.7 (/usr/share/texlive/texmf-dist/tex/generic/xypic/xytips.tex Xy-pic option: More Tips extension v.3.11 loaded) loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyline.tex Xy-pic option: Line styles extension v.3.10 loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyrotate.tex Xy-pic option: Rotate and Scale extension v.3.8 loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xycolor.tex Xy-pic option: Colour extension v.3.11 loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xymatrix.tex Xy-pic option: Matrix feature v.3.14 loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xyarrow.tex Xy-pic option: Arrow and Path feature v.3.9 path, \ar, loaded) (/usr/share/texlive/texmf-dist/tex/generic/xypic/xygraph.tex Xy-pic option: Graph feature v.3.11 loaded) loaded) (/usr/share/texlive/texmf-dist/tex/latex/tools/verbatim.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphviz/graphviz.sty (/usr/share/texlive/texmf-dist/tex/latex/psfrag/psfrag.sty)) (/usr/share/texmf/tex/latex/sagetex.sty Writing sage input file 2513162191742468216-16.0px.sage ) (/usr/share/texlive/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty (/usr/share/texlive/texmf-dist/tex/latex/moreverb/moreverb.sty) (/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty) (/usr/share/texlive/texmf-dist/tex/generic/catchfile/catchfile.sty (/usr/share/texlive/texmf-dist/tex/generic/infwarerr/infwarerr.sty) (/usr/share/texlive/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/share/texlive/texmf-dist/tex/generic/etexcmds/etexcmds.sty))

Package gnuplottex Warning: Shell escape not enabled. (gnuplottex) You'll need to convert the graphs yourself.

) (/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def) No file 2513162191742468216-16.0px.aux. (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) geometry driver: auto-detecting geometry detected driver: dvips Missing $ inserted. <inserted text> $ l.131 _ -: % -> % (/usr/share/texlive/texmf-dist/tex/latex/jknapltx/ursfs.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) You can't use `macro parameter character #' in math mode. l.137 == SubDomain(Integer,not(# 1 = 0)) add Missing $ inserted. <inserted text> $ l.147

[1] (/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd)

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 161.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 166.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 169.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 175.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 179.

Missing $ inserted. <inserted text> $ l.184 _ -: % -> % You can't use `macro parameter character #' in math mode. l.185 == SubDomain(T,not(# 1 = 0)) add Missing $ inserted. <inserted text> $ l.194 \end{spad} \newpage

Overfull \hbox (19.6396pt too wide) in paragraph at lines 181--194 \T1/cmr/m/n/12 )abbrev do-main NZ NonZero NonZero(T:Ring): Join(OrderedAbelianS emiGroup, Monoid) with Com-mu-ta-tive("*") $[] \OT1/cmr/m/n/12 :== \OML/cmm/m/i t/12 SubDomain\OT1/cmr/m/n/12 (\OML/cmm/m/it/12 T; not\OT1/cmr/m/n/12 (1 = [2]

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 197.

[3] (./2513162191742468216-16.0px.aux) ) (see the transcript file for additional information) Output written on 2513162191742468216-16.0px.dvi (3 pages, 3888 bytes). Transcript written on 2513162191742468216-16.0px.log.




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