# 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
|
b
|
|
| 12 | 12 | |
| 13 | 13 | sage/modules/complex_double_vector |
| 14 | 14 | sage/modules/real_double_vector |
| 15 | | |
| | 15 | sage/modules/vector_callable_symbolic_dense |
| | 16 | |
| 16 | 17 | sage/modules/free_module_homspace |
| 17 | 18 | sage/modules/free_module_morphism |
| 18 | 19 | |
diff -r 328ce713fa37 -r 20f4614907e7 sage/calculus/calculus.py
|
a
|
b
|
|
| 75 | 75 | |
| 76 | 76 | sage: f(x,y)=x^2*y+y^2+y |
| 77 | 77 | sage: f.diff() # gradient |
| 78 | | ((x, y) |--> 2*x*y, (x, y) |--> x^2 + 2*y + 1) |
| | 78 | (x, y) |--> (2*x*y, x^2 + 2*y + 1) |
| 79 | 79 | sage: solve(list(f.diff()),[x,y]) |
| 80 | 80 | [[x == -I, y == 0], [x == I, y == 0], [x == 0, y == (-1/2)]] |
| 81 | 81 | sage: H=f.diff(2); H # Hessian matrix |
| … |
… |
|
| 91 | 91 | |
| 92 | 92 | sage: T(r,theta)=[r*cos(theta),r*sin(theta)] |
| 93 | 93 | sage: T |
| 94 | | ((r, theta) |--> r*cos(theta), (r, theta) |--> r*sin(theta)) |
| | 94 | (r, theta) |--> (r*cos(theta), r*sin(theta)) |
| 95 | 95 | sage: T.diff() # Jacobian matrix |
| 96 | 96 | [ (r, theta) |--> cos(theta) (r, theta) |--> -r*sin(theta)] |
| 97 | 97 | [ (r, theta) |--> sin(theta) (r, theta) |--> r*cos(theta)] |
diff -r 328ce713fa37 -r 20f4614907e7 sage/modules/free_module_element.pyx
|
a
|
b
|
|
| 1930 | 1930 | |
| 1931 | 1931 | sage: T(r,theta)=[r*cos(theta),r*sin(theta)] |
| 1932 | 1932 | sage: T |
| 1933 | | ((r, theta) |--> r*cos(theta), (r, theta) |--> r*sin(theta)) |
| | 1933 | (r, theta) |--> (r*cos(theta), r*sin(theta)) |
| 1934 | 1934 | sage: T.diff() # matrix derivative |
| 1935 | 1935 | [ (r, theta) |--> cos(theta) (r, theta) |--> -r*sin(theta)] |
| 1936 | 1936 | [ (r, theta) |--> sin(theta) (r, theta) |--> r*cos(theta)] |
| … |
… |
|
| 2498 | 2498 | sage: x,y=var('x,y') |
| 2499 | 2499 | sage: v=vector([x,y,x*sin(y)]) |
| 2500 | 2500 | sage: w=v.function([x,y]); w |
| 2501 | | ((x, y) |--> x, (x, y) |--> y, (x, y) |--> x*sin(y)) |
| | 2501 | (x, y) |--> (x, y, x*sin(y)) |
| 2502 | 2502 | sage: w.base_ring() |
| 2503 | 2503 | Callable function ring with arguments (x, y) |
| 2504 | 2504 | sage: w(1,2) |
| … |
… |
|
| 2513 | 2513 | sage: x,y=var('x,y') |
| 2514 | 2514 | sage: v=vector([x,y,x*sin(y)]) |
| 2515 | 2515 | sage: w=v.function([x]); w |
| 2516 | | (x |--> x, x |--> y, x |--> x*sin(y)) |
| | 2516 | x |--> (x, y, x*sin(y)) |
| 2517 | 2517 | sage: w.base_ring() |
| 2518 | 2518 | Callable function ring with arguments (x,) |
| 2519 | 2519 | sage: w(4) |
diff -r 328ce713fa37 -r 20f4614907e7 sage/modules/vector_callable_symbolic_dense.py
|
a
|
b
|
|
| 92 | 92 | sage: r(t) = (cos(t), sin(t)) |
| 93 | 93 | sage: r |
| 94 | 94 | t |--> (cos(t), sin(t)) |
| 95 | | sage: latex(r) |
| 96 | | t \ {\mapsto}\ \left(\cos\left(t\right),\sin\left(t\right)\right) |
| | 95 | sage: latex(r) |
| | 96 | t \ {\mapsto}\ \left(\cos\left(t\right),\sin\left(t\right)\right) |
| 97 | 97 | """ |
| 98 | 98 | from sage.misc.latex import latex |
| 99 | 99 | ring=self.base_ring() |
diff -r 328ce713fa37 -r 20f4614907e7 sage/symbolic/expression.pyx
|
a
|
b
|
|
| 2499 | 2499 | |
| 2500 | 2500 | sage: f(x,y)=x^2+y |
| 2501 | 2501 | sage: f.diff() # gradient |
| 2502 | | ((x, y) |--> 2*x, (x, y) |--> 1) |
| | 2502 | (x, y) |--> (2*x, 1) |
| 2503 | 2503 | |
| 2504 | 2504 | TESTS: |
| 2505 | 2505 | |
| … |
… |
|
| 2562 | 2562 | (2*x, 2*y) |
| 2563 | 2563 | sage: g(x,y) = x^2+y^2 |
| 2564 | 2564 | sage: g.gradient() |
| 2565 | | ((x, y) |--> 2*x, (x, y) |--> 2*y) |
| | 2565 | (x, y) |--> (2*x, 2*y) |
| 2566 | 2566 | sage: n = var('n') |
| 2567 | 2567 | sage: f(x,y) = x^n+y^n |
| 2568 | 2568 | sage: f.gradient() |
| 2569 | | ((x, y) |--> n*x^(n - 1), (x, y) |--> n*y^(n - 1)) |
| | 2569 | (x, y) |--> (n*x^(n - 1), n*y^(n - 1)) |
| 2570 | 2570 | sage: f.gradient([y,x]) |
| 2571 | | ((x, y) |--> n*y^(n - 1), (x, y) |--> n*x^(n - 1)) |
| | 2571 | (x, y) |--> (n*y^(n - 1), n*x^(n - 1)) |
| 2572 | 2572 | """ |
| 2573 | 2573 | from sage.modules.free_module_element import vector |
| 2574 | 2574 | if variables is None: |