> > 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.
Yes. I'd expect FRAC INT or even FRAC NNI for X. > It would probably work if > X=Fraction(Integer), but if currently Fraction(Integer) is not in > scope, FriCAS fails to find an operation floor. Aha. > 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) Where can I find the rules on when I need an import statement? > just after the "add" or even inside your function definition, the code > should compile. Yes, it does so. > However, you don't need that. You are probably better off with the > function "shift". > > na: NNI := shift(n, -1) > [3] (NonNegativeInteger,Integer) -> NonNegativeInteger > from NonNegativeInteger Fine. I did not know about this function. Very useful. Thanks a lot for your help on this topic. -- 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.
