Skip to content

Computing the limit of the lognormal density crashes Sage #26497

@EmmanuelCharpentier

Description

@EmmanuelCharpentier

Define the lognormal density starting from the normal:

var("mu", domain="real")
var("y, m, s, sigma", domain="positive")
dnorm(x, mu, sigma) = e^(-(x-mu)^2/(2*sigma^2))/(sigma*sqrt(2*pi))
dlnorm(y, mu, sigma) = (dnorm(x, mu, sigma).subs(x==log(y))*abs(diff(log(y),y))).simplify()

Let's try to prove that the limit is 0 at 0 and oo:

sage: dlnorm(y, mu, sigma).limit(y=oo)
0

So far so good. But:

dlnorm(y, mu, sigma).limit(y=0, dir="+")
;;;
;;; Detected access to protected memory, also kwown as 'bus or segmentation fault'.
;;; Jumping to the outermost toplevel prompt
;;;

## Numerous repetitions...

Process Sage erreur de segmentation

This seems analogous to but different from #14677...

This limit also seems problematic in other subsystems:

  • Sympy returns "Not implemented"
  • libgiac returns "Infinity" (wrong)
  • Mathematica doesn't return (but (correctly) returns 0 when used directly).
  • Used directly, Maxima asks a lot of questions, and fails:
limit(dlnorm(y, mu, sigma), y, 0);
Is sigma^2-mu positive, negative or zero?

p;
Is mu positive, negative or zero?

p;
Is 2*sigma^2-mu positive, negative or zero?

p;
(%o10) ('limit(%e^-((log(y)-mu)^2/(2*sigma^2))/y,y,0))/(sqrt(2)*sqrt(%pi)
                                                               *sigma)

This failure mode is different from the one seen in Sage; we may have a new bug...

Upstream: Not yet reported upstream; Will do shortly.

CC: @slel

Component: symbolics

Keywords: limit, maxima

Issue created by migration from https://trac.sagemath.org/ticket/26497

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions