> Could you please explain a little bit about the code?
Sure, but you should make a little effort to play with it yourself for
a bit first.
> For the example you use, it seems I is an ideal above 17, what does [0]
> mean?
The command K.primes_above(...) returns a list of the prime ideals
above the given rational prime. The [0] selects the first (zeroth?)
from the list. So yes, I is an ideal above 17 which I am just using as
an example (any number field ideal, except the zero ideal, would work
here). There are lots of examples like this in the Sage documentation.
> In the end do we get a basis of the dual of I?
Yes, that's the whole point of the exercise :-). Did you read the
documentation for "trace_dual_basis"? You should know that you can get
documentation on any method of any Sage object by typing its name then
?, e.g.
sage: K.trace_dual_basis?
will tell you lots more about this method.
> Why do we need to put
> I.basis() in the bracket of trace_dual_basis?
Because trace_dual_basis takes a list of generators as its argument --
it can calculate the trace dual of any Z-submodule of K, it needn't be
an ideal.
Regards, David