next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: expression

expression -- convert to an expression

Synopsis

Description

Here is example of a function that expresses small rational numbers as Egyptian fractions using expression.
i1 : egyptian = method();
i2 : egyptian QQ := x -> if x == 0 then 0 else (
          n := ceiling(1/x);
          expression(1/n) + egyptian(x - 1/n));
i3 : egyptian(30/31)

     1   1   1    1      1         1
o3 = - + - + - + --- + ----- + ---------
     2   3   8   107   15922   633759288

o3 : Expression of class Sum

Ways to use expression :