You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sébastien Brisard <se...@m4x.org> on 2011/10/04 05:22:37 UTC

[math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Good morning everyone,
I would like to add the above mentioned methods to FieldElement. This
would avoid awkward commands such as
x.getField().getZero().substract(x) (for x.opposite())
and
x.getField().getOne().divide(x) (for x.invert()).
It's not essential, but I think it would be useful. Besides, I don't
think it would bloat the interface, since opposite and inverse are
mathematical notions which are intrinsic to fields.
What do you think?
Best regards,
Sébastien

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Sébastien Brisard <se...@m4x.org>.
>
> +1 to add both of these, though I would suggest one of the following
> pairs of names:
> 0) negate, invert
> 1) opposite, reciprocal
> 2) additiveInverse, multiplicativeInverse
>
> Probably 2) is clearest, but a bit long.  I am fine with any of them.
>
> Phil
>
I do think these two features might prove useful. There are
workarounds, but they tend to verbose code.
As for the options you suggest, Phil, I agree my proposition was
probably not the best. We must be careful with consistency, because
some classes already implement those methods (Complex has a method
negate()). I will look into it, and open a JIRA ticket.

Sébastien

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Phil Steitz <ph...@gmail.com>.



On Oct 7, 2011, at 7:43 AM, Sébastien Brisard <se...@m4x.org> wrote:

>> 
>> Not worth a long argument, but the reciprocal of a fraction is not exactly the same concept as multiplicative inverse in a field.  I would be happier about living with that inconsistency than adding another noun/verb inconsistency in the same class.
>> 
>> Phil
>> 
> Just for my own interest: if I understand correctly, reciprocal is
> specific to fractions? Is that correct.

Yes.

> I'm not sure I understood your last point. Do you suggest we keep
> what's already there: negate()/reciprocal()?

Yes, because "reciprocate" (the natural verb) makes no sense and "reciprocal" is a standard term for the result.


> Thanks for these clarifications,
> Sébastien
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Sébastien Brisard <se...@m4x.org>.
>
> Not worth a long argument, but the reciprocal of a fraction is not exactly the same concept as multiplicative inverse in a field.  I would be happier about living with that inconsistency than adding another noun/verb inconsistency in the same class.
>
> Phil
>
Just for my own interest: if I understand correctly, reciprocal is
specific to fractions? Is that correct.
I'm not sure I understood your last point. Do you suggest we keep
what's already there: negate()/reciprocal()?
Thanks for these clarifications,
Sébastien

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Phil Steitz <ph...@gmail.com>.



On Oct 7, 2011, at 6:07 AM, Sébastien Brisard <se...@m4x.org> wrote:

>> 
>> +1 to add both of these, though I would suggest one of the following
>> pairs of names:
>> 0) negate, invert
>> 1) opposite, reciprocal
>> 2) additiveInverse, multiplicativeInverse
>> 
>> Probably 2) is clearest, but a bit long.  I am fine with any of them.
>> 
>> Phil
>> 
> Hi,
> I've created MATH-686 which relates to this proposal. However looking
> at what's already implemented in the CM library, I found that the best
> (unsatisfactory) option would be negate()/reciprocal() -- see the
> ticket. Native english speakers will probably not like that! Are we
> really that unhappy with this?

Not worth a long argument, but the reciprocal of a fraction is not exactly the same concept as multiplicative inverse in a field.  I would be happier about living with that inconsistency than adding another noun/verb inconsistency in the same class.

Phil

> Sébastien
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Sébastien Brisard <se...@m4x.org>.
>
> +1 to add both of these, though I would suggest one of the following
> pairs of names:
> 0) negate, invert
> 1) opposite, reciprocal
> 2) additiveInverse, multiplicativeInverse
>
> Probably 2) is clearest, but a bit long.  I am fine with any of them.
>
> Phil
>
Hi,
I've created MATH-686 which relates to this proposal. However looking
at what's already implemented in the CM library, I found that the best
(unsatisfactory) option would be negate()/reciprocal() -- see the
ticket. Native english speakers will probably not like that! Are we
really that unhappy with this?
Sébastien

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Phil Steitz <ph...@gmail.com>.
On 10/3/11 8:22 PM, Sébastien Brisard wrote:
> Good morning everyone,
> I would like to add the above mentioned methods to FieldElement. This
> would avoid awkward commands such as
> x.getField().getZero().substract(x) (for x.opposite())
> and
> x.getField().getOne().divide(x) (for x.invert()).
> It's not essential, but I think it would be useful. Besides, I don't
> think it would bloat the interface, since opposite and inverse are
> mathematical notions which are intrinsic to fields.
> What do you think?

+1 to add both of these, though I would suggest one of the following
pairs of names:
0) negate, invert
1) opposite, reciprocal
2) additiveInverse, multiplicativeInverse

Probably 2) is clearest, but a bit long.  I am fine with any of them.

Phil
> Best regards,
> Sébastien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Mikkel Meyer Andersen <mi...@mikl.dk>.
2011/10/4 Luc Maisonobe <Lu...@free.fr>:
> Le 04/10/2011 05:22, Sébastien Brisard a écrit :
>>
>> Good morning everyone,
>> I would like to add the above mentioned methods to FieldElement. This
>> would avoid awkward commands such as
>> x.getField().getZero().substract(x) (for x.opposite())
>> and
>> x.getField().getOne().divide(x) (for x.invert()).
>> It's not essential, but I think it would be useful. Besides, I don't
>> think it would bloat the interface, since opposite and inverse are
>> mathematical notions which are intrinsic to fields.
>> What do you think?
>
> +0 from me.
>
> Luc
>
>> Best regards,
>> Sébastien
>>
+0, too.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] Add methods opposite() and inverse() to o.a.c.m.FieldElement

Posted by Luc Maisonobe <Lu...@free.fr>.
Le 04/10/2011 05:22, Sébastien Brisard a écrit :
> Good morning everyone,
> I would like to add the above mentioned methods to FieldElement. This
> would avoid awkward commands such as
> x.getField().getZero().substract(x) (for x.opposite())
> and
> x.getField().getOne().divide(x) (for x.invert()).
> It's not essential, but I think it would be useful. Besides, I don't
> think it would bloat the interface, since opposite and inverse are
> mathematical notions which are intrinsic to fields.
> What do you think?

+0 from me.

Luc

> Best regards,
> Sébastien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org