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

Submitted by : (unknown) at: 2007-11-17T21:53:17-08:00 (16 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 replySeverity: 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




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