Ask Your Question

Revision history [back]

One approach is to use symbolic expressions instead of functions, e.g.

var('t')
r = vector([1, t])

An apparent downside is that this blurs the line between variables and symbolic constants which might also appear:

var('t,c')
r = vector([1, c*t])

However, many operations which are really operations on functions are implemented in Sage as operations on symbolic expressions, where the dependent variables are passed alongside the symbolic expression.

For example, to calculate the Jacobian:

sage: jacobian(r, [t])
[0]
[c]

One approach is to use symbolic expressions instead of functions, e.g.

var('t')
r = vector([1, t])

The addition example becomes slightly verbose (but certainty unambiguous):

r(t=1) + r(t=2)

An apparent downside is that this blurs the line between variables and symbolic constants which might also appear:

var('t,c')
r = vector([1, c*t])

However, many operations which are really operations on functions are implemented in Sage as operations on symbolic expressions, where the dependent variables are passed alongside the symbolic expression.

For example, to calculate the Jacobian:

sage: jacobian(r, [t])
[0]
[c]

One approach is to use symbolic expressions instead of functions, e.g.

var('t')
r = vector([1, t])

The addition example becomes slightly verbose (but certainty unambiguous):

r(t=1) + r(t=2)

An apparent downside is that this blurs the line between variables and symbolic constants which might also appear:

var('t,c')
r s = vector([1, c*t])

However, many operations which are really operations on functions are implemented in Sage as operations on symbolic expressions, where the dependent variables are passed alongside the symbolic expression.

For example, to calculate the Jacobian:

sage: jacobian(r, jacobian(s, [t])
[0]
[c]

One approach is to use symbolic expressions instead of functions, e.g.

var('t')
r = vector([1, t])

The addition example becomes slightly verbose (but certainty certainly unambiguous):

r(t=1) + r(t=2)

An apparent downside is that this blurs the line between variables and symbolic constants which might also appear:

var('t,c')
s = vector([1, c*t])

However, many operations which are really operations on functions are implemented in Sage as operations on symbolic expressions, where the dependent variables are passed alongside the symbolic expression.

For example, to calculate the Jacobian:

sage: jacobian(s, [t])
[0]
[c]