Opened 4 years ago

Last modified 2 years ago

#17428 new defect

wrong limit in derivative

Reported by: wonder Owned by:
Priority: major Milestone: sage-6.5
Component: symbolics Keywords: derivative limit
Cc: kcrisman, nbruin, jakobkroeker Merged in:
Authors: Reviewers:
Report Upstream: Reported upstream. No feedback yet. Work issues:
Branch: Commit:
Dependencies: Stopgaps: wrongAnswerMarker

Description (last modified by wonder)

I'm seeing this behavior in sage 6.4, just built from git:

$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ Sage Version 6.4, Release Date: 2014-11-14                         │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: e = SR('a*f(x)+g(x)')
sage: e
a*f(x) + g(x)
sage: e.limit(x=0)
limit(a*f(x) + g(x), x, 0)
sage: e.limit(x=0).limit(a=0)
limit(g(x), x, 0)
sage: de = diff(e,SR('x'))
sage: de
a*D[0](f)(x) + D[0](g)(x)
sage: de.limit(x=0)
limit(a*D[0](f)(x) + D[0](g)(x), x, 0)
sage: de.limit(x=0).limit(a=0)
D[0](g)(x)

The last result should be limit(D[0](g)(x), x, 0).

For reference, this report was also posted to sage-devel.

Change History (7)

comment:1 Changed 4 years ago by wonder

  • Description modified (diff)

comment:2 Changed 4 years ago by pbruin

  • Cc kcrisman nbruin added
  • Component changed from PLEASE CHANGE to symbolics
  • Keywords derivative limit added
  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.
  • Type changed from PLEASE CHANGE to defect

The same happens in Maxima:

Maxima 5.34.1 http://maxima.sourceforge.net
using Lisp ECL 13.5.1
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) e: a*f(x) + g(x);
(%o1)                            g(x) + a f(x)
(%i2) limit(e, x, 0);
(%o2)                       limit  (g(x) + a f(x))
                            x -> 0
(%i3) limit(limit(e, x, 0), a, 0);
(%o3)                             limit  g(x)
                                  x -> 0
(%i4) de: diff(e, x);
                           d              d
(%o4)                      -- (g(x)) + a (-- (f(x)))
                           dx             dx
(%i5) limit(de, x, 0);
                              d              d
(%o5)                 limit  (-- (g(x)) + a (-- (f(x))))
                      x -> 0  dx             dx
(%i6) limit(limit(de, x, 0), a, 0);
                                   d
(%o6)                              -- (g(x))
                                   dx

Possibly related: #7401 [edit: it is not]

Last edited 4 years ago by pbruin (previous) (diff)

comment:3 Changed 4 years ago by pbruin

A slightly simpler example:

(%i1) dg: diff(g(x), x);
                                   d
(%o1)                              -- (g(x))
                                   dx
(%i2) lim: limit(dg, x, 0);
                                      d
(%o2)                          limit  -- (g(x))
                               x -> 0 dx
(%i3) limit(lim, x, 0);
                                          d
(%o3)                      limit  (limit  -- (g(x)))
                           x -> 0  x -> 0 dx
(%i4) limit(lim, a, 0);
                                   d
(%o4)                              -- (g(x))
                                   dx

In %i3 the double limit over x is not simplified (this might be a different problem); in %i4 taking the limit over a (which does not occur in the expression at all) removes the limit over x.

comment:4 follow-up: Changed 4 years ago by kcrisman

Well, that is definitely a problem. Did you report upstream yet?

comment:5 in reply to: ↑ 4 Changed 4 years ago by pbruin

Replying to kcrisman:

Well, that is definitely a problem. Did you report upstream yet?

I just opened https://sourceforge.net/p/maxima/bugs/2877/ for this.

comment:6 Changed 4 years ago by pbruin

  • Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.

comment:7 Changed 2 years ago by jakobkroeker

  • Cc jakobkroeker added
  • Stopgaps set to wrongAnswerMarker
Note: See TracTickets for help on using tickets.