# Ticket #8947: trac-8947-doctest-fix.patch

File trac-8947-doctest-fix.patch, 4.5 KB (added by jason, 3 years ago)

apply on top of previous patches

• ## doc/en/reference/modules.rst

# HG changeset patch
# User Jason Grout <jason-sage@creativetrax.com>
# Date 1275430013 18000
# Node ID 20f4614907e7fcf29411f36644811c91958931ac
# Parent  328ce713fa3784a1249825828f70aaec8cde3ee5
#8947: Fix doctest issues

diff -r 328ce713fa37 -r 20f4614907e7 doc/en/reference/modules.rst
 a sage/modules/complex_double_vector sage/modules/real_double_vector sage/modules/vector_callable_symbolic_dense sage/modules/free_module_homspace sage/modules/free_module_morphism
• ## sage/calculus/calculus.py

diff -r 328ce713fa37 -r 20f4614907e7 sage/calculus/calculus.py
 a sage: f(x,y)=x^2*y+y^2+y sage: f.diff() # gradient ((x, y) |--> 2*x*y, (x, y) |--> x^2 + 2*y + 1) (x, y) |--> (2*x*y, x^2 + 2*y + 1) sage: solve(list(f.diff()),[x,y]) [[x == -I, y == 0], [x == I, y == 0], [x == 0, y == (-1/2)]] sage: H=f.diff(2); H  # Hessian matrix sage: T(r,theta)=[r*cos(theta),r*sin(theta)] sage: T ((r, theta) |--> r*cos(theta), (r, theta) |--> r*sin(theta)) (r, theta) |--> (r*cos(theta), r*sin(theta)) sage: T.diff() # Jacobian matrix [   (r, theta) |--> cos(theta) (r, theta) |--> -r*sin(theta)] [   (r, theta) |--> sin(theta)  (r, theta) |--> r*cos(theta)]
• ## sage/modules/free_module_element.pyx

diff -r 328ce713fa37 -r 20f4614907e7 sage/modules/free_module_element.pyx
 a sage: T(r,theta)=[r*cos(theta),r*sin(theta)] sage: T ((r, theta) |--> r*cos(theta), (r, theta) |--> r*sin(theta)) (r, theta) |--> (r*cos(theta), r*sin(theta)) sage: T.diff() # matrix derivative [   (r, theta) |--> cos(theta) (r, theta) |--> -r*sin(theta)] [   (r, theta) |--> sin(theta)  (r, theta) |--> r*cos(theta)] sage: x,y=var('x,y') sage: v=vector([x,y,x*sin(y)]) sage: w=v.function([x,y]); w ((x, y) |--> x, (x, y) |--> y, (x, y) |--> x*sin(y)) (x, y) |--> (x, y, x*sin(y)) sage: w.base_ring() Callable function ring with arguments (x, y) sage: w(1,2) sage: x,y=var('x,y') sage: v=vector([x,y,x*sin(y)]) sage: w=v.function([x]); w (x |--> x, x |--> y, x |--> x*sin(y)) x |--> (x, y, x*sin(y)) sage: w.base_ring() Callable function ring with arguments (x,) sage: w(4)
• ## sage/modules/vector_callable_symbolic_dense.py

diff -r 328ce713fa37 -r 20f4614907e7 sage/modules/vector_callable_symbolic_dense.py
 a sage: r(t) = (cos(t), sin(t)) sage: r t |--> (cos(t), sin(t)) sage: latex(r) t \ {\mapsto}\ \left(\cos\left(t\right),\sin\left(t\right)\right) sage: latex(r) t \ {\mapsto}\ \left(\cos\left(t\right),\sin\left(t\right)\right) """ from sage.misc.latex import latex ring=self.base_ring()
• ## sage/symbolic/expression.pyx

diff -r 328ce713fa37 -r 20f4614907e7 sage/symbolic/expression.pyx
 a sage: f(x,y)=x^2+y sage: f.diff() # gradient ((x, y) |--> 2*x, (x, y) |--> 1) (x, y) |--> (2*x, 1) TESTS: (2*x, 2*y) sage: g(x,y) = x^2+y^2 sage: g.gradient() ((x, y) |--> 2*x, (x, y) |--> 2*y) (x, y) |--> (2*x, 2*y) sage: n = var('n') sage: f(x,y) = x^n+y^n sage: f.gradient() ((x, y) |--> n*x^(n - 1), (x, y) |--> n*y^(n - 1)) (x, y) |--> (n*x^(n - 1), n*y^(n - 1)) sage: f.gradient([y,x]) ((x, y) |--> n*y^(n - 1), (x, y) |--> n*x^(n - 1)) (x, y) |--> (n*y^(n - 1), n*x^(n - 1)) """ from sage.modules.free_module_element import vector if variables is None: