On Tue, Apr 8, 2014 at 10:20 AM, Kevin Buzzard
<kevin.m...@gmail.com> wrote:
> I am new to sage. I am not scared of reading docs for computer programs. I
> cannot work out how to answer basic questions I have from the sage docs
> though :-( and it's so easy just to ask for help, so here I am.
>
> Here's my question. I have a polynomial with coefficients in a cyclotomic
> field and I want to know how to compute the product of that polynomial with
> all its Galois conjugates (because I want to run newton_slopes on it but the
> manual is not, as far as I can see, clear on whether this will work, so I'm
> going to build a polynomial for which I know it will work).
The line you want is
h = prod(R([sigma(a) for a in f.list()]) for sigma in G.list()); h
F=Qxz(f) #this conveniently lifts z to a transcendental in Q[x,z]
On Apr 9, 2014 1:21 AM, "Kevin Buzzard" <kevin.m...@gmail.com> wrote:
>
> Thanks William and Niels!
>
> So now I can write better code than yesterday and, as John says, the only remaining question is how someone with no sage experience is supposed to work out for themselves that if R is a polynomial ring then R([1,2,3]) is the way to create 3x^2+2x+1.
> Let me stress that I am not ruling out that there is a sensible algorithmic way to do this from the docs! I'm just saying I couldn't figure out how to use the docs to answer this sort of question yesterday, whereas my experience with other programming languages is that in the end I find a resource (possibly via google) which, whenever you want to know about how to know about foobars, will offer you a page titled "foobars" with an essentially complete list of how to create foobars, coerce them to and from other data structures, and manipulate them. I'm not talking about a tutorial with examples, I'm talking about a resource giving essentially complete documentation about certain common objects.
>
> Of course it could well be just a matter of experience. For all I know, it might be a general thing in sage that if the parent of f is R, and if S is a bunch of data that can be used to build an f, then R(S) will pretty much always work. If this is the case then I should just do some more coding until I get the hang of it.
>
This is the case in Python more generally. R(S) in Python is supposes to be the analog of R!S in Magma.
> Kevin
>
>
>
> On Wednesday, 9 April 2014 08:59:11 UTC+1, John Cremona wrote:
>>
Thanks William and Nils!
So now I can write better code than yesterday and, as John says, the only remaining question is how someone with no sage experience is supposed to work out for themselves that if R is a polynomial ring then R([1,2,3]) is the way to create 3x^2+2x+1.