Project

General

Profile

Design #1327

Inconvenient PolyRingHom, PolyAlgebraHom

Added by John Abbott over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Category:
enhancing/improving
Target version:
Start date:
07 Oct 2019
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

I wanted to do in CoCoA-5 an example/exercise from Martin Kreuzer's lecture course on computer algebra.
It turned out to be more awkward than I expected.

Can we make it easier?

The example was simply to compute the kernel of the algebra hom from QQ[z] which maps z to (1+sqrt(5))/2.

The problem I had was finding a neat way to create the hom (incl. having to look things up in the manual).

2020-02 solution:

/**/ phi := PolyAlgebraHom(NewPolyRing(QQ,"x"),
                      NewQuotientRing(NewPolyRing(QQ,"y"), "y^2-5"),
                      "(1+y)/2");
/**/ ker(phi);


Related issues

Related to CoCoALib - Feature #1330: New syntax for NewQuotientRingClosed2019-10-08

Related to CoCoALib - Feature #1329: New syntax for creating homomorphisms (PolyAlgebraHom)Closed2019-10-08

History

#1 Updated by John Abbott over 4 years ago

Here is the solution I ended up producing, but I found discovering it to be unnatural.

>>> use QQy ::= QQ[y];
>>> f := y^2-5;
>>> QQx ::= QQ[x];
>>> R := NewQuotientRing(QQy,ideal(f));
>>> use R;
>>> ?induced
>>> phi := PolyAlgebraHom(QQx,QQy,[indet(QQy,1)]);
>>> PolyRingHom(QQx,RHS,IdentityHom(QQ),[(1+y)/2]);
--> ERROR: RingHom has wrong codomain
>>> ?PolyRingHom
>>> phi := PolyRingHom(QQx,RHS,CanonicalHom(QQ,RHS),[(1+y)/2]);
>>> ker(phi);
ideal(x^2 -x -1)

Actually, I now see that my first attempt to use PolyAlgebraHom failed because I had the wrong CurrentRing. So this shorter approach also works... perhaps I was just being stupid/error-prone...

>>> use QQy ::= QQ[y];
>>> f := y^2-5;
>>> R := NewQuotientRing(QQy,ideal(f));
>>> use R;
>>> QQx ::= QQ[x];
>>> phi := PolyAlgebraHom(QQx,R,[(1+y)/2]);
>>> ker(phi);
ideal(x^2 -x -1)

#2 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 0 to 50

Alternative, without use:

 QQy ::= QQ[y];
 R := NewQuotientRing(QQy,ideal(RingElem(QQy,"y^2-5")));
 QQx ::= QQ[x];
 phi := PolyAlgebraHom(QQx, R, [RingElem(R,"(1+y)/2")]);
 ker(phi);

add this to the manual?
close this issue?

#3 Updated by John Abbott over 4 years ago

  • Status changed from New to In Progress

If we find it non-trivial to create a good solution then we really should include some example(s) in the documentation!

It would be nice if we could produce an easier way to make quotient rings. For example something like this:

 R ::= QQ[y]/(y^2-5);
 QQx ::= QQ[x];
 phi := PolyAlgebraHom(QQx, R, [RingElem(R,"(1+y)/2")]);
 ker(phi);

It would be still nicer if we could specify rings inside other expressions: something a bit like this...

 phi := PolyAlgebraHom(QQ[x], QQ[y]/(y^2-5), ["(1+y)/2"]);
 ker(phi);

Of course, as it is written here, it is "ambiguous". :-/

#4 Updated by Anna Maria Bigatti over 4 years ago

  • Priority changed from Low to Normal

John Abbott wrote:

It would be nice if we could produce an easier way to make quotient rings. For example something like this:
[...]

It would be still nicer if we could specify rings inside other expressions: something a bit like this...
[...]
Of course, as it is written here, it is "ambiguous". :-/

Nice idea!! Making a new issue.

#5 Updated by Anna Maria Bigatti over 4 years ago

#6 Updated by Anna Maria Bigatti over 4 years ago

  • Related to Feature #1329: New syntax for creating homomorphisms (PolyAlgebraHom) added

#7 Updated by Anna Maria Bigatti over 4 years ago

  • Status changed from In Progress to Resolved
  • Assignee set to Anna Maria Bigatti
  • % Done changed from 50 to 80

The power of the new string syntax: can be defined in one line, and the strings are evaluated in the appropriate ring, with no ambiguity.
Moreover we can write "y^2-5" when QQ[y] does not yet exist.

phi := PolyAlgebraHom(NewPolyRing(QQ,"x"),
                      NewQuotientRing(NewPolyRing(QQ,"y"), "y^2-5"),
                      "(1+y)/2");

Works also in CoCoALib.

#8 Updated by Anna Maria Bigatti over 4 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.3.0

#9 Updated by Anna Maria Bigatti over 4 years ago

  • Status changed from Resolved to Feedback
  • % Done changed from 80 to 90

#10 Updated by Anna Maria Bigatti about 4 years ago

  • Description updated (diff)
  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF