Vectors over callable symbolic rings - Modules

Skip to content
Back to top
View this page
Edit this page

# Vectors over callable symbolic rings

AUTHOR:

- Jason Grout (2010)

EXAMPLES:

Sage

    sage: f(r, theta, z) = (r*cos(theta), r*sin(theta), z)
    sage: f.parent()
    Vector space of dimension 3 over Callable function ring with arguments (r, theta, z)
    sage: f
    (r, theta, z) |--> (r*cos(theta), r*sin(theta), z)
    sage: f[0]
    (r, theta, z) |--> r*cos(theta)
    sage: f+f
    (r, theta, z) |--> (2*r*cos(theta), 2*r*sin(theta), 2*z)
    sage: 3*f
    (r, theta, z) |--> (3*r*cos(theta), 3*r*sin(theta), 3*z)
    sage: f*f # dot product
    (r, theta, z) |--> r^2*cos(theta)^2 + r^2*sin(theta)^2 + z^2
    sage: f.diff()(0,1,2) # the matrix derivative
    [cos(1)      0      0]
    [sin(1)      0      0]
    [     0      0      1]

Python

    >>> from sage.all import *
    >>> __tmp__=var("r,theta,z"); f = symbolic_expression((r*cos(theta), r*sin(theta), z)).function(r,theta,z)
    >>> f.parent()
    Vector space of dimension 3 over Callable function ring with arguments (r, theta, z)
    >>> f
    (r, theta, z) |--> (r*cos(theta), r*sin(theta), z)
    >>> f[Integer(0)]
    (r, theta, z) |--> r*cos(theta)
    >>> f+f
    (r, theta, z) |--> (2*r*cos(theta), 2*r*sin(theta), 2*z)
    >>> Integer(3)*f
    (r, theta, z) |--> (3*r*cos(theta), 3*r*sin(theta), 3*z)
    >>> f*f # dot product
    (r, theta, z) |--> r^2*cos(theta)^2 + r^2*sin(theta)^2 + z^2
    >>> f.diff()(Integer(0),Integer(1),Integer(2)) # the matrix derivative
    [cos(1)      0      0]
    [sin(1)      0      0]
    [     0      0      1]

class sage.modules.vector_callable_symbolic_dense.Vector_callable_symbolic_dense

  Bases: `FreeModuleElement_generic_dense`