On Jan 17, 2008, at 6:33 AM, David Kohel wrote:

>> E1.is_isomorphic(E2)
>>
>> always returns one boolean.
>
> +1

I agree too.

>
>> If you want the map too, you have write
>> something explicit, e.g.,
>>
>>    t, phi = E1.is_isomorphic(E2, with_map=True)
>>
>> where phi will be None they aren't isomorphic.
>
> This is my question: do we have functions which can return
> different types depending on the arguments passed in?

I think this is best avoided.

> Whatever its design flaws, it has been the philosophy that
> this should not be the case in Magma.  The alternative is
> to have a different function:
>
> E1.is_isomorphic_with_isomorphism(E2) # or is_isomorphic_with_map
>
> I would like to hear from someone on the "correct" Python style.
> Note that this syntax should be followed throughout the SAGE
> language, in groups, rings, etc., so we should have a convention.
>
> I would also propose the syntax:
>
> E1.isomorphism(E2)
>
> rather than E1.isomorphism_to(E2) as the direction should be clear.
> The latter implies E1.isomorphism_from(E2) should also exist, but
> I don't see an argument or context in which E1.isomorphism(E2) and
> E2.isomorphism(E1) would not suffice.

Seems sensible to me.

> Thus we could have:
>
> E1.is_isomorphic(E2)
> E1.is_isomorphic_with_isomorphism(E2) # or
> E1.is_isomorphic_with_map(E2)
> E1.isomorphism(E2)
>
> The middle one could be replaced with
> E1.is_isomorphism(E2,with_isomorphism=True)
> (of with_map) if this is judged acceptable SAGE/Python syntax.  I
> would propose we endeavor to have the same return type (or None)
> independent of the arguments given.

The middle two seem redundant (with the first and last)--especially  
if we're going to replicate this over all of Sage (though perhaps it  
could be done at a very high level, which I would be much more OK  
with). I would propose that E1.isomorphism(E2) raise an exception if  
E1 is not isomorphic to E2, but one could pass in a flag to make it  
return None rather than raise an error (if that suits your efficiency/ 
programing style better).

If there is more than one isomorphism, I don't think all of them  
should be computed and returned unless they are explicitly asked for.

> John mentioned calculation of all isomorphisms.  I propose that the
> set
> of all isomorphisms be a SAGE object. Thus
>
> X = Iso(E1,E2) # does nothing
> X.cardinality() # tests is_isomorphic and j-invariant = 0 or 12^3
> X.representative() # computes an isomorphism
> X.list() # computes all isomorphisms
>
> The advantage of creating X is that it can cache the above data
> for efficiency.
>
> Moreover is E1 = E2, we could do
>
> G = Aut(E1) # or Iso(E1,E1)
> G.group()
> G.group_with_isomorphism()
> A = AbelianGroup(2)
> A.is_isomorphic(G)
> A.is_isomorphic_with_isomorphism(G)
> A.isomorphism(G)
>
> Again, this should be a common syntax throughout SAGE.

+1

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to