Menu ▾ ▴

#608 taylor(x^a,[x],0,1) unsimplified

None
closed
3
2022-04-19
2004-10-06
No

taylor(x^a,[x],0,1) => 1^2*x^a+...

Note unsimplified 1^2.

Related

Bugs: #545

Discussion

  • Barton Willis

    Barton Willis - 2004-10-06

    Logged In: YES
    user_id=895922

    Maybe there is a connection between this
    bug and bug 974734.

    Barton

     
  • Robert Dodier

    Robert Dodier - 2006-04-09
    • labels: --> Lisp Core - Taylor
     
  • Kris Katterjohn

    Kris Katterjohn - 2022-04-15
    • assigned_to: Kris Katterjohn
    • Group: --> None
     
  • Kris Katterjohn

    Kris Katterjohn - 2022-04-15

    Here are some other simple examples:

    (%i1) taylor(x^a,[x],0,1);
    (%o1) +1^2*x^a
    
    (%i2) taylor((x*y)^a,[x,y],0,1);
    (%o2) +1^4*(x*y)^a
    
    (%i3) taylor(x^a+y^a,[x,y],0,1);
    (%o3) +(1^2*y^a+1^2*x^a)
    

    (So, it's easy to get 1 raised to a large exponent and to get a bunch of unsimplified factors of 1 raised to stuff in multiple terms.)

    In SETUP-MULTIVAR-DISREP genvars associated with multivars are set up with a DISREP property so they disrep to 1.

    Up until a couple of weeks ago when I fixed bugs [#1848]/[#2446], you could see these internal gensyms that disrep to 1 by using taytorat:

    (%i4) taylor(x^a,[x],0,1);
    (%o4) +1^2*x^a
    
    (%i5) taytorat(%); /* commit 38d4b2 fixed gensym leak */
    (%o5) (g536^a)^2*x^a
    

    Anyway, these visible unsimplified factors like 1^2 are introduced during disrep in PDISREP!. This function contains some special knowledge such as foo^0 is equal to 1 and foo^1 is equal to foo. We can add to PDISREP! the knowledge that 1^bar is equal to 1:

    diff --git a/src/rat3e.lisp b/src/rat3e.lisp
    index 99a8eb594..6ede4611c 100644
    --- a/src/rat3e.lisp
    +++ b/src/rat3e.lisp
    @@ -924,6 +924,7 @@
                                     (eq (caar var) 'mplus))
                                 (copy-list var))
                                (t var)))
    
    +       ((eql var 1) 1)
            (t (list '(mexpt ratsimp) var n))))
    
     (defun pdisrep+ (p)
    

    This causes no problems with the test suite or share test suite. And then we have this:

    (%i8) taylor(x^a,[x],0,1);
    (%o8) +x^a
    
    (%i9) taylor((x*y)^a,[x,y],0,1);
    (%o9) +(x*y)^a
    
    (%i10) taylor(x^a+y^a,[x,y],0,1);
    (%o10) +(y^a+x^a)
    
     

    Related

    Bugs: #1848
    Bugs: #2446

  • Kris Katterjohn

    Kris Katterjohn - 2022-04-15

    My patch does not fix bug [#577], which Barton had suspected might be related. That seems to be a separate bug.

     

    Related

    Bugs: #577

  • Kris Katterjohn

    Kris Katterjohn - 2022-04-19
    • status: open --> closed
     
  • Kris Katterjohn

    Kris Katterjohn - 2022-04-19

    Fixed by commit [f1ccc6].

     

    Related

    Commit: [f1ccc6]


Log in to post a comment.