Ulf Kuehn on Fri, 22 Dec 2017 13:22:18 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
type conversion |
hi, in some computations i generate generic variables, say a_1, a_2, ..., which for a later use within parallel computations should become local variables. how to realize this possible in pari (using eval unfortunally doesn't work) ? my(eval(Str("a_",1))) *** variable name expected: my(eval(Str("a_",1))) *** ^------------------ ? the evaluation of a very large polynomial pol by using "substvec( pol, [ variables], [values / or new variables] ) " takes very, very long. experiments show that the evaluation of a polynomial function " (variables) -> pol " is much faster. so my second question is how to convert efficiently a polynomial into a function ? f=a*b; ? g=(a,b) -> f; ? g(x,y) %15 = b*a ? g=(a,b) -> eval(f); ? g(x,y) %17 = y*x ? using "eval" works if there are no side relations, however if there side relations, these are all contained in "eval(f)" as a long list "(a,b) -> my( list of all relations from the program ); a*b ;" best regards, ulf -- |