RE: Change of Basis function
- To: mathgroup at smc.vnet.net
- Subject: [mg69005] RE: [mg68949] Change of Basis function
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 26 Aug 2006 02:04:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
David,
How about...
vectorComponents[vec_, basis : {_Symbol, _Symbol, _Symbol}] :=
Coefficient[vec, basis]
vectorComponents[vec : {_, _, _},
basis_?MatrixQ /; Dimensions[basis] == {3, 3}] :=
Module[{a, b, c, eqns},
eqns = Thread[vec == {a, b, c}.basis];
{a, b, c} /. First@Solve[eqns, {a, b, c}]
]
vectorComponents[{1, 2, 3}, {{1, 2, 0}, {0, 1, 0}, {0, 0, 1}}]
{1, 0, 3}
vectorComponents[f x1 - b x2 + x3 - x2, {x1, x2, x3}]
{f, -1 - b, 1}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: David Boily [mailto:dsboily at fastmail.ca]
To: mathgroup at smc.vnet.net
I would like to know if there is a function capable of giving as output
the representation of a vector in a given basis. For example:
FunctionX[{1,2,3}, {{1,2,0},{0,1,0},{0,0,1}}]
(where the first argument is the vector and the second the basis)
would yield
{1,0,3}
and
FunctionX[f x1 - b x2 + x3 - x2, {x1,x2,x3}]
would yield
{f, -b-1, 1}
I'm more interested in the second case, obviously, because the first one
can be achieved with a simple matrix multiplication.
David Boily
Center for Intelligent Machines
Mcgill University