A Python library for symbolic mathematics.
For installation instructions and usage information, see the online documentation.
New BSD License covers all files in this repository unless stated otherwise.
A Python CAS library
Home Page: https://diofant.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
A Python library for symbolic mathematics.
For installation instructions and usage information, see the online documentation.
New BSD License covers all files in this repository unless stated otherwise.
In [1]: from diofant import *
In [2]: x = Symbol('x')
In [3]: alpha = Symbol('alpha', positive=True)
In [4]: integrate((2 - x)**alpha*sin(alpha/x), (x, 0, 2))
Out[4]:
2
⌠
⎮ α ⎛α⎞
⎮ (-x + 2) ⋅sin⎜─⎟ dx
⎮ ⎝x⎠
⌡
0
And example from this ref.
PS: Perhaps it's a bug somewhere in the meijerint_definite
.
See this thread
In [1]: x, y, z = symbols('x, y, z', cls=Function)
In [2]: t = symbols('t')
In [3]: eqs = (-x(t) + Derivative(x(t), t) + Derivative(y(t), t), y(t) + Derivative(x(t), t) - Derivative(y(t), t))
In [4]: dsolve(eqs)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-66d52b90334b> in <module>()
----> 1 dsolve(eqs)
/home/sk/src/diofant/sympy/solvers/ode.py in dsolve(eq, func, hint, simplify, ics, xi, eta, x0, n, **kwargs)
576 """
577 if iterable(eq):
--> 578 match = classify_sysode(eq, func)
579 eq = match['eq']
580 order = match['order']
/home/sk/src/diofant/sympy/solvers/ode.py in classify_sysode(eq, funcs, **kwargs)
1445 if matching_hints['is_linear']:
1446 if order_eq == 1:
-> 1447 type_of_equation = check_linear_neq_order1(eq, funcs, func_coef)
1448
1449 if type_of_equation is None:
/home/sk/src/diofant/sympy/solvers/ode.py in check_linear_neq_order1(eq, func, func_coef)
1708 n = len(eq)
1709 fc = func_coef
-> 1710 t = func[0].args[0]
1711
1712 M = Matrix(n, n, lambda i, j: +fc[i, func[j], 1])
AttributeError: 'list' object has no attribute 'args'
In [3]: rsolve(f(n)-f(n-1)-2*f(n-2)-2*n, f(n))
Out[3]:
n n
(-1) ⋅C₀ + 2 ⋅C₁ + C₀⋅(2⋅n + 4)
c.f. Mathematica:
In[1]:= RSolve[-2*n + f[n] - 2*f[n - 2] - f[n - 1]==0, f[n], n]
RSolve[-2*n + f[n] - 2*f[n - 2] - f[n - 1]==0, f[n], n]
Out[1]=
-5 - 2 n n n
{{f[n] -> -------- + (-1) C[1] + 2 C[2]}}
2
See sympy/sympy#11261 (where wrong answer for IVP was reported).
Perhaps, it's the same problem as in the sympy/sympy#7055 (wrong extra linear term, shouldn't have C₀
here).
An example:
In [1]: m = Matrix([[1, 1], [1, x]])
In [2]: m.rank()
Out[2]: 2
In [3]: m.subs(x, 1).rank()
Out[3]: 1
There should be Rank expression, like Determinant.
See sympy/sympy#7146 and sympy/sympy#11554
PS: Mathematica has same issue:
In[4]:= MatrixRank[{{1, 1}, {1, x}}]
Out[4]= 2
In[5]:= MatrixRank[{{1, 1}, {1, 1}}]
Out[5]= 1
And example:
In [1]: sin(x+O(x**2))
Out[1]:
⎛ ⎛ 2⎞⎞
sin⎝x + O⎝x ⎠⎠
In [2]: sin(x+O(x**2)) - sin(x+O(x**2))
Out[2]: 0
In [3]: sin(O(x))/sin(O(x))
Out[3]: 1
See also this thread and sympy/sympy#6737.
Mathematica does same stupid things
In[2]:= Sin[O[x]]
Out[2]=
O[x]
In[3]:= O[x]-O[x]
Out[3]=
O[x]
In[4]:= Hold[Sin[O[x]]]
Out[4]=
Hold[Sin[O[x]]]
In[5]:= Hold[Sin[O[x]]]-Hold[Sin[O[x]]]
Out[5]=
0
Make old and new systems consistent, see e.g. sympy/sympy#8134. All old assumptions should be in the new system.
For old assumptions:
_eval_is_*
): 1) be correct 2) be covered with tests. #316
is_real = True
. #334(meta issue)
For example, this is a regression problem (see test_contains from test_sets.py):
In [1]: rad1 = Pow(Pow(2, Rational(1, 3)) - 1, Rational(1, 3))
In [2]: rad2 = (Pow(Rational(1, 9), Rational(1, 3)) -
...: Pow(Rational(2, 9), Rational(1, 3)) +
...: Pow(Rational(4, 9), Rational(1, 3)))
In [3]: e = rad1 - rad2
In [4]: e.args
Out[4]:
3 ___ 3 ___ 2/3 3 ___ ____________
-\/ 3 \/ 6 -2 *\/ 3 3 / 3 ___
(-------, -----, ------------, \/ -1 + \/ 2 )
3 3 3
In [5]: a,b,c,d = e.args
In [6]: %time minimal_polynomial(Add(d, a, b, c, evaluate=False))
CPU times: user 532 ms, sys: 4 ms, total: 536 ms
Wall time: 681 ms
Out[6]: x
In [7]: %time minimal_polynomial(e)
CPU times: user 54.7 s, sys: 508 ms, total: 55.2 s
Wall time: 1min 17s
Out[7]: x
This was broken due to different ordering in Add after 73027a6. Meanwhile we should
replace test for issue 8209 with a more simple version.
sympify()
stuff at all?) #120(meta issue)
see examples in #78
Mathematica:
In[1]:= Sum[n/((n + 2)*(n + 4)*(n + 8)),{n, 1, Infinity}]
Out[1]=
4
--
35
See
https://groups.google.com/forum/?fromgroups=#!topic/sympy/ZI_D-eG1UfE
(meta issue)
In [1]: limit(sign(ln(x)), x, 1, '+')
Out[1]: 1
In [2]: limit(sign(ln(x)), x, 1, '-') # should be -1
Out[2]: 0
In [3]: limit(sign(sin(x)), x, 0, '+') # should be 1
Out[3]: 0
In [4]: limit(sign(sin(x)), x, 0, '-') # should be -1
Out[4]: 0
In [5]: limit(sign(tan(x)), x, 0, '+') # should be 1
Out[5]: 0
In [6]: limit(sign(tan(x)), x, 0, '-') # should be -1
Out[6]: 0
In [7]: limit(sign(cos(x)), x, pi/2, '+') # should be -1
Out[7]: 0
In [8]: limit(sign(cos(x)), x, pi/2, '-') # should be 1
Out[8]: 0
https://groups.google.com/d/msg/sympy/tY1mPLwGJnc/i6mN90tucFAJ
In [1]: len(FiniteSet(x, y))
Out[1]: 2
In [2]: for i in FiniteSet(x, y):
...: print(i)
...:
x
y
In [3]: len(FiniteSet(x, y).subs({x: 1, y: 1}))
Out[3]: 1
Perhaps, we should iterate over FiniteSet only if it contains non-Symbols, see #112.
Or we can ensure that for any x
and y
in set: (x-y).is_zero is not True
and keep this also in .subs()
(e.g. above In[3]
will raise an error, ValueError?).
See this thread.
Should be -eta(s) for z=-1, c.f. http://mathworld.wolfram.com/Polylogarithm.html
See also
https://en.wikipedia.org/wiki/Polylogarithm
and
http://en.wikipedia.org/wiki/Dirichlet_eta_function (mentioned in the eta docstring!)
https://s3.amazonaws.com/archive.travis-ci.org/jobs/131382809/log.txt
> assert minimize(sign(x), x) == (-1, {x: 0})
E assert (Integer(-1),...ol('x'): -oo}) == (-1, {Symbol('x'): 0})
E At index 1 diff: {Symbol('x'): -oo} != {Symbol('x'): 0}
See sympy/sympy#9558
See
https://groups.google.com/forum/?fromgroups=#!topic/sympy/-81JDOQKHWQ
In [2]: R, x, y, z = ring("x,y,z", RR)
In [3]: a = x*y + x*z
In [4]: b = 0.1*y + 0.1*z
In [5]: r = a + b
In [6]: R.dmp_factor_list(r)
Out[6]: (1.0, [(0.1*y + 0.1*z, 1), (x + 0.1, 1)])
It seems, travis-ci has only old mpc library right now:
src/gmpy.h:264:6: error: #error gmpy2 requires MPC 1.0.0 or later
https://s3.amazonaws.com/archive.travis-ci.org/jobs/77362101/log.txt
In [12]: cos(x**6).nseries(x, n=15)
Out[12]:
⎛ 15⎞
1 + O⎝x ⎠
In [13]: cos(x**6).nseries(x, n=16)
Out[13]:
12
x ⎛ 16⎞
1 - ─── + O⎝x ⎠
2
See sympy/sympy#10503.
Perhaps, the reason - is in the Augean stables of code in Function._eval_nseries.
See https://github.com/spatialaudio/nbsphinx for sphinx.
Or something better? We also need ability to test output cells to have correct, expected output (just like we did this with doctest's).
Probably we should keep Floats for input/output only. For example, multiple precision
math with Floats currently doesn't have any sense. Too easy get a wrong answer:
In [1]: n = sin(1)**2 + cos(1)**2 - 1
In [2]: f = n.evalf()
In [3]: f
Out[3]: -0.e-124
In [4]: f._prec
Out[4]: 1
In [5]: f2 = f.evalf()
In [6]: f2
Out[6]: -3.78182804184504e-124
In [7]: f2._prec
Out[7]: 53
@smichr, I think you are most knowledgeable person for evalf module. Do you think it's an issue for Sympy?!
Traceback:
___________________________ test_gruntz_eval_special ___________________________
@pytest.mark.slow
def test_gruntz_eval_special():
# Gruntz, p. 126
assert gruntz(exp(x)*(sin(1/x + exp(-x)) - sin(1/x + exp(-x**2))), x) == 1
assert gruntz((erf(x - exp(-exp(x))) - erf(x)) * exp(exp(x)) * exp(x**2),
x) == -2/sqrt(pi)
assert gruntz(exp(exp(x)) * (exp(sin(1/x + exp(-exp(x)))) - exp(sin(1/x))),
x) == 1
assert gruntz(exp(x)*(gamma(x + exp(-x)) - gamma(x)), x) == oo
assert gruntz(exp(exp(digamma(digamma(x))))/x, x) == exp(-Rational(1, 2))
assert gruntz(exp(exp(digamma(log(x))))/x, x) == exp(-Rational(1, 2))
assert gruntz(digamma(digamma(digamma(x))), x) == oo
assert gruntz(loggamma(loggamma(x)), x) == oo
assert gruntz(((gamma(x + 1/gamma(x)) - gamma(x))/log(x) - cos(1/x))
* x*log(x), x) == -Rational(1, 2)
assert gruntz(x * (gamma(x - 1/gamma(x)) - gamma(x) + log(x)), x) \
== Rational(1, 2)
assert gruntz((gamma(x + 1/gamma(x)) - gamma(x)) / log(x), x) == 1
assert gruntz(gamma(x + 1)/sqrt(2*pi)
- exp(-x)*(x**(x + Rational(1, 2)) + x**(x - Rational(1, 2))/12), x) == oo
> assert gruntz(exp(exp(exp(digamma(digamma(digamma(x))))))/x, x) == 0
sympy/series/tests/test_gruntz.py:107:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
v = func(*args, **kwargs)
sympy/series/gruntz.py:231: in limitinf
c0, e0 = mrv_leadterm(e, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
v = func(*args, **kwargs)
sympy/series/gruntz.py:281: in mrv_leadterm
e, logw = rewrite(e, x, w)
sympy/series/gruntz.py:321: in rewrite
Omega = mrv(e, x)
sympy/series/gruntz.py:139: in mrv
return mrv_max(mrv(a, x), mrv(b, x), x)
sympy/series/gruntz.py:144: in mrv
elif any(a.is_infinite for a in Mul.make_args(limitinf(e.exp, x))):
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
v = func(*args, **kwargs)
sympy/series/gruntz.py:240: in limitinf
return limitinf(c0, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
v = func(*args, **kwargs)
sympy/series/gruntz.py:231: in limitinf
c0, e0 = mrv_leadterm(e, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
v = func(*args, **kwargs)
sympy/series/gruntz.py:283: in mrv_leadterm
lt = e.compute_leading_term(w, logx=logw)
sympy/core/expr.py:2811: in compute_leading_term
is_zero = t.equals(0)
sympy/core/expr.py:616: in equals
constant = diff.is_constant(simplify=False, failing_number=True)
sympy/core/expr.py:545: in is_constant
if b is not None and b is not S.NaN and b.equals(a) is False:
sympy/core/expr.py:604: in equals
diff = factor_terms((self - other).simplify(), radical=True)
sympy/core/expr.py:3033: in simplify
return simplify(self, ratio, measure)
sympy/simplify/simplify.py:607: in simplify
_e = cancel(expr)
sympy/polys/polytools.py:6201: in cancel
c, P, Q = F.cancel(G)
sympy/polys/polytools.py:3428: in cancel
result = F.cancel(G, include=include)
sympy/polys/polyclasses.py:681: in cancel
cF, cG, F, G = dmp_cancel(F, G, lev, dom, include=False)
sympy/polys/euclidtools.py:1844: in dmp_cancel
_, p, q = dmp_inner_gcd(f, g, u, K)
sympy/polys/euclidtools.py:1561: in dmp_inner_gcd
h, cff, cfg = _dmp_inner_gcd(f, g, u, K)
sympy/polys/euclidtools.py:1509: in _dmp_inner_gcd
f = dmp_convert(f, u, K, exact)
sympy/polys/densebasic.py:516: in dmp_convert
return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
sympy/polys/densebasic.py:516: in <listcomp>
return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
sympy/polys/densebasic.py:510: in dmp_convert
return dup_convert(f, K0, K1)
sympy/polys/densebasic.py:489: in dup_convert
return dup_strip([ K1.convert(c, K0) for c in f ])
sympy/polys/densebasic.py:489: in <listcomp>
return dup_strip([ K1.convert(c, K0) for c in f ])
sympy/polys/domains/domain.py:93: in convert
return self.convert_from(element, base)
sympy/polys/domains/domain.py:83: in convert_from
result = _convert(element, base)
sympy/polys/domains/pythonrationalfield.py:61: in from_RealField
p, q = K0.to_rational(a)
sympy/polys/domains/realfield.py:98: in to_rational
return self._context.to_rational(element, limit)
sympy/polys/domains/mpelements.py:120: in to_rational
p, q = to_rational(s._mpf_)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = (0, 7522769485253779, 268851419954916787, 53)
def to_rational(s):
"""Convert a raw mpf to a rational number. Return integers (p, q)
such that s = p/q exactly."""
sign, man, exp, bc = s
if sign:
man = -man
if bc == -1:
raise ValueError("cannot convert %s to a rational number" % man)
if exp >= 0:
return man * (1<<exp), 1
MemoryError
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/mpmath/libmp/libmpf.py:479: MemoryError
Perhaps, this is an instance of #287.
In [26]: m = Matrix([[-E**(I*k)*I/(4*k) + 1/2 + E**(-I*k)*I/(4*k), E**(I*k)*I/(4*k) + 1/2 - E**(-I*k)*I/(4*k), E**(I*k)/4 + 1/2 + E**(-I*k)/4, -E**(I*k)/4 - 1/2 - E**(-I*k)/4],[ E**(I*k)*I/(4*k) + 1/2 - E**(-I*k)*I/(4*k), -E**(I*k)*I/(4*k) + 1/2 + E**(-I*k)*I/(4*k), -E**(I*k)/4 - 1/2 - E**(-I*k)/4, E**(I*k)/4 + 1/2 + E**(-I*k)/4],[ E**(I*k)/4 + 1/2 + E**(-I*k)/4, -E**(I*k)/4 - 1/2 - E**(-I*k)/4, E**(I*k)*I*k/4 - E**(-I*k)*I*k/4, -E**(I*k)*I*k/4 + E**(-I*k)*I*k/4],[ -E**(I*k)/4 - 1/2 - E**(-I*k)/4, E**(I*k)/4 + 1/2 + E**(-I*k)/4, -E**(I*k)*I*k/4 + E**(-I*k)*I*k/4, E**(I*k)*I*k/4 - E**(-I*k)*I*k/4]]); m
Out[26]:
⎡ ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⎤
⎢ ℯ ⋅ⅈ 1 ℯ ⋅ⅈ ℯ ⋅ⅈ 1 ℯ ⋅ⅈ ℯ 1 ℯ ℯ 1 ℯ ⎥
⎢- ────── + ─ + ─────── ────── + ─ - ─────── ──── + ─ + ───── - ──── - ─ - ───── ⎥
⎢ 4⋅k 2 4⋅k 4⋅k 2 4⋅k 4 2 4 4 2 4 ⎥
⎢ ⎥
⎢ ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⎥
⎢ ℯ ⋅ⅈ 1 ℯ ⋅ⅈ ℯ ⋅ⅈ 1 ℯ ⋅ⅈ ℯ 1 ℯ ℯ 1 ℯ ⎥
⎢ ────── + ─ - ─────── - ────── + ─ + ─────── - ──── - ─ - ───── ──── + ─ + ───── ⎥
⎢ 4⋅k 2 4⋅k 4⋅k 2 4⋅k 4 2 4 4 2 4 ⎥
⎢ ⎥
⎢ ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⎥
⎢ ℯ 1 ℯ ℯ 1 ℯ ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k⎥
⎢ ──── + ─ + ───── - ──── - ─ - ───── ──────── - ───────── - ──────── + ─────────⎥
⎢ 4 2 4 4 2 4 4 4 4 4 ⎥
⎢ ⎥
⎢ ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⅈ⋅k -ⅈ⋅k ⎥
⎢ ℯ 1 ℯ ℯ 1 ℯ ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k ℯ ⋅ⅈ⋅k ⎥
⎢ - ──── - ─ - ───── ──── + ─ + ───── - ──────── + ───────── ──────── - ───────── ⎥
⎣ 4 2 4 4 2 4 4 4 4 4 ⎦
In [27]: m.det()
Out[27]: 0
In [28]: m.rank()
Out[28]: 4
In [29]: m.cols
Out[29]: 4
In [30]: m.rows
Out[30]: 4
See SymPy issues:
sympy/sympy#9480
sympy/sympy#11238
and PR's:
sympy/sympy#10280
sympy/sympy#10650
This should finally stop bugs like sympy/sympy#11131 and reduce time for ode tests. E.g.:
In [1]: %time dsolve(diff(f(x), x, x) - 8*cos(x) + sec(x)**2)
CPU times: user 49min 10s, sys: 58.5 s, total: 50min 8s
Wall time: 1h 18min
Out[1]:
⌠
⎛ sin(x)⎞ ⌠ ⎮ 2
f(x) = C₁ + x⋅⎜C₂ + 8⋅sin(x) - ──────⎟ - ⎮ 8⋅x⋅cos(x) dx - ⎮ -x⋅sec (x) dx
⎝ cos(x)⎠ ⌡ ⌡
Perhaps, default hint should be made an alias of all_Integral or something like that.
gruntz is correct here:
In [2]: gruntz((x+exp(x))/(x-1), x, -oo)
Out[2]: 1
https://groups.google.com/forum/?fromgroups=#!topic/sympy/wV0FsQ86ooE
In [6]: solveset(sinh(x))
Out[6]: {0}
solve is better in this case: (though it doesn't returns all solutions)
In [7]: solve(sinh(x))
Out[7]: [0, I*pi]
self
naming, #214(meta issue)
This is underlying issue for #236
In [1]: hyper((2, 3, 5, 9, 1), (1, 4, 6, 10), 1)
Out[1]:
┌─ ⎛2, 3, 5, 9, 1 │ ⎞
├─ ⎜ │ 1⎟
5╵ 4 ⎝ 1, 4, 6, 10 │ ⎠
In [2]: hyperexpand(_)
Out[2]:
12⋅(-526 + 484⋅expₚₒₗₐᵣ(0)) 21⋅(-73 + 85⋅expₚₒₗₐᵣ(0))
─────────────────────────── + ──────────────────────────
5⋅(-672 + 672⋅expₚₒₗₐᵣ(0)) 5⋅(-336 + 336⋅expₚₒₗₐᵣ(0))
In [3]: _1.n()
Out[3]: 15.4285714285714
In [4]: _2.n()
Out[4]: 0.e+135
Does work if we use limit on hyperexpand output:
In [1]: hyperexpand(hyper((2, 3, 5, 9, 1), (1, 4, 6, 10), z))
Out[1]:
6 5 4 3
45⋅z 105⋅z 117⋅z 45⋅z 2 45⋅z
───── - ────── - ────── + ───── + 15⋅z + ──── + 45 ⎛ 6 4 ⎞
7 4 2 4 2 ⎝45⋅z - 135⋅z + 90⎠⋅log(-z + 1)
─────────────────────────────────────────────────── + ─────────────────────────────────
8 9
z 2⋅z
In [2]: _.limit(z, 1)
Out[2]: 108/7
Right now, sometimes it is a list of tuple's:
In [2]: solve([x*y - 7, x + y - 6], [x, y])
Out[2]:
⎡⎛ ___ ___ ⎞ ⎛ ___ ___ ⎞⎤
⎣⎝- ╲╱ 2 + 3, ╲╱ 2 + 3⎠, ⎝╲╱ 2 + 3, - ╲╱ 2 + 3⎠⎦
and sometimes a list of dict's:
In [3]: solve([x - y + 2, x + y - 3], [x, y])
Out[3]: {x: 1/2, y: 5/2}
The later can be enforced with dict
keyword argument:
In [4]: solve([x*y - 7, x + y - 6], [x, y], dict=True)
Out[4]:
⎡⎧ ___ ___ ⎫ ⎧ ___ ___ ⎫⎤
⎢⎨x: - ╲╱ 2 + 3, y: ╲╱ 2 + 3⎬, ⎨x: ╲╱ 2 + 3, y: - ╲╱ 2 + 3⎬⎥
⎣⎩ ⎭ ⎩ ⎭⎦
Probably, we should pick "dict"-output as a default. See also old discussion.
for example:
In [3]: ((-1)**(n/2)).subs(n, 1)
Out[3]: ⅈ
In [4]: ((-1)**(n/2)).subs(n, 3)
Out[4]: -ⅈ
see also sympy/sympy#10195
Mathematica:
In[1]:= Limit[(Log[x] - 1)^(-x^(1/2) + 1),x->E]
Out[1]=
Infinity
We have 0 instead.
https://groups.google.com/forum/?fromgroups=#!topic/sympy/wV0FsQ86ooE
see scipy, numpy or ipython
see also SymPy's instructions
an example sympy/sympy#8942
As it stated by the python docs about returned value of __repr__()
, "If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment)."
It seems, that SymPy's printing system violates this maxima. "More accurate rule" - is that repr()
output for SymPy's objects is something that can be "a suitable input for sympify()
". See this. An example is Rational's printing:
In [3]: repr(Rational(1, 2))
Out[3]: '1/2'
I believe, we should prefer python's conventions.
References:
#116 (comment)
https://groups.google.com/forum/#!topic/sympy/xEgWEcg6Puk
In [2]: n = Symbol('n', integer=True)
In [3]: x = Symbol('x')
In [4]: exp(3*x).subs({exp(x): x})
Out[4]: x**3
In [5]: exp(n*x).subs({exp(x): x})
Out[5]: exp(n*x)
Is this thing is useful at all, except for toys (i.e. sympylive)?
i.e. sympy/sympy#10533
write who did what. Good examples: numpy/THANKS.txt or scipy/THANKS.txt, bad example: sympy/AUTHORS (no emails,after all!). Perhaps, move this file to the core and rename THANKS.rst or something.
AUTHORS was replaced with aboutus.rst in #87
(meta issue)
Right now it's 0, should be -1/6.
See https://groups.google.com/forum/?fromgroups=#!topic/sympy/pfYJI-lxkYE
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.