Ask Your Question
0

How to create a vector function (mapping)?

asked 2013-11-05 22:57:46 -0500

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-05 23:17:14 -0500

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 01:24:33 -0500 )edit

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

ppurka gravatar imageppurka ( 2013-11-06 23:22:54 -0500 )edit

@ppurka I agree with you.

gundamlh gravatar imagegundamlh ( 2013-11-22 04:37:15 -0500 )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-05 22:57:46 -0500

Seen: 83 times

Last updated: Nov 05 '13