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

Edit detail for SandBox Functional Addition revision 1 of 2

1 2
Editor:
Time: 2007/11/18 18:02:32 GMT-8
Note:

changed:
-
This library code is based directly on MappingPackage3 in
'mappkg.spad.pamphlet'

\begin{axiom}
)abbrev package MAPHAC2X MapPackInternalHac2x
++ Description: Mapping hack for Addition
++ The function \spad{funcAdd(f,g,x)} is \spad{fx+gx} which is needed below
MapPackInternalHac2x(A: SetCategory, B: Ring):
   with funcAdd:  (A->B, A->B, A) -> B ==
      add funcAdd(g,h,x)  == ((g x) + (h x))$B
\end{axiom}

This package is the one that actually provides the Functional
Addition operator. The overloaded symbol + also represents this
type of addition.

\begin{axiom}
)abbrev package MAPPK2X MappingPackage2x
++ Description: Functional Addition
++ Given functions f and g, returns the function \spad{fx+gx}
++ \spad{f+g} is the function \spad{h} such that \spad{h x = f x + g x}.
MappingPackage2x(A:SetCategory, B:Ring):
   with "+":   (A->B, A->B) -> (A->B) ==
      add
         MapPackInternalHac2x(A, B)
         fab:  A -> B
         fab+fab == funcAdd(fab,fab,#1)
\end{axiom}

\begin{axiom}
f := (x:INT):INT +-> 3*x
g := (x:INT):INT +-> 2*x+3
(f+g)(3)
\end{axiom}

We should be able to generalize this to [SandBox Direct Product]



From BillPage Tue Jun 28 15:52:26 -0500 2005
From: Bill Page
Date: Tue, 28 Jun 2005 15:52:26 -0500
Subject: Finally got the frigg'n name right! :)
Message-ID: <20050628155226-0500@page.axiom-developer.org>



This library code is based directly on MappingPackage3? in mappkg.spad.pamphlet

axiom
)abbrev package MAPHAC2X MapPackInternalHac2x
++ Description: Mapping hack for Addition
++ The function \spad{funcAdd(f,g,x)} is \spad{fx+gx} which is needed below
MapPackInternalHac2x(A: SetCategory, B: Ring):
   with funcAdd:  (A->B, A->B, A) -> B ==
      add funcAdd(g,h,x)  == ((g x) + (h x))$B
axiom
Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/1147191614234250090-25px.001.spad using 
      old system compiler.
   MAPHAC2X abbreviates package MapPackInternalHac2x 
------------------------------------------------------------------------
   initializing NRLIB MAPHAC2X for MapPackInternalHac2x 
   compiling into NRLIB MAPHAC2X 
   compiling exported funcAdd : (A -> B,A -> B,A) -> B
Time: 0.04 SEC.
(time taken in buildFunctor: 0)
;;; *** |MapPackInternalHac2x| REDEFINED
;;; *** |MapPackInternalHac2x| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor MapPackInternalHac2x Time: 0.05 seconds
finalizing NRLIB MAPHAC2X Processing MapPackInternalHac2x for Browser database: --->-->MapPackInternalHac2x((funcAdd (B (Mapping B A) (Mapping B A) A))): Not documented!!!! --------constructor--------- ; compiling file "/var/zope2/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X.lsp" (written 11 JUN 2011 08:31:02 AM):
; /var/zope2/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X.fasl written ; compilation finished in 0:00:00.086 ------------------------------------------------------------------------ MapPackInternalHac2x is now explicitly exposed in frame initial MapPackInternalHac2x will be automatically loaded when needed from /var/zope2/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

This package is the one that actually provides the Functional Addition operator. The overloaded symbol + also represents this type of addition.

axiom
)abbrev package MAPPK2X MappingPackage2x
++ Description: Functional Addition
++ Given functions f and g, returns the function \spad{fx+gx}
++ \spad{f+g} is the function \spad{h} such that \spad{h x = f x + g x}.
MappingPackage2x(A:SetCategory, B:Ring):
   with "+":   (A->B, A->B) -> (A->B) ==
      add
         MapPackInternalHac2x(A, B)
         fab:  A -> B
         fab+fab == funcAdd(fab,fab,#1)
axiom
Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/8693442026998160385-25px.002.spad using 
      old system compiler.
   MAPPK2X abbreviates package MappingPackage2x 
------------------------------------------------------------------------
   initializing NRLIB MAPPK2X for MappingPackage2x 
   compiling into NRLIB MAPPK2X 
>> Apparent user error: Use: import (MapPackInternalHac2x A B)

axiom
f := (x:INT):INT +-> 3*x

\label{eq1}\mbox{theMap (...)}(1)
Type: (Integer -> Integer)
axiom
g := (x:INT):INT +-> 2*x+3

\label{eq2}\mbox{theMap (...)}(2)
Type: (Integer -> Integer)
axiom
(f+g)(3)
There are 11 exposed and 7 unexposed library operations named + having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op + to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named + with argument type(s) (Integer -> Integer) (Integer -> Integer)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

We should be able to generalize this to [SandBox Direct Product]?

Finally got the frigg'n name right! :) --Bill Page, Tue, 28 Jun 2005 15:52:26 -0500 reply