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.
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.

Kevin

On Wednesday, 9 April 2014 08:59:11 UTC+1, John Cremona wrote:
>
> These clever hacks do not take away from Kevin's main points:  that 
> getting field automorphisms to act on objects like polynomials over 
> the field, with related functionality (norms etc);  and that basic 
> functions related to polynomials (extracting coefficients and creating 
> a poly from a list of coeffs) should not be hard to find in the 
> documentation. 
>
> John 
>
> On 9 April 2014 00:05, Nils Bruin <nbr...@sfu.ca <javascript:>> wrote: 
> > On Tuesday, April 8, 2014 1:55:49 PM UTC-7, Nils Bruin wrote: 
> >> 
> >> F=Qxz(f)                       #this conveniently lifts z to a 
> >> transcendental in Q[x,z] 
> > 
> > 
> > Oops, that only works because of the last-resort attempt of converting f 
> to 
> > a string and then feeding the string to Qxz. One probably shouldn't rely 
> on 
> > such code in production situations. You'd be better off using 
> > 
> > F=Qxz({ (degx,degz) :cfz for degx,cfx in enumerate(f.list()) for 
> degz,cfz in 
> > enumerate(cfx.list())}) 
> > 
> > which won't win any prizes for legibility and only qualifies as a 
> one-liner 
> > in the technical sense, but it is much faster than the string-based 
> > conversion. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sage-support...@googlegroups.com <javascript:>. 
> > To post to this group, send email to 
> > sage-s...@googlegroups.com<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to