Hi Jason,

Thanks for the answer. I tried to play a little with the module that
you referred to in your message. It goes in the right direction, but
we have not been able to progress much. As you suggested, we are
declaring vectors as X by 1 and 1 by Y matrices, but the code seems
not to be prepared to understand a dot product between these two
"vectors". From the point of view of this package we are simply
generating a 1x1 matrix, which is of course not the same. Somebody
knows if there are newer versions of this module?

I have no experience in programming sage. Would it be difficult to
make such additions to the code?

regards,
Miquel

On Sep 16, 6:40 pm, Jason Grout <[email protected]> wrote:
> On 9/16/10 10:47 AM, miquel pericas wrote:
>
>
>
> > Hi,
>
> > I'm a collaborator of the author of the previous post. Let me try to
> > elaborate a little on what it is we want to do
>
> > Basically we are trying to simplify some complex symbolic expressions
> > we have generated which include matrices and vectors as variables.
> > Unfortunately these formulas are too long/complex to manipulate by
> > hand and we we are looking for some way to do this automatically.
> > Sage's manual explains how to simplify expressions with some
> > variables: The following example is extracted from the reference
> > manual
>
> > sage: var( x, y, a, b, c )
> > (x, y, a, b, c)
> > sage: f = x*(x-1)/(x^2 - 7) + y^2/(x^2-7) + 1/(x+1) + b/a + c/a; f
> > (x - 1)*x/(x^2 - 7) + y^2/(x^2 - 7) + b/a + c/a + 1/(x + 1)
> > sage: f.combine()
> > ((x - 1)*x + y^2)/(x^2 - 7) + (b + c)/a + 1/(x + 1)
>
> > We want to do exactly the same, but in our case variables a,b,c, etc
> > would be vectors and matrices. Our question is: is it possible to use
> > sage to perform this kind of simplification with matrices and vectors?
> > Or, what is probably the same question, how can I generate variables
> > that are matrices and vectors?
>
> It sounds like the thread I linked to in an earlier message on this
> thread contains code that would do things like you are asking about.
>
> http://groups.google.com/group/sage-devel/browse_thread/thread/cafb48...
>
> For example, here is an example from that thread:
>
>                  sage: Alg = SymbolicMatrixAlgebra(QQ)
>                  sage: A = Alg.matrix("A", 3, 2)
>                  sage: B = Alg.matrix("B", 3, 2)
>                  sage: C = Alg.matrix("C", 2, 2)
>                  sage: D = Alg.matrix("D", 2, 3)
>                  sage: x = D * (A+B) * C
>                  sage: x
>                  D B C + D A C
>                  sage: x.transpose()
>                  C^t B^t D^t + C^t A^t D^t
>
> Of course, you can deal with a vector by declaring a 3 by 1 matrix, for
> example:
>
> sage: load('matrix.sage')
> sage: Alg = SymbolicMatrixAlgebra(QQ)
> sage: A = Alg.matrix("A",3,3)
> sage: b = Alg.matrix("b",3,1)
> sage: x = Alg.matrix("x",3,1) # a column vector
> sage: A*x + A^2*x+A^3*x+A*b
> A A A x + A A x + A b + A x
>
> The code isn't complete, but it does do things like not assume matrices
> commute, handle inverses and transposes, etc.  I would love it if the
> code was polished and included in Sage.  I would probably make good use
> of it too.
>
> Thanks,
>
> Jason

-- 
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

Reply via email to