On 10/21/2012 03:13 AM, someone wrote:
> Another small question: why does this
>
> n : NNI := #m
> na : NNI := floor(n/2)::NNI
> nb : NNI := (n - na)::NNI
>
> fail compiling with
>
> ****** level 5 ******
> $x:= (/ n 2)
> $m:= $EmptyMode
Just guessing... because you cannot divide in NNI, FriCAS has to find an
operation /: (NNI, NNI) -> X, where X is such that there is a function
floor: X -> Integer. It would probably work if X=Fraction(Integer), but
if currently Fraction(Integer) is not in scope, FriCAS fails to find an
operation floor. In fact, as the error message shows, it already fails
to find an operation /: (NNI, NNI) -> X with some X.
I guess, if you put
import Fraction(Integer)
just after the "add" or even inside your function definition, the code
should compile.
However, you don't need that. You are probably better off with the
function "shift".
na: NNI := shift(n, -1)
Ralf
==============================================================
(1) -> )disp op shift
There are 3 exposed functions called shift :
[1] (Float,Integer) -> Float from Float
[2] (D,D) -> D from D if D has INS
[3] (NonNegativeInteger,Integer) -> NonNegativeInteger
from NonNegativeInteger
There are 2 unexposed functions called shift :
[1] (MoebiusTransform(D1),D1) -> MoebiusTransform(D1)
from MoebiusTransform(D1) if D1 has FIELD
[2] D1 -> MoebiusTransform(D1) from MoebiusTransform(D1) if D1 has
FIELD
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.