Ask Your Question
0

How to create a vector function (mapping)?

asked 2013-11-06 05:57:46 +0200

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-11-06 06:17:14 +0200

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))
edit flag offensive delete link more

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 ( 2013-11-06 08:24:33 +0200 )edit

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

ppurka gravatar imageppurka ( 2013-11-07 06:22:54 +0200 )edit

@ppurka I agree with you.

gundamlh gravatar imagegundamlh ( 2013-11-22 11:37:15 +0200 )edit

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: 2013-11-06 05:57:46 +0200

Seen: 519 times

Last updated: Nov 06 '13