rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

limit of even function is different from plus or minus direction #1171

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:03 Created by inducer77 on 2022-05-06 23:31:42 Original: https://sourceforge.net/p/maxima/bugs/3973


This limit is computed correctly:

(%i3) limit(log(4*sin(t)**2)-log(t**2), t, 0, plus);
(%o3)                               log(4)

This limit isn't:

(%i6) limit(log(4*sin(t)**2)-log(t**2), t, 0, minus);
(%o6)                         log(4) - 2 log(- 1)

(Observe that the function is even.)

Observed using

Maxima 5.45.1 https://maxima.sourceforge.io
using Lisp GNU Common Lisp (GCL) GCL 2.6.12

installed from Debian.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:04 Created by robert_dodier on 2022-05-07 05:18:00 Original: https://sourceforge.net/p/maxima/bugs/3973/#54ac


I think this isn't a bug since it appears to coming from the action of logexpand which is true by default. Looking at the expression by itself,

(%i6) log(4*sin(t)**2)-log(t**2);
                                    2
(%o6)                      log(4 sin (t)) - 2 log(t)

so, trying the limit again with logexpand = false,

(%i7) log(4*sin(t)**2)-log(t**2), logexpand = false;
                                    2            2
(%o7)                      log(4 sin (t)) - log(t )
(%i8) limit(log(4*sin(t)**2)-log(t**2), t, 0, minus), logexpand = false;
(%o8)                               log(4)

seems to give the expected result.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:07 Created by robert_dodier on 2022-05-08 19:46:01 Original: https://sourceforge.net/p/maxima/bugs/3973/#2d40


@dgildea @macrakis can I ask you for a second opinion on this? As I was saying in the previous comment, I think it's not a bug.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:11 Created by macrakis on 2022-05-08 20:53:17 Original: https://sourceforge.net/p/maxima/bugs/3973/#2d40/8a53


@robert_dodier, I agree completely. How is limit supposed to know that 2*log(t) came from log(t^2)?

We could think about finer-grained settings for the logexpand flag, e.g., logexpand:'abs makes log(x^EVEN) => EVEN*log(abs(x)) (since everything is assumed real by default) and log(PZ^EXP) => EXP*log(PZ), but nothing else, but that's another issue.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:14 Created by peterpall on 2022-05-09 04:22:09 Original: https://sourceforge.net/p/maxima/bugs/3973/#2d40/8a53/eb69


Added the logexpand proposal as https://sourceforge.net/p/maxima/feature-requests/170/ to the "feature request" tracker.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 01:47:18 Created by robert_dodier on 2022-05-10 05:28:16 Original: https://sourceforge.net/p/maxima/bugs/3973/#078e