Opened 3 years ago

Last modified 3 years ago

#20454 new defect

conversion from SR[] to SR

Reported by: rws Owned by:
Priority: major Milestone: sage-7.2
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by rws)

Even if there are identical generator and variable names there should not be a problem to convert from a univariate polynomial with symbolic coefficients to a symbolic expression, but:

sage: S.<y> = PolynomialRing(SR)
sage: p = y^2 + pi*y + 1
sage: p.coefficients()
[1, pi, 1]
sage: ex = SR(p)
TypeError: not a constant polynomial

See #20453 and #20312 for motivation.

Change History (2)

comment:1 Changed 3 years ago by nbruin

You can get a morphism that does this:

sage: H=Hom(S,SR)(SR('y'))
sage: H(p)
(pi + y)*y + 1

I think we'll get more mileage out of educating users how to define the morphisms they need than trying to stuff every possible operation into conversion (although the one you propose here wouldn't necessarily be a problem by itself. You'll just have that S(SR(p)) != p, which will be a little surprising (and the fact that S(..) maps elements of SR to constants will be very hard to change, or at least cause big problems down the line if you do)

comment:2 Changed 3 years ago by rws

  • Description modified (diff)
Note: See TracTickets for help on using tickets.