Opened 4 years ago

Last modified 3 months ago

#24354 needs_review defect

RBF(expr) has the wrong parent

Reported by: mmezzarobba Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: numerical Keywords:
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: RBF(psi(1,1/3)).parent()
Symbolic Ring

Change History (5)

comment:1 Changed 13 months ago by mmezzarobba

  • Milestone changed from sage-8.2 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Now raises an error (thanks to #28517, I think). That's okay, though it would be even better to have a mechanism that makes this evaluation boil down to something like RBF(CBF(1/3).psi(1)).

comment:2 follow-up: Changed 11 months ago by vdelecroix

The generic symbolic evaluation is making at least two mistakes here. The code is at lines 1562-1568 of expression.pyx

try:
    res = self.operator()(*[R(a) for a in args])
except (TypeError, ValueError):
    pass
else:
    if res.parent() is R:
        return res

With the input provided in the ticket description, it produces

sage: from sage.functions.gamma import psi2
sage: psi2(RBF(1), RBF(1/3))
psi(1.000000000000000, [0.3333333333333333 +/- 7.04e-17])

This is bad since the proper way to make the call should have been psi(1, RBF(1/3)).

Secondly, psi(1, RBF(1/3)) is broken as it should produce a ball

sage: from sage.functions.gamma import psi2
sage: psi2(1, RBF(1/3))
psi(1, [0.3333333333333333 +/- 7.04e-17])

Is there a ticket to improve the RBF(expression)?

Last edited 11 months ago by vdelecroix (previous) (diff)

comment:3 in reply to: ↑ 2 Changed 11 months ago by mmezzarobba

Replying to vdelecroix:

Is there a ticket to improve the RBF(expression)?

None that I know of. (I started fixing the worst issues in #28517 and its dependencies, but didn't have the courage to handle all cases.)

comment:4 follow-up: Changed 4 months ago by slelievre

  • Cc slelievre added
  • Component changed from PLEASE CHANGE to numerical

Should we close this ticket as invalid or repurpose it to improve RBF(expr)?

comment:5 in reply to: ↑ 4 Changed 3 months ago by mmezzarobba

Replying to slelievre:

Should we close this ticket as invalid or repurpose it to improve RBF(expr)?

Close it, IMO. Improving RBF(expr) will take several tickets, and this one provides no clear roadmap.

Note: See TracTickets for help on using tickets.