On Tue, Jun 21, 2011 at 5:37 PM, Dmitry Shkirmanov <[email protected]>wrote:
> Hello, i think that my question is simple one, but i have not found
> answer in the reference manual. I need a function of vector variables.
> For example:
> var("x1,x2,x3")
> x=vector([x1,x2,x3])
> Is it possible to define a function of the vector variable "x",
> something like this: f(x)=sum(x[i]*x[i]for i in range(3)) ?
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>
Hi,
sage: var('x1, x2, x3')
(x1, x2, x3)
sage: x = vector([x1,x2,x3])
sage: f = lambda x: sum([ii*ii for ii in x])
sage: f(x)
x1^2 + x2^2 + x3^2
Hope it helps though its a bit late :)
Rajeev
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org