Re: Change of Basis function
- To: mathgroup at smc.vnet.net
- Subject: [mg68997] Re: [mg68949] Change of Basis function
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 26 Aug 2006 02:04:39 -0400 (EDT)
- References: <200608250934.FAA09206@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
David Boily wrote: > 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 I think the easiest way to do the first is with LinearSolve: In[72]:= LinearSolve[Transpose[{{1,2,0},{0,1,0},{0,0,1}}], {1,2,3}] Out[72]= {1, 0, 3} But this will not readily generalize. Since today is my day for PolynomialReduce I'll show how that might be applied. The second example is straightforward. We want to write the polynomial f*x1 - b*x2 + x3 - x2 as a combination of {x1,x2,x3}. PolynomialReduce can find the coefficients needed. In[73]:= First[PolynomialReduce[f*x1 - b*x2 + x3 - x2, {x1,x2,x3}, {x1,x2,x3}]] Out[73]= {f, -1 - b, 1} For the first example one would need to convert from matrix to a polynomial representation, in effect treating columns as variables and rows as polynomials. So the set of polynomials representing {{1,2,0},{0,1,0},{0,0,1}} would be {x1,2*x1+x2,x3}. The target vector {1,2,3} becomes x1+2*x2+3*x3. In[74]:= First[PolynomialReduce[x1 + 2*x2 + 3*x3, {x1,2*x1+x2,x3}, {x1,x2,x3}]] Out[74]= {1, 0, 3} To make this into a more generally usable procedure you'd need to code the part that translates from matrix to polynomial form. Daniel Lichtblau Wolfram Research
- References:
- Change of Basis function
- From: David Boily <dsboily@fastmail.ca>
- Change of Basis function