ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 21 Nov 2013 01:25:00 -0600Matrix/Tensor derivative for Stress Tensorhttp://ask.sagemath.org/question/8119/matrixtensor-derivative-for-stress-tensor/I need to do define/calculate the following stress tensor in an elegant way:
$T_{i,j} := -p \delta_{i,j} + \eta (\partial_i v_j + \partial_j v_i)$
where i,j can be x,y,z and
$\partial_i v_j := \frac{\partial v_j}{\partial i}$
I've found the sage-function kronecker_delta for the first term, but I am having problems with the two partial derivatives.
Thanks in advance!packomanWed, 18 May 2011 10:20:46 -0500http://ask.sagemath.org/question/8119/Matrix equations and derivativeshttp://ask.sagemath.org/question/10759/matrix-equations-and-derivatives/Hello!
I am completely new to Sage and Python.
In order to get knowledge about Sage I'd like to find a way to express an equations like these
http://stats.stackexchange.com/questions/14827/how-to-calculate-derivative-of-the-contractive-auto-encoder-regularization-term
User with nickname fabee had posted derivatives of contractive autoencoder regularizer, and I want to reproduce these results in Sage. It's a big challenge for Sage newbies like me.
A few first attempts do not succeed so can you show me the way to do this task?
newbieThu, 21 Nov 2013 01:25:00 -0600http://ask.sagemath.org/question/10759/vector derivative returns a scalarhttp://ask.sagemath.org/question/10456/vector-derivative-returns-a-scalar/Trying to obtain the derivative of $\vec{u} = [-1,1]$ using the following code:
> u = matrix(1,2,[-1, 1])
>
> r = derivative(u,x);
> r
I get a scalar value 0.
Although according the following relation it should be a 2-dimensional zero vector.
$$\frac{\mathrm{d} \vec{u}}{\mathrm{d} x} =\frac{\mathrm{d}}{\mathrm{d} x} [-1, 1] = [ \frac{\mathrm{d}}{\mathrm{d} x}(-1), \frac{\mathrm{d}}{\mathrm{d} x}(1) ] = [0, 0]$$
Why does it happen? In the case it's a bug where could I report it?
Thanks
TomasMon, 19 Aug 2013 05:38:26 -0500http://ask.sagemath.org/question/10456/eigenvalues of a derivative vs derivative of eigenvalueshttp://ask.sagemath.org/question/9543/eigenvalues-of-a-derivative-vs-derivative-of-eigenvalues/Hi! I have this little problem. If anyone would be so kind to share his knowledge and shed some lite on it, I'd be very grateful. Big thanks in advance (and sorry for my english)!
I have a matrix M=M(x) depending on a variable x. I want sage to compute trace of a product of a derivative of M, M' and some function of it, f(M), at a fixed value of x=x_0; that is:
(tr[M'*f(M)])|_(x=x_0).
It just so happens that tr[M'*f(M)] = sum( ev_i' *f(ev_i) ), where {ev_i(x)} are eigenvalues of M. Lucky me. Diagonalisation of M commutes with differentiating or taking the function of it, one could say.
But my M and its derivative are somewhat complicated, yet simplify greatly after substituting x=x_0. So I would very much prefer first to compute M', substitute x_0 M0:=M|_(x=x_0) and M'0:=M'|_(x=x_0), and only after that ask sage for eigenvalues:
ev1=M0.eigenvalues()
ev2=M'0.eigenvalues()
So here's the question: do i have any reason for hoping that:
(tr[M'*f(M)])|_(x=x_0) = sum( ev2[i] *f(ev1[i]) for i in range(dim of M) )?
(That is, wether the order of eigenvalues changes if I exchange diagonalisation with differentiation?)ozikSat, 17 Nov 2012 12:18:33 -0600http://ask.sagemath.org/question/9543/