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

Edit detail for #114 Map on Functions crash revision 1 of 1

1
Editor:
Time: 2007/11/17 21:53:17 GMT-8
Note: fixed in --patch-49

changed:
-
This problem does not occur on the NAG version::

  !\begin{axiom}
  dom:=(INT->INT)
  g(f:dom):dom== x+->(f(x))^2
  p(x:INT):INT == x-1
  \end{axiom}

The next line crashes Axiom. (Here the crash is indicated by not showing the result for <code>q</code> which should be something like <code>theMap(LAMBDA_ibs3ze_708.174)</code> (from NAG version)::

  !\begin{axiom}
  q:= g p
  \end{axiom}

Below is the transcript for the NAG version:

<pre>
G82322 (1) -> dom:= (INT->INT)

   (1)  (Integer -> Integer)
                                                                 Type: Domain
G82322 (2) -> g(f:dom):dom== x+->(f(x))^2
   Function declaration g : (Integer -> Integer) -> (Integer -> Integer
      ) has been added to workspace.
                                                                   Type: Void
G82322 (3) -> p(x:INT):INT==x-1
   Function declaration p : Integer -> Integer has been added to 
      workspace.
                                                                   Type: Void
G82322 (4) -> q:= g p
   Compiling function p with type Integer -> Integer 
   Compiling function g with type (Integer -> Integer) -> (Integer -> 
      Integer) 
</pre>
<code>+++ |*1;g;1;G82322| redefined</code>
<pre>
   (4)  theMap(LAMBDA_ibs3ze_708,174)
                                                   Type: (Integer -> Integer)
G82322 (5) -> q 3

   (5)  4
                                                        Type: PositiveInteger
</pre>



From wyscc Fri Mar 4 04:37:59 -0600 2005
From: wyscc
Date: Fri, 04 Mar 2005 04:37:59 -0600
Subject: property change
Message-ID: <20050304043759-0600@page.axiom-developer.org>

Name: '#114 Maps on Function crash ' => '#114 Map on Functions crash' 


From unknown Fri Mar 4 05:18:25 -0600 2005
From: 
Date: Fri, 04 Mar 2005 05:18:25 -0600
Subject: Here is one way that works
Message-ID: <20050304051825-0600@page.axiom-developer.org>

\begin{axiom}
)clear all
\end{axiom}

We can avoid the use of an anonymous function and use
function composition to define the functional 'g' as follows:
\begin{axiom}
dom ==> INT -> INT

g(f:dom):dom ==
  function(x^2,sq,x)
  sq * f

p(x:INT):INT == x-1

q := g p

q 3
\end{axiom}


From BillPage Fri Mar 4 07:03:34 -0600 2005
From: Bill Page
Date: Fri, 04 Mar 2005 07:03:34 -0600
Subject: Using the SPAD compiler
Message-ID: <20050304070334-0600@page.axiom-developer.org>

Take a look at FunctionalMapping for an example of this sort thing
written in SPAD.

From wyscc Fri Mar 4 23:51:55 -0600 2005
From: wyscc
Date: Fri, 04 Mar 2005 23:51:55 -0600
Subject: anonymous function
Message-ID: <20050304235155-0600@page.axiom-developer.org>

Thanks to both contributions and guides to use composition. However, this is a bug still since the original code works under the NAG version. We should figure out why the open source version breaks down. Afterall, anonymous functions are convenience that the system should be able to handle by assigning intermediate variables automatically. 

From unknown Tue Mar 8 04:54:41 -0600 2005
From: 
Date: Tue, 08 Mar 2005 04:54:41 -0600
Subject: property change
Message-ID: <20050308045441-0600@page.axiom-developer.org>



From unknown Tue Mar 22 20:12:54 -0600 2005
From: 
Date: Tue, 22 Mar 2005 20:12:54 -0600
Subject: property change
Message-ID: <20050322201254-0600@page.axiom-developer.org>

Severity: serious => critical 

From greg Sat Apr 1 10:37:11 -0600 2006
From: greg
Date: Sat, 01 Apr 2006 10:37:11 -0600
Subject: property change
Message-ID: <20060401103711-0600@wiki.axiom-developer.org>

Status: open => pending (next release) 


From greg Wed Apr 19 12:34:59 -0500 2006
From: greg
Date: Wed, 19 Apr 2006 12:34:59 -0500
Subject: fixed in --patch-49
Message-ID: <20060419123459-0500@wiki.axiom-developer.org>

Status: pending (next release) => closed 


Submitted by : (unknown) at: 2007-11-17T21:53:17-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

This problem does not occur on the NAG version:

  \begin{axiom}
  dom:=(INT->INT)
  g(f:dom):dom== x+->(f(x))^2
  p(x:INT):INT == x-1
  \end{axiom}

The next line crashes Axiom. (Here the crash is indicated by not showing the result for q which should be something like theMap(LAMBDA_ibs3ze_708.174) (from NAG version):

  \begin{axiom}
  q:= g p
  \end{axiom}

Below is the transcript for the NAG version:

G82322 (1) -> dom:= (INT->INT)

(1) (Integer -> Integer) Type: Domain G82322 (2) -> g(f:dom):dom== x+->(f(x))^2 Function declaration g : (Integer -> Integer) -> (Integer -> Integer ) has been added to workspace. Type: Void G82322 (3) -> p(x:INT):INT==x-1 Function declaration p : Integer -> Integer has been added to workspace. Type: Void G82322 (4) -> q:= g p Compiling function p with type Integer -> Integer Compiling function g with type (Integer -> Integer) -> (Integer -> Integer)

+++ |*1;g;1;G82322| redefined
   (4)  theMap(LAMBDA_ibs3ze_708,174)
                                                   Type: (Integer -> Integer)
G82322 (5) -> q 3

(5) 4 Type: PositiveInteger

property change --wyscc, Fri, 04 Mar 2005 04:37:59 -0600 reply
Name: #114 Maps on Function crash => #114 Map on Functions crash

Here is one way that works
Fri, 04 Mar 2005 05:18:25 -0600 reply
fricas
(1) -> )clear all
All user variables and function definitions have been cleared.

We can avoid the use of an anonymous function and use function composition to define the functional g as follows:

fricas
dom ==> INT -> INT
Type: Void
fricas
g(f:dom):dom ==
  function(x^2,sq,x)
  sq * f
Function declaration g : (Integer -> Integer) -> (Integer -> Integer ) has been added to workspace.
Type: Void
fricas
p(x:INT):INT == x-1
Function declaration p : Integer -> Integer has been added to workspace.
Type: Void
fricas
q := g p
fricas
Compiling function p with type Integer -> Integer 
   There are 31 exposed and 40 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) 
                                Variable(sq)
                            (Integer -> Integer)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code.
fricas
Compiling function g with type (Integer -> Integer) -> (Integer -> 
      Integer) 
   Compiled code for g has been cleared.
fricas
Compiling function sq with type Integer -> Integer

\label{eq1}\mbox{theMap (...)}(1)
Type: (Integer -> Integer)
fricas
q 3

\label{eq2}4(2)
Type: PositiveInteger?

Using the SPAD compiler --Bill Page, Fri, 04 Mar 2005 07:03:34 -0600 reply
Take a look at FunctionalMapping? for an example of this sort thing written in SPAD.

anonymous function --wyscc, Fri, 04 Mar 2005 23:51:55 -0600 reply
Thanks to both contributions and guides to use composition. However, this is a bug still since the original code works under the NAG version. We should figure out why the open source version breaks down. Afterall, anonymous functions are convenience that the system should be able to handle by assigning intermediate variables automatically.

property change
Tue, 08 Mar 2005 04:54:41 -0600 reply
property change
Tue, 22 Mar 2005 20:12:54 -0600 reply
Severity: serious => critical

property change --greg, Sat, 01 Apr 2006 10:37:11 -0600 reply
Status: open => pending (next release)

fixed in --patch-49 --greg, Wed, 19 Apr 2006 12:34:59 -0500 reply
Status: pending (next release) => closed