#1271 Crazy results when doing limit of 'diff

closed
nobody
5
2009-09-04
2007-09-18
Anonymous
No

Maxima version: 5.13.0Maxima build date: 15:45 9/16/2007host type: i586-pc-linux-gnulisp-implementation-type: CLISPlisp-implementation-version: 2.41 (2006-10-13) (built 3380066971) (memory 3398964343)

Maxima returns crazy results when evaluating the limit of an unevaluated derivative:

Examples:
limit('diff((x+1)/(x^2-1),x),x,1);

limit('diff((x+1),x),x,1);

limit('diff((x+n),x),x,1);

Not only is the "with respect to" variable in the demoninator of the result wrong, i.e., d/d(x+1), but the limiting value of the variable is wrong. The limit was supposed to as x -> 1, but the output shows the limit as x->0

---
reporter's email: joe.vender AT owensboro.net

Discussion

  • Nobody/Anonymous

    snapshot of bug in wxMaxima session of maxima

     
  • Nobody/Anonymous

    Logged In: NO

    also;
    limit(('diff(x^n),x),x,1);

    returns 1.
    Notice the mismatch of the parentheses.

    The problem lies in that adding ",x" after 'diff(x^n) and putting parentheses around the whole expression returns whatever is put after the comma instead of (del(x^n),x).

    Ex.
    'diff(x^n)
    returns
    del(x^n)

    ('diff(x^n),x)
    returns
    x

    ('diff(x^n),abc)
    returns
    abc

    which is then evaluated by the limit function.

    It appears that when entering something like
    (f(x),f(y))
    maxima always outputs f(y)

     
  • Stavros Macrakis

    Logged In: YES
    user_id=588346
    Originator: NO

    The original bug is valid. A simple case:
    limit('diff(y,x),x,1) => 'limit('diff(y,x+1,1),x,0)

    The followup comment is confused. The syntax (..., ..., ...) in Maxima evaluates each of the elements of the list and returns the last value. This is the correct behavior.

     
  • Robert Dodier

    Robert Dodier - 2007-09-23
    • labels: --> Lisp Core - Limit
     
  • Nobody/Anonymous

    Logged In: NO

    limit(diff((x+1)/(x^2-1),x),x,1);

    works fine .

    and also the others:

    limit(diff((x+1),x),x,1);
    limit(diff((x+n),x),x,1);

     
  • Stavros Macrakis

    Logged In: YES
    user_id=588346
    Originator: NO

    Dear "nobody" (2007-10-07 22:49), the quotation mark (') in the original bug report is critical. There is no problem with limit(diff((x+1),x),x,1); there *is* a problem with limit('diff((x+1),x),x,1).

     
  • Dieter Kaiser

    Dieter Kaiser - 2009-08-29

    Limit does not try to simplify noun forms of derivatives, but replaces the noun forms by a gensym. This is done in $limit with a call to hide in the following line of code:

    (setq exp
    (resimplify
    (factosimp
    (tansc
    (lfibtophi
    (limitsimp ($expand (hide exp) 1 0) var))))))

    I think the problem is, that hide is called to late. At this point the limit values have already been transformed.

    This is a piece of the corrected code:

    ;; Hide expressions with limit, derivative, integrate, sum
    ;; before any transformations of the limit values
    (setq exp (hide exp))

    ;; Transform the limit value.
    (unless (infinityp val)
    (unless (zerop2 val)
    (setq exp (subin (m+ var val) exp)))
    (setq val (cond ((eq dr '$plus) '$zeroa)
    ((eq dr '$minus) '$zerob)
    (t 0)))
    (setq origval 0))

    (setq exp
    (resimplify
    (factosimp
    (tansc
    (lfibtophi
    (limitsimp ($expand exp 1 0) var))))))

    These are the results for the reported examples:

    (%i11) limit('diff((x+1)/(x^2-1),x),x,1);
    (%o11) 'limit('diff((x+1)/(x^2-1),x,1),x,1)
    (%i12) limit('diff((x+1),x),x,1);
    (%o12) 'limit('diff(x+1,x,1),x,1)
    (%i13) limit('diff((x+n),x),x,1);
    (%o13) 'limit('diff(x+n,x,1),x,1)

    This change solves similar problems with the limit of 'integrate too.

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2009-09-04

    Applied suggested fix in limit.lisp revision 1.87.

    Closing this bug report as fixed.

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2009-09-04
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks