Project

General

Profile

Feature #1374

Add function power to CoCoA-5

Added by Anna Maria Bigatti over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Category:
CoCoA-5 function: new
Target version:
Start date:
09 Dec 2019
Due date:
% Done:

100%

Estimated time:
1.33 h
Spent time:

Description

In CoCoA we can write g^4, but in CoCoALib we have to write power(g,4) (because of incompatible priority of operator^ in C++).

It would be handy to have power in CoCoA too: this is helpful when testing CoCoALib snippets in CoCoA.

History

#1 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 10 to 40

Implemented for RingElem (in OneLiners)

#2 Updated by John Abbott over 4 years ago

I have just checked in a power function defined in cocolib.cpkg5.
My approach means that power works for any type (where ^ is defined in CoCoA-5); is this an advantage?

#3 Updated by Anna Maria Bigatti over 4 years ago

ooops, we overlapped and made incompatible changes.
But I think you had a better idea.
Should I undo my cvs?

#4 Updated by John Abbott over 4 years ago

  • % Done changed from 40 to 60

If you are convinced that my approach is better, then, yes, please undo your CVS update.

I am not certain whether coclib.cpkg5 is the right place...??

#5 Updated by John Abbott over 4 years ago

Should the function be documented?

If so, we should probably state that it exists just to increase compatibility between CoCoA-5 and CoCoALib (and may be "ignored" by those who have no intention of porting code to CoCoALib?)

#6 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 60 to 70

John Abbott wrote:

If you are convinced that my approach is better, then, yes, please undo your CVS update.

ok

I am not certain whether coclib.cpkg5 is the right place...??

it makes some sense: a place to have functions just for compatibility, but not worth a proper interface (at least for the time being)

#7 Updated by John Abbott over 4 years ago

  • % Done changed from 70 to 60

I am inclined to say that there is not much point in writing any tests for power. What do you think?

#8 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 60 to 70

John Abbott wrote:

I am inclined to say that there is not much point in writing any tests for power. What do you think?

I agree.
I undid my change in cvs.

#9 Updated by John Abbott over 4 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 70 to 90
  • Estimated time set to 1.33 h

I have just added a manual entry for power. I also removed the keyword power from the entry for DiagMat.

#10 Updated by John Abbott about 4 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

To appease Anna I have implemented the special case of the power of a diagonal matrix in CoCoALib (and removed PowerDiag as a keyword for the entry about DiagMat).

Also available in: Atom PDF