| Most of my research is in numerical methods/numerical analysis. I need to perform derivations using arbitrary matrices. Currently, when using sage, I have to declare all the elements of a symbolic matrix: var('p00 p01 p02 p03 p10 p11 p12 p13 p20 p21 p22 p23 p30 p31 p32 p33') Pmat=matrix([[p00,p01,p02,p03],[p10,p11,p12,p13],[p20,p21,p22,p23],[p30,p31,p32,p33]]) Clearly for large matrices this is prohibitively tedious. In Mathematica, I simply use: pmat=Array[p,{4,4}] I am then able to put constraints on the elements of p and solve for the values for the given method I am trying to derive. I prefer to use sage over Mathematica, so if someone can enlighten me how to accomplish this task in sage, I would appreciate it. |
| Hi tcfisher, Here's one less-tedious way, using Python's list comprehension, string formatting, and an alternate format for the Note that this does not inject the variables ' But if all you want to do is manipulate these matrices, that will work fine: And of course if you need the ' |
| Thanks for your help niles. Here is the function I came up with to do this automatically from now on. Note that root must be a string.
great! Glad I could help.
niles (Sep 30 '10) |
Asked: Sep 30 '10
Seen: 530 times
Last updated: Sep 30 '10
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.