# Revision history [back]

### convert symbolic matrix to numeric one

Being new to sagemath I have the following problem: I have a rather large symbolic matrix M that depends on a collection of variables. the variables are collected in a list like this

sage: v = [var('val_%a' %i) for i in range(5) ]

sage: v

(val_0, val_1, val_2, val_3, val_4)

The Matrix M depends on some complicated way on the variables val_0 , val_1 etc... Now I want to evaluate M for some particular values val[i] which are numbers what I do is ceate a dictionary

sage: subsdict={ v[i]:i for i in range(5)}

and then substitute the values in M

sage: Mnumeric = M.subs(subsdict)

my problem is that this substitution is very slow (of course in the real problem its not only 5 variables but rather 100)

 2 None vdelecroix 7620 ●20 ●84 ●168 http://www.labri.fr/pe...

### convert symbolic matrix to numeric one

Being new to sagemath I have the following problem: I have a rather large symbolic matrix M that depends on a collection of variables. the variables are collected in a list like this

sage: v = [var('val_%a' %i) for i in range(5) ]  ]
sage: v v
(val_0, val_1, val_2, val_3, val_4)val_4)
 

The Matrix M depends on some complicated way on the variables val_0 , val_1 etc... Now I want to evaluate M for some particular values val[i] which are numbers what I do is ceate a dictionary

sage: subsdict={ v[i]:i for i in range(5)}range(5)}


and then substitute the values in M

sage: Mnumeric = M.subs(subsdict)M.subs(subsdict)


my problem is that this substitution is very slow (of course in the real problem its not only 5 variables but rather 100)