# How to create a vector function (mapping)?

for example,

## x(t) = vector([1,1])*exp(-t)

TypeError Traceback (most recent call last)

## x = vector([1,1])*exp(-t)

It works!

However, x is not a mapping but a symbolic expression.

edit retag close merge delete

Sort by » oldest newest most voted

It depends on what do you consider as a "mapping". The symbolic expression defined by

sage: var('t')
t
sage: x = vector([1,1])*exp(-t)


represents a (symbolic) function, which you can evaluate:

sage: x(t=13)
(e^(-13), e^(-13))


or derivate:

sage: x.derivative(t)
(-e^(-t), -e^(-t))


and so on.

If you want to define a python function, then you have to write something like:

sage: x = lambda t: (e^(-t), e^(-t))
sage: x(13)
(e^(-13), e^(-13))

more

Thanks! I don't want the python function, i.e., lambda.., because I want to use x.laplace(t,s) at one time, instead of a loop ::: for i in range(0,n): x[i].laplace(t,s)

@gundamlh I think this is not possible with the current implementation of the laplace method.