Opened 3 years ago

Closed 2 years ago

#21428 closed defect (fixed)

AssertionError plotting real part of complex function with float coefficients

Reported by: paulmasson Owned by:
Priority: major Milestone: sage-7.4
Component: symbolics Keywords:
Cc: Merged in:
Authors: Ralf Stephan, Paul Masson Reviewers: Paul Masson, Ralf Stephan
Report Upstream: N/A Work issues:
Branch: 8c1e1eb (Commits) Commit: 8c1e1ebcd96e48c8be6a9b79382e864c9daad059
Dependencies: Stopgaps:

Description

Attempting this plot produces the error:

sage: plot(real(sqrt(x - 1.*I)), (x,0,1))
...
/Users/Masson/Downloads/GitHub/sage/src/sage/symbolic/pynac.pyx in sage.symbolic.pynac.py_atan2 (/Users/Masson/Downloads/GitHub/sage/src/build/cythonized/sage/symbolic/pynac.cpp:18694)()
   1740     from sage.symbolic.constants import pi
   1741     parent = parent_c(x)
-> 1742     assert parent is parent_c(y)
   1743     if parent is ZZ:
   1744         parent = RR

AssertionError: 

Reported in this ask question.

Change History (11)

comment:1 Changed 3 years ago by rws

  • Branch set to u/rws/assertionerror_plotting_real_part_of_complex_function_with_float_coefficients

comment:2 Changed 3 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 13e72f347581f2836b5a9bbaef21035b2af4cbc7
  • Status changed from new to needs_review

New commits:

13e72f321428: be permissive in py_atan2

comment:3 Changed 3 years ago by paulmasson

  • Reviewers set to Paul Masson
  • Status changed from needs_review to needs_work

Solves the plot problem, but needs doctests for arguments with different parents to illustrate the change.

Also, there are uncommitted changes for Pynac 0.6.9.1 that get included when this branch is checked out. They belong on another branch and ticket.

comment:4 Changed 3 years ago by paulmasson

This simple change is likely to have future repercussions. Wouldn't it make more sense to determine both parents and use whichever is more general?

comment:5 Changed 3 years ago by rws

  • Branch u/rws/assertionerror_plotting_real_part_of_complex_function_with_float_coefficients deleted
  • Commit 13e72f347581f2836b5a9bbaef21035b2af4cbc7 deleted

comment:6 Changed 3 years ago by paulmasson

  • Branch set to u/paulmasson/21428

comment:7 Changed 3 years ago by paulmasson

  • Authors changed from Ralf Stephan to Ralf Stephan, Paul Masson
  • Commit set to 791b564fdfd53186df76f6d7dbb4cf059d1aab28
  • Status changed from needs_work to needs_review

This modification allows plotting to function without invalidating existing doctests.


New commits:

791b564Allow plotting to function

comment:8 Changed 3 years ago by git

  • Commit changed from 791b564fdfd53186df76f6d7dbb4cf059d1aab28 to 45a6b64db5302d8aaf6a17bd85f300c47c53e0d5

Branch pushed to git repo; I updated commit sha1. New commits:

45a6b64Merge develop

comment:9 Changed 3 years ago by paulmasson

  • Branch changed from u/paulmasson/21428 to u/paulmasson/21428-1

comment:10 Changed 2 years ago by rws

  • Commit changed from 45a6b64db5302d8aaf6a17bd85f300c47c53e0d5 to 8c1e1ebcd96e48c8be6a9b79382e864c9daad059
  • Reviewers changed from Paul Masson to Paul Masson, Ralf Stephan
  • Status changed from needs_review to positive_review

I think this is okay, and it tests fine with ptestlong.


New commits:

8c1e1ebAllow plotting to function

comment:11 Changed 2 years ago by vbraun

  • Branch changed from u/paulmasson/21428-1 to 8c1e1ebcd96e48c8be6a9b79382e864c9daad059
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.