Ask Your Question

Feedback and Potential Improvement

asked 2022-05-25 00:28:04 +0100

It would be good if

limit(1/x, x = 0)


limit(tan(x), x = pi/2)

showed undefined as the answer, rather than infinity.

Sage simplifies


to x and cannot do so for


Sage can't simplify cosh(x) - (e^x + e^(-x))/2 to 0.

It is counterintuitive for mathematician users to understand log(x) as ln(x), rather than the common log of x.

edit retag flag offensive close merge delete


Regarding your last point, my impression has been that the meaning of "log" changes depending on the person's level of experience. Math faculty tend to think of "log" as the natural log, and math undergraduates tend to think of "log" as being the base 10 logarithm. There is a transition in the middle, probably different for different people.

John Palmieri gravatar imageJohn Palmieri ( 2022-05-26 02:36:19 +0100 )edit

Also, regarding the log function, the "general mathematician" may / would expect an implementation for $$ log_b x\ . $$ Sage implements the above expression as log(x, b), and b is here an optional argument. If given, it is taken. Else it defaults in sage to $e$. In school, there was of course an other convention, $\ln$ was already explicitly $log_e$. And $log$ without and lower index decoration was $log_{10}$. But here, we have some double face of the log-notation, too. After passing some level of mathematical usage, notations are chosen to give a best fit for a purpose. And in my whole university courses there was never the case i was needing the expression $log_{10}x$. I was always using $log_e x$. In papers, $log$ is $\ln$. Note also:

sage: ln
dan_fulea gravatar imagedan_fulea ( 2022-05-26 18:40:26 +0100 )edit

The logarithm arise in elementary (high-school) analysis as $\log{x}=\displaystyle{\int_1^x \frac{\mathrm{d}t}{t}}$. This (mathematically) "natural" definition gives the natural (a. k. a. "Neperian") logarithm.

The one-time predominance of the "decimal" logarithm in engineering textbooks came from the (then very important) practical convenience of taking decimal logarithm : one needed only ONE table giving the$\log_{10}{x}$ for $x\in]1\ 10[$, which was completed using the $\log_{10}$ of the magnitude (which is an integer).

The introduction of computers (and hand-held calculators) has deprived this historical convenience of any practical relevance ; $\log_{10}$ is now an historical engineering fetish, as much as men's neckties and ladies' garter belts are fashion's fetishes...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-05-26 22:00:15 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-05-26 00:20:53 +0100

dan_fulea gravatar image

Let us take as a comparison the results for some sample limits.

Sage shows for limit(sin(1/x), x=0) an indefinite (but bounded) result.

For limit(1/sin(1/x), x=0) we get indeed und.

For the given limit computation of $1/x$ for $x\to 0$ we may compare:

sage: limit(1/x, x=0)
sage: limit(1/x, x=0, dir=None)    # default value for dir
sage: limit(1/x, x=0, dir='+')
sage: limit(1/x, x=0, dir='-')
sage: limit(1/x, x=0, dir='-', algorithm='maxima')
sage: limit(1/x, x=0, dir='+', algorithm='maxima')
sage: limit(1/x, x=0, algorithm='maxima')
sage: limit(1/x, x=0, algorithm='fricas')
sage: limit(1/x, x=0, dir='+', algorithm='fricas')
sage: limit(1/x, x=0, dir='-', algorithm='fricas')
sage: limit(1/x, x=0, algorithm='sympy')
sage: limit(1/x, x=0, dir='+', algorithm='sympy')
sage: limit(1/x, x=0, dir='-', algorithm='sympy')

The differences are minimal, but they are there. First of all, fricas delivers (through sage) the wanted value und. Then sage delivers three "differently printed" results, Infinity, +Infinity, and -Infinity for the direction respectively None (default), from the right (positive side), and from the left (negative side). For a closer look, let us compare:

sage: L  = limit(1/x, x=0)
sage: L1 = limit(1/x, x=0, dir='+')
sage: L2 = limit(1/x, x=0, dir='-')

sage: bool(L == L1)
sage: bool(L == L2)
sage: bool(L1 == L2)

sage: sign(L1)
sage: sign(L2)
sage: sign(L)

sage: L == Infinity
Infinity == +Infinity
sage: bool(L == Infinity)

sage: L == unsigned_infinity
Infinity == Infinity
sage: bool(L == unsigned_infinity)

sage: L.is_positive()
sage: L.is_positive_infinity()
sage: L.is_infinity()
sage: L1.is_positive()
sage: L1.is_positive_infinity()
sage: L1.is_infinity()
sage: L2.is_negative()
sage: L2.is_negative_infinity()

So we have three different "limits", L, L1, and L2.

For the second limit we have a similar situation:

sage: limit(tan(x), x = pi/2)
sage: limit(tan(x), x = pi/2, dir='-')
sage: limit(tan(x), x = pi/2, dir='+')

For the simplification, we have for instance:

sage: arcsinh(sinh(0))
sage: arcsinh(sinh(2*pi*i))

So there is some reason for keeping things as they are. (One may assume $x$ to be real, and then the story begins, somebody has to implement this simplification.)

For the final simplification we maybe also need an implementer.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-05-25 00:28:04 +0100

Seen: 351 times

Last updated: May 26 '22