composition of functions not supported in axiom ???

View: New views
2 Messages — Rating Filter:   Alert me  

composition of functions not supported in axiom ???

by Michael Becker-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



    Hi,

       the following shows that f(g(x)) does not always behave as expected.


   
(1) -> istr := [i for i in  1..]
(1) ->
   (1)  [1,2,3,4,5,6,7,8,9,10,...]
                                                 Type: Stream PositiveInteger
(2) -> filterWhile ((x+-> (x ~= 3)),cons(9,istr))
(2) ->
   (2)  [9,1,2]
                                                 Type: Stream PositiveInteger
(3) -> maxIndex %
(3) ->
   (3)  3
                                                        Type: PositiveInteger
(4) -> maxIndex ( filterWhile ((x+-> (x ~= 3)),cons(9,istr)) )
 4) ->
   >> Error detected within library code:
   maxIndex: infinite stream




    -- Michael



  ps:  same result in fricas or open-axiom.

   









------------------------------------------------------------------------------------
Diese Nachricht könnte vertrauliche und/oder rechtlich
geschützte Informationen enthalten. Wenn Sie nicht der
Adressat dieser Email sind oder nicht autorisiert sind, diese
für den Adressaten entgegenzunehmen, so ist es untersagt,
diese Nachricht oder in ihr enthaltene Informationen zu nutzen,
zu kopieren, offen zu legen oder anderweitig weiterzuverarbeiten.
Sollten Sie diese Nachricht fälschlicherweise erhalten haben,
verständigen Sie den Absender bitte unverzüglich per Antwort auf
diese Mail und löschen sie diese anschließend.
Vielen Dank für Ihre Kooperation.
------------------------------------------------------------------------------------
This message may contain confidential and/or privileged
information. If you are not the addressee or authorized
to receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein. If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your co-operation.
------------------------------------------------------------------------------------
We make your business move.




_______________________________________________
Axiom-developer mailing list
Axiom-developer@...
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Re: composition of functions not supported in axiom ???

by William Sit-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Michael:

I think this is a problem with operations on Stream
objects, in that evaluation is not automatic (lazy
evaluation). Thus you must explicitly request that the
Stream be evaluated.

(11) -> maxIndex (complete filterWhile ((x+-> (x ~=
3)),cons(9,istr)) )

   (11) 3
                                                        Type:
PositiveInteger

William


On Sat, 25 Jul 2009 03:18:41 +0200
  Michael Becker <Michael.Becker@...> wrote:

>
>
>     Hi,
>
>        the following shows that f(g(x)) does not always
>behave as expected.
>
>
>    
>(1) -> istr := [i for i in  1..]
>(1) ->
>    (1)  [1,2,3,4,5,6,7,8,9,10,...]
>                                                  Type:
>Stream PositiveInteger
>(2) -> filterWhile ((x+-> (x ~= 3)),cons(9,istr))
>(2) ->
>    (2)  [9,1,2]
>                                                  Type:
>Stream PositiveInteger
>(3) -> maxIndex %
>(3) ->
>    (3)  3
>                                                         Type:
>PositiveInteger
>(4) -> maxIndex ( filterWhile ((x+-> (x ~=
>3)),cons(9,istr)) )
>  4) ->
>    >> Error detected within library code:
>    maxIndex: infinite stream
>
>
>
>
>     -- Michael
>
>
>
>   ps:  same result in fricas or open-axiom.
>
>    
>
>
>
>
>
>
>
>
>
>------------------------------------------------------------------------------------
>Diese Nachricht könnte vertrauliche und/oder rechtlich
>geschützte Informationen enthalten. Wenn Sie nicht der
>Adressat dieser Email sind oder nicht autorisiert sind,
>diese
>für den Adressaten entgegenzunehmen, so ist es untersagt,
>diese Nachricht oder in ihr enthaltene Informationen zu
>nutzen,
>zu kopieren, offen zu legen oder anderweitig
>weiterzuverarbeiten.
>Sollten Sie diese Nachricht fälschlicherweise erhalten
>haben,
>verständigen Sie den Absender bitte unverzüglich per
>Antwort auf
>diese Mail und löschen sie diese anschließend.
>Vielen Dank für Ihre Kooperation.
>------------------------------------------------------------------------------------
>This message may contain confidential and/or privileged
>information. If you are not the addressee or authorized
>to receive this for the addressee, you must not use,
>copy,
>disclose or take any action based on this message or any
>information herein. If you have received this message in
>error, please advise the sender immediately by reply
>e-mail
>and delete this message. Thank you for your co-operation.
>------------------------------------------------------------------------------------
>We make your business move.
>
>
>
>
>_______________________________________________
>Axiom-developer mailing list
>Axiom-developer@...
>http://lists.nongnu.org/mailman/listinfo/axiom-developer

William Sit, Professor Emeritus
Mathematics, City College of New York                  
Office: R6/202C Tel: 212-650-5179
Home Page: http://scisun.sci.ccny.cuny.edu/~wyscc/


_______________________________________________
Axiom-developer mailing list
Axiom-developer@...
http://lists.nongnu.org/mailman/listinfo/axiom-developer