Message Boards Message Boards

0
|
2676 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Calculating the covariance of a stochastic harmonic oscillator with matrix

Hello, my name is Ramon and I am new to Mathematica and having some trouble using it for my Master's project. I know Mathematica has the functionality to do what I am after by I cannot get it to work.

As part of a project in numerical analysis of neuronal dynamical systems, I need to calculate a Matrix integral which represents the covariance of a stochastic harmonic oscillator and I do not know the syntax and everything I tried has not worked.

I have a matrix:

A={{b,d},{gf,-f}}

b,d,g,f are all real numbers and constants. I need to calculate the exponential matrix of A(x-s) where x is going to be the integration variable later on.

E=MatrixExp[A(x-s)]//MatrixForm

I also have a matrix S with the noise

S={{u,0},{0,v}}

I need to calculate the integrand

I=E*(S*Transpose(S))*Transpose(E)

And then integrate each component of this over the range 0,t. This will give me my covariance matrix. I can calculate the exponential matrix, but after that, nothing seems to work. Even if I try simple operations such as squaring my matrix E, it does not give me the right output. It gives me things like the whole matrix with a power 2 in the corner. Transposing doesn't work either. I think the problem might be that it does not know that the constants I am giving are just real numbers, but I do not know how to fix this. Some help would be most appreciated.

Ramon,

Your first problem is you should NEVER start your variables with capital letters in Mathematica. You will invariably interfere with the inner workings of Mathematica. For example, "E" and "I" both have special meetings (E is the constant e, and I is the complex i). These are particularly bad choices for variable names, but the best way to avoid it is to never use first letter capitals.

Also, * is not a matrix operation -- it is a list operation of plain multiplication. When Mathematica sees * it does element by element multiplication and not vector math. You need to use Dot[] (abbreviated "."). If you fix these two problems, I think your expressions will work (or at least be closer to working!).

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract