Skip to content

Commit

Permalink
A couple of doc tagging corrections (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky authored Jan 29, 2025
1 parent 275a3b8 commit d446ead
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions mathics/builtin/intfns/combinatorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ class PolygonalNumber(Builtin):
See also <url>
:Binomial:
doc/reference-of-built-in-symbols/integer-functions/combinatorial-functions/binomial/</url>, and <url>
/doc/reference-of-built-in-symbols/integer-functions/combinatorial-functions/binomial/</url>, and <url>
:RegularPolygon:
doc/reference-of-built-in-symbols/drawing-graphics/regularpolygon/</url>.
/doc/reference-of-built-in-symbols/drawing-graphics/regularpolygon/</url>.
"""

attributes = A_LISTABLE | A_NUMERIC_FUNCTION | A_PROTECTED | A_READ_PROTECTED
Expand Down
22 changes: 15 additions & 7 deletions mathics/builtin/numbers/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,10 @@ class Integers(Builtin):

class Integrate(SympyFunction):
r"""
<url>:WMA link:
https://reference.wolfram.com/language/ref/Integrate.html</url>
<url>:Integral:https://en.wikipedia.org/wiki/Integral</url> (<url>:SymPy:
https://docs.sympy.org/latest/modules/integrals/integrals.html</url>, \
<url>:WMA:
https://reference.wolfram.com/language/ref/Integrate.html</url>)
<dl>
<dt>'Integrate[$f$, $x$]'
Expand Down Expand Up @@ -984,18 +986,20 @@ class Integrate(SympyFunction):
>> Integrate[4 Sin[x] Cos[x], x]
= 2 Sin[x] ^ 2
> Integrate[-Infinity, {x, 0, Infinity}]
>> Integrate[-Infinity, {x, 0, Infinity}]
= -Infinity
> Integrate[-Infinity, {x, Infinity, 0}]
= Infinity
Integrating something ill-defined returns the expression untouched:
Integration in TeX:
>> Integrate[1, {x, Infinity, 0}]
= Integrate[1, {x, Infinity, 0}]
Here how is an example of converting integral equation to TeX:
>> Integrate[f[x], {x, a, b}] // TeXForm
= \int_a^b f\left[x\right] \, dx
Sometimes there is a loss of precision during integration.
You can check the precision of your result with the following sequence
You can check the precision of your result with the following sequence \
of commands.
>> Integrate[Abs[Sin[phi]], {phi, 0, 2Pi}] // N
= 4.
Expand Down Expand Up @@ -1114,6 +1118,10 @@ def eval(self, f, xs, evaluation: Evaluation, options: dict): # type: ignore[ov
# e.g. NotImplementedError: Result depends on the sign of
# -sign(_u`j)*sign(_u`w)
return
except TypeError:
# SymPy can give this. For example:
# Integrate[-Infinity, {x, 0, Infinity}]
return
if prec is not None and isinstance(sympy_result, sympy.Integral):
# TODO MaxExtraPrecision -> maxn
sympy_result = sympy_result.evalf(dps(prec))
Expand Down

0 comments on commit d446ead

Please sign in to comment.