axiom-mail
[Top][All Lists]
Advanced

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

[Axiom-mail] create a function


From: Renata Cereja
Subject: [Axiom-mail] create a function
Date: Wed, 18 Mar 2009 21:58:23 -0300

I created the following function:
 
AddPoints(func:POLY(INT),P1:LIST(INT),P2:LIST(INT)):LIST(FRAC(INT)) ==
   z:=1
   if (P1.3 = 1) and (P2.3 = 1) then
      if (P1.1 < P2.1) then
         m:= (P2.2 - P1.2)/(P2.1 - P1.1)
      if (P2.1 < P1.1) then
         m:= (P1.2 - P2.2)/(P1.1 - P2.1)
      if (P1.1 = P2.1) and (P1.2 ~= P2.2) then
         z:=0
      if (P1.1 = P2.1) and (P1.2 = P2.2) then
         dx(x) == D(func,x)
         m:= dx(P1.1)/(2*P1.2)
      if (z = 1) then
         a := m^2
         xsoma := (-(P1.1 + P2.1 - a))
         ysoma := ((m*(xsoma-P1.1) + P1.2) * (-1))
         ponto := [xsoma,ysoma,z]
         ponto
      else
         [0,1,z]
   else
      if (P1.3 = 0) then
         ponto := P2
      else
         ponto := P1
      ponto

When I use this function, the following message appears before the result:

   Compiled code for dx has been cleared.
   Compiled code for AddPoints has been cleared.
   1 old definition(s) deleted for function or rule dx 
   Your _expression_ cannot be fully compiled because it contains an 
      integer _expression_ (for x ) whose sign cannot be determined (in 
      general) and so must be specified by you. Perhaps you can try 
      substituting something like
                                  (x :: PI) 
                                     or
                                 (x :: NNI) 
      into your _expression_ for x .
   AXIOM will attempt to step through and interpret the code.
   Cannot compile map: dx 
   We will attempt to interpret the code.
   Compiling function AddPoints with type (Polynomial Integer,List 
      Integer,List Integer) -> List Fraction Integer 
  Compiled code for dx has been cleared.
  Compiled code for AddPoints has been cleared.
  1 old definition(s) deleted for function or rule dx
   Compiling function dx with type PositiveInteger -> Integer

What can I do to this not happen? Because I have another function that uses this one and isn't working as well as I wanted. I think this happen because of the function AddPoints.

Thanks,
Cereja


reply via email to

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