On Dec 18, 2008, at 12:12 AM, Jason Grout wrote
> Oh, I understood the above to mean that you could define a matrix B,  
> for
> example, without defining the elements of the matrix.  I don't know  
> how
> to do that in Mathematica; maybe I'm confused.

It's actually done implicitly, see:
http://reference.wolfram.com/mathematica/tutorial/MultiplyingVectorsAndMatrices.html

So,
D[Transpose[a].B.c, c]

should just work.

>  At any rate, for now,
> I'll assume that you mean that you define "vectors" a and c and a
> "matrix" B in Mma by specifying the entries as symbolic  
> expressions.  I
> put vectors and matrix in quotes since I just ran into some trouble
> trying to do an example session in Mma.  To my knowledge, Mma really  
> has
> no notion of a "vector" or a "matrix", but instead has just the notion
> of a list and a list of lists.  This gave me problems in trying to do
> what what you did below.  Here, I define n to be a "vector" and try to
> compute NN^T
>
> In[2]:= n = {1, t, Cos[t]}
>
> Out[2]= {1, t, Cos[t]}
>
> In[3]:= b=n.Transpose[n]
>
> Transpose::nmtx:
>    The first two levels of the one-dimensional list {1, t, Cos[t]}
>      cannot be transposed.
>

Yeah, that won't work since they aren't defined as a vector.

>
> Instead, I assume you mean to define n as literally a column vector
> (i.e., a column "matrix")?
>

Yes, I mean a column vector/matrix.

> In[6]:= n = {{1, t, Cos[t]}}//Transpose
>
> Out[6]= {{1}, {t}, {Cos[t]}}
>
> In[7]:= b=n.Transpose[n]
>
>                               2                                      2
> Out[7]= {{1, t, Cos[t]}, {t, t , t Cos[t]}, {Cos[t], t Cos[t],  
> Cos[t] }}
>
>
>> D[Transpose[a].B.c, c]
>> or
>> D[Transpose[a].B.c, a]
>>
>> If they conform, the operation is valid, and has a simple solution.
>
> Pardon my ignorance, but what do you mean by a "solution"?  Do you  
> mean
> that the derivatives yield a result, or that there is another solving
> step which involves an equation?
>

I mean that the derivatives yield a result.


> I think that this might be possible in Sage using
> http://trac.sagemath.org/sage_trac/ticket/3941 and
> http://trac.sagemath.org/sage_trac/ticket/4493.  Can you give a  
> specific
> Mathematica example session?  I'll try to duplicate it in Sage.
>

The problem is that I don't have a copy of Mathematica any more. I  
last had
a license for version 4 for a different machine that I don't use  
anymore. I
know the first ticket isn't what I mean, I'm not sure about the second.

I want to define a set of column vectors, a, c, and N (without  
specifying
the length aside from it being length n or contents). Then, perform

a^T.N.N^T.c

(1xn).(nx1).(1xn).(nx1) = 1x1 so everything conforms.

and carry out the derivative with respect to the vectors c or a. This  
derivative
is easy to carry out by hand, but since the operations aren't really  
supported,
it isn't easily done in most CAS packages.

I hope this helps clarify things.

Cheers,

Tim.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to