axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: [Axiom-mail] Function returning UnivariateTaylorSe


From: Stephen Wilson
Subject: [Axiom-developer] Re: [Axiom-mail] Function returning UnivariateTaylorSeries
Date: Sat, 27 Nov 2004 13:03:46 -0500
User-agent: Mutt/1.4.2i

Hello Marcus,


I've been looking at your problem. Im afraid I dont have a
solution. However in trying to debug the code I discovered where the
system error is generated.

Tim, could you read this and give me an idea where in the axiom code I
might look for the problem? The domain vector is not being constructed
properly, leading to the problem below:

Basicly, the call is failing in the conversion to Outputform
(in pscat.spad). A call to center(%) from UnivariateTaylorSeries is
returning some interesting entities when F00 is parameterized over
POLY INT.  center() is returning (in Lisp) the integer 0, rather
than the list (0 . 0) [representing univaraiate polynomial zero]. This
integer is utimately passed to the polynomial zero? predicate, which
causes the system error.

I added two PPRINT forms to the lisp corresponding to coerce(%):
Outputform (the lisp funtion |UTSCAT-;coerce;SOf;5|) which illustrates
the problem:

 -------------------------------------------
(1) -> P := Foo(POLY INT, new()$Symbol)

   (1)  Foo(Polynomial Integer,%A)
                                                                 Type:
                                                                 Domain
(2) -> bar()$P

0                                              <-- return result of center()
(|newGoGet| #<vector 08feaab8> 15 . |zero?|)   <-- lookup the zero? function
   >> System error:
   Caught fatal error [memory may be damaged]
 -------------------------------------------

Now in changing the code for Foo by adding explicit package calls for
the 0 constants:

 --------------------------------------------
 )abbrev package FOO Foo
 Foo(K,z): Exports == Implementation where
   K : Ring
   z : Symbol
 
   Exports ==> with
     bar: () -> UnivariateTaylorSeries(K,z,0$K)
 
   Implementation ==> add
     bar ==
       st := generate(const(1)$MappingPackage2(K, K), 0$K)$Stream(K)
       series(st)$UnivariateTaylorSeries(K,z,0$K)
 -------------------------------------------

recompiling and run again:

 -------------------------------------------
(1) -> P := Foo(POLY INT, new()$Symbol)

   (1)  Foo(Polynomial Integer,%A)
                                                                 Type:
                                                                 Domain
(2) -> bar()$P

(|elt| (|Polynomial| (|Integer|)) 0)           <-- return result of center()
(|newGoGet| #<vector 08feaab8> 15 . |zero?|)   <-- lookup the zero? function
   >> System error:
   Caught fatal error [memory may be damaged]
 -------------------------------------------

Note now the return result of center() has changed.

The newGoGet _is_ returning the proper zero? for the SMP domain.

In the first case above (center returning integer zero) adding lisp by
hand of the form `(if (zerop |cen|) (setq |cen| '(0 . 0)))' results in
bar() returning as you would expect.

Tim, where might I find the code which generates the domain vectors?
center() simply does a (qrefelt $ 8) - $ being the domain vector for
the given UnivariateTaylorSeries. 

With luck I might be able to solve this. If not at least I'll learn
something.

Sincerely,
Steve


On Thu, Nov 25, 2004 at 05:27:09PM +0100, Marcus Better wrote:
> Hello,
> 
> I am trying to create a function (in a spad package) that will compute 
> some coefficients and assemble them into a Taylor series, which it will 
> return. I run into some strange errors. I simplified the code as much as 
> possible, so that it looks like this:
> 
> --------------------------------------------
> )abbrev package FOO Foo
> Foo(K,z): Exports == Implementation where
>   K : Ring
>   z : Symbol
> 
>   Exports ==> with
>     bar: () -> UnivariateTaylorSeries(K,z,0)
> 
>   Implementation ==> add
>     bar ==
>       st := generate(const(1)$MappingPackage2(K, K), 0)$Stream(K)
>       series(st)$UnivariateTaylorSeries(K,z,0)
> -------------------------------------------
> 
> This will work when called as
> 
>   bar()$Foo(INT, new()$Symbol)
> 
> but writing instead
> 
>   bar()$Foo(POLY INT, new()$Symbol)
> 
> gives me
> 
>    >> System error:
>    Caught fatal error [memory may be damaged]
> 
> The same goes for FRAC INT instead of POLY INT. Moreover, doing
> 
>   bar$Foo(INT, new()$Symbol)
> 
> returns
> 
>   theMap(FOO;bar;Uts;1,312)
> 
> as it should, but
> 
>   bar$Foo(FRAC INT, new()$Symbol)
> 
> gives the "Caught fatal error" message again.
> 
> (In my real code I need other types than INT, of course.)
> 
> I don't have a clue how to solve this. In particular, I would like to 
> pass the z argument directly to the function, but that did not succeed 
> so far.
> 
> I use axiom-0.20040831-1 on Debian Sarge i386.
> 
> Marcus
> 
> 
> _______________________________________________
> Axiom-mail mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/axiom-mail




reply via email to

[Prev in Thread] Current Thread [Next in Thread]