axiom-developer
[Top][All Lists]
Advanced

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

RE: [Axiom-developer] Axiom BNF


From: Martin Rubey
Subject: RE: [Axiom-developer] Axiom BNF
Date: Mon, 25 Oct 2004 22:36:46 +0200

Hi Bill!

here is the real life thing:

              if degree f.factor = 1 then
                Av := -coefficient(f.factor, 0)/leadingCoefficient f.factor
                if Av ~= 0 then
                  res5 := factor(univariate(eval(p3,'A::Symbol,Av)))$GF
                  for g in factors res5 repeat
                    if degree g.factor = 1 then
                      a1v := -coefficient(g.factor, 0)
                              /leadingCoefficient g.factor 

                      res := cons([rat2expr2(xx, ri.function, Av, a1v)
                                   *(coerce(Av-(len+3)*a1v)
                                     +coerce(a1v)*(xx::EXPRR))
                                    **(xx::EXPRR), 
                                   reduce(max, ri.unattainable, 0)
                                     $List(Integer)::NNI], 
                                  res)
                    else
                      a1v := kernel(opalg, [poly2expr(xx, g.factor), xx::EXPRR])
                      output(a1v::OutputForm)$OutputPackage
              else
                a1v := kernel(opalg, [poly2expr(xx, f.factor), xx::EXPRR])
                output(a1v::OutputForm)$OutputPackage

versus

              if degree f.factor = 1 then
                Av := -coefficient(f.factor, 0)/leadingCoefficient f.factor
                if Av ~= 0 then
                  res5 := factor(univariate(eval(p3,'A::Symbol,Av)))$GF
                  for g in factors res5 repeat
                    if degree g.factor = 1 then
                      a1v := -coefficient(g.factor, 0)
                              /leadingCoefficient g.factor 

                      res := cons([rat2expr2(xx, ri.function, Av, a1v)
                                   *(coerce(Av-(len+3)*a1v)
                                     +coerce(a1v)*(xx::EXPRR))
                                    **(xx::EXPRR), 
                                   reduce(max, ri.unattainable, 0)
                                     $List(Integer)::NNI], 
                                  res)
                 else
                    a1v := kernel(opalg, [poly2expr(xx, g.factor), xx::EXPRR])
                    output(a1v::OutputForm)$OutputPackage
              else
                a1v := kernel(opalg, [poly2expr(xx, f.factor), xx::EXPRR])
                output(a1v::OutputForm)$OutputPackage

If you are not careful, the 2 spaces of indentation are easily overlooked...
Of course, your analysis is correct. My point is only, that with braces or
parenthesis or whatever, this mistake wouldn't happen, not to me at least,
since it was clear to me where the else branch should belong, but I simply
missed the indentation. (I think, one if branch was added later, so I had to
reindent the whole thing)

But certainly, this is highly subjective, and therefore it is a real good thing
that you can choose piles or no piles.

Martin





reply via email to

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