Skip to content
Entry of a symmetri...
 
Notifications
Clear all

Entry of a symmetric matrix

2 Posts
2 Users
0 Reactions
2,212 Views
Posts: 10
Customer
Topic starter
(@patstevens)
Eminent Member
Joined: 4 years ago

Is there a way to set up an edit table of a 2-D matrix so that it won't allow you to enter a non-symmetric matrix?  I have a covariance matrix, which should be symmetric. 

The ideal would be to disallow a non-symmetric entry -- for example, if you change a cell, it would immediately change is transposed cell. Or maybe would only let you enter a triangular matrix (although would be better if you can see the full symmetric matrix while entering it). Failing that, I'd like immediate feedback that there is a problem when you press the green checkmark (and not just an error later when you evaluate, which I am able to do). 

1 Reply
Lonnie Chrisman
Posts: 43
Admin
(@lchrisman)
Member
Joined: 14 years ago

Here is an example that does what you want:

The edit table look like this:

The gray cells are read-only, so you can only change the white cells in the lower triangle. As soon as you change a cell, the symmetric value in the gray area changes too. 

I did this by using two variables -- one for an underlying store (which just holds the lower triangle) and one for the symmetric matrix itself. I then defined the Symmetric_matrix to be

SubTable( If J>=I then Matrix_storage else Transpose(Matrix_storage,I,J) )

It says: If you are the lower triangle (editable part), reflect the cells of Matrix_storage in the edit table (SubTable displays cells from other sources in a new edit table). The else part uses a computed value, and is hence read-only.  

This is all it takes to enforce the symmetry and to cause the read-only cells to display with a gray background.

The final embellishment is that, from the Typescript window, I entered this command:

ProactivelyEvaluate Symmetric_matrix:16

You can see on the doc page for ProactivelyEvaluate that 16 means the edit table should accept entry immediately when you enter a value into the cell, instead of waiting for you to press the Green checkbox. That way it updates the symmetrical cell immediately.

 

 

Reply
Share:

Download Free Analytica


    We hate spam as much as you. We won't share your email with third parties.
    The free edition of Analytica includes these key Analytica features:
    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array. It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Download the free edition of Analytica

    The free edition of Analytica includes these key Analytica features: 

    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array.  It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Analytica runs on any Windows computer, or on a Macintosh using Parallels or VMWare.


      Analytica Cubes Pattern