Bug#826457: python-sympy: please implement a way to force a derivative to be partial or total
Francesco Poli (wintermute)
invernomuto at paranoici.org
Sun Jun 5 17:17:25 UTC 2016
Package: python-sympy
Version: 1.0-1
Severity: wishlist
Tags: upstream
Hello!
I would love to have a way to force Sympy to consider a derivative
as partial or total, depending on my wishes.
This applies to how the derivative is printed (especially with the
LaTeX printer).
Let me explain with an example:
$ isympy
IPython console for SymPy 1.0 (Python 2.7.11-64-bit) (ground types: gmpy)
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
>>> init_printing()
Documentation can be found at http://docs.sympy.org/1.0/
In [1]: Derivative(z,x)
Out[1]:
d
──(z)
dx
In [2]: print(latex(Derivative(z,x)))
\frac{d}{d x} z
In [3]: Derivative(f(x),x)
Out[3]:
d
──(f(x))
dx
In [4]: print(latex(Derivative(f(x),x)))
\frac{d}{d x} f{\left (x \right )}
In [5]: Derivative(f(x,y),x)
Out[5]:
∂
──(f(x, y))
∂x
In [6]: print(latex(Derivative(f(x,y),x)))
\frac{\partial}{\partial x} f{\left (x,y \right )}
In [7]: exit
Exiting ...
As you can see, the derivatives of z and of f(x) are printed with
the total derivative notation (they are treated as derivatives of
single-variable functions); on the other hand, the derivative of
f(x,y) is printed with the partial derivative notation (derivative
of a multiple-variable function with respect to one of the variables).
This is perfectly correct.
Nonetheless, I would like to be able to force Sympy to print
the first two derivatives with the partial derivative notation
and/or the last one with the total derivative notation.
It would be great, if some optional argument could be passed to
the Derivative class constructor, in order to do so. Something like
Derivative(z,x,type='partial')
Derivative(f(x),x,type='auto') equivalent to Derivative(f(x),x)
Derivative(f(x,y),x,type='total')
where 'partial' would mean "print unconditionally as partial
derivative", 'total' would mean "print unconditionally as total
derivative", and 'auto' would get the default behavior (that is
to say, "figure it out automatically").
I hope this feature may be implemented easily.
Could you please forward my report upstream?
Thanks for your time.
Bye.
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (800, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.5.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python-sympy depends on:
ii isympy 1.0-1
ii python-mpmath 0.19-3
pn python:any <none>
Versions of packages python-sympy recommends:
ii dvipng 1.14-2+b2
ii ipython 2.4.1-1
ii python [python-ctypes] 2.7.11-1
ii python-gmpy 1.17-1
ii python-imaging 3.2.0-2
ii python-numpy 1:1.11.1~rc1-1
ii python-pyglet 1.1.4.dfsg-3
ii python-sympy-doc 1.0-1
ii texlive-fonts-extra 2016.20160520-1
python-sympy suggests no packages.
-- no debconf information
More information about the debian-science-maintainers
mailing list