| I can't find any support documentation on this, but I'm sure it must be possible. To give some context, I'm working on a module for invariant theory which allows for computing matrices acting on polynomials: Say I define a polynomial
you can put <pre> ... </pre> around the code block to make it more readable (prevent markdown formatting)
niles (Aug 30 '10)
the same effect has selecting a block of text and clicking the editor button with zeroes and ones.
Evgeny (Aug 30 '10)
if you select a span of text and click "code formatting" button - the selection will be "backticked" and as a result displayed with a fixed width font.
Evgeny (Aug 30 '10) |
| Hello, Here is a possibility But if v is a vector and not a tuple the trick won't work. Hoping this would be useful, Vincent
And for the many-variable case, you can use `d = dict(zip(R.gens(),v))` and `h.subs(d)` (I think the post above forgot to mention this last part). If v really has to be a vector, you could probably convert it to a tuple or list first.
niles (Aug 30 '10)
Niles: for me P.subs(a=5,b=6) does not work for an element of a polynomial ring (but does for symbolic expressions).
vdelecroix (Aug 30 '10)
Digression: flatten() is useful in related use-cases. The max_level keyword argument is very useful when there is multiple nesting.
ccanonc (Aug 30 '10)
vdelecroix: I think you have to pass the dictionary object to `subs()`
niles (Aug 30 '10)
What about the efficiency of each/any of the above methods? In particular, is unpacking the dictionary quicker than unpacking the list?
tdstephens3 (Jun 14 '11) |
Asked: Aug 30 '10
Seen: 187 times
Last updated: Aug 30 '10
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.