Ask Your Question
0

How to create a vector function (mapping)?

asked 11 years ago

gundamlh gravatar image

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 11 years ago

tmonteil gravatar image

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))
Preview: (hide)
link

Comments

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 gravatar imagegundamlh ( 11 years ago )

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

ppurka gravatar imageppurka ( 11 years ago )

@ppurka I agree with you.

gundamlh gravatar imagegundamlh ( 11 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 633 times

Last updated: Nov 06 '13